A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] multi domain upload

  1. #1
    Member
    Join Date
    Jan 2006
    Location
    Florida
    Posts
    51

    [F8] multi domain upload

    I have a complex flash site and i am a bit new to multi domain functions.

    i added
    Code:
    System.security.allowDomain("www.mysite.com");
    in on of my muvieclips that i am loadid. allso in that same movie i have a code to upload a file from the user compueter.

    my code is working properly if i am in www.mysite.com but if i am in local host it does not work

    Thanks
    Moises Zaragoza

  2. #2
    Member
    Join Date
    Jan 2006
    Location
    Florida
    Posts
    51
    Here is the code i am using
    Code:
    System.security.allowDomain("www.mysite.com");
    
    import flash.net.FileReference;
    import flash.filters.DropShadowFilter;
    stop();
    
    
    btn_PrevPhoto._visible = false;
    btn_NextPhoto._visible = false;
    pcount = 1;
    
    var frame_w = 0;
    var frame_h = 0;
    var dropShadow:DropShadowFilter = new DropShadowFilter();
    
    // SET DEFAULT IMAGE 
    
    
    
    if (_root.objVars["myImage"+pcount] == undefined) {
    	_root.objVars["myImage"+pcount] = _root.objVars.SWFdefaultImage;
    }
    // SLIDER STUFF                                    
    
    this.attachMovie("Slider","slider_sc",26);
    
    
    slider_sc.header.left = slider_sc.header._x-100;
    slider_sc.header.right = slider_sc.header.left+200;
    slider_sc.header.top = slider_sc.header._y;
    slider_sc.header.bottom = slider_sc.header._y;
    
    
    
    slider_sc._x = 330;
    slider_sc._y = 280;
    
    
    slider_sc.header.onPress = function() {
    	this.startDrag(false,this.left,this.top,this.right,this.bottom);
    	this.isDragging = true;
    };
    
    slider_sc.header.onRelease = function() {
    	this.stopDrag();
    	this.isDragging = false;
    	capsule.extCont._xscale = capsule.extCont._yscale=this._x;
    	_root.objVars["extCont_xscale"+pcount] = capsule.extCont._xscale;
    	_root.objVars["extCont_yscale"+pcount] = capsule.extCont._xscale;
    };
    slider_sc.header.onReleaseOutside = function() {
    	this.stopDrag();
    	this.isDragging = false;
    	capsule.extCont._xscale = capsule.extCont._yscale=this._x;
    	_root.objVars["extCont_xscale"+pcount] = capsule.extCont._xscale;
    	_root.objVars["extCont_yscale"+pcount] = capsule.extCont._xscale;
    };
    
    slider_sc.myTrack.onPress = function() {
    	var point:Object = {x:_xmouse, y:_ymouse};
    	slider_sc.globalToLocal(point);
    	slider_sc.header._x = point.x+this._x;
    	capsule.extCont._xscale = capsule.extCont._yscale=point.x+this._x;
    	_root.objVars["extCont_xscale"+pcount] = capsule.extCont._xscale;
    	_root.objVars["extCont_yscale"+pcount] = capsule.extCont._xscale;
    };
    
    
    capsule.extCont.onPress = function() {
    	this.startDrag();
    };
    capsule.extCont.onRelease = function() {
    	this.stopDrag();
    	_root.objVars["photo_x"+pcount] = this._x;
    	_root.objVars["photo_y"+pcount] = this._y;
    };
    capsule.extCont.onReleaseOutside = function() {
    	this.stopDrag();
    	_root.objVars["photo_x"+pcount] = this._x;
    	_root.objVars["photo_y"+pcount] = this._y;
    };
    
    // TOGGLE ANCHORS VISIBILITY
    
    
    //FILE UPLOAD
    
    var allTypes:Array = new Array();
    var imageTypes:Object = new Object();
    imageTypes.description = "Images (*.jpg, *.jpeg, *.gif, *.png)";
    imageTypes.extension = "*.jpg; *.jpeg; *.gif; *.png";
    allTypes.push(imageTypes);
    
    var listener:Object = new Object();
    
    listener.onSelect = function(file:FileReference):Void  {
    
    	if (!file.upload("http://www.mysite.com/printcards/uploadPhoto.aspx?noCache="+date.getTime())) {
    
    		tester.text = "Upload dialog failed to open.";
    		trace("Upload dialog failed to open.");
    
    	} else {
    		tester.text = "Upload dialog open properly.";
    	}
    };
    
    
    
    listener.onComplete = function(file:FileReference):Void  {
    	var myLoader:MovieClipLoader = new MovieClipLoader();
    	var myListener:Object = new Object();
    	myLoader.addListener(myListener);
    	myListener.onLoadInit = function(mc:MovieClip) {
    
    		mc.onPress = function() {
    			this.startDrag();
    
    		};
    		mc.onRelease = function() {
    			this.stopDrag();
    
    			_root.objVars["extCont_x"+pcount] = mc._x;
    			_root.objVars["extCont_y"+pcount] = mc._y;
    		};
    		mc.onReleaseOutside = function() {
    			this.stopDrag();
    			_root.objVars["extCont_x"+pcount] = mc._x;
    			_root.objVars["extCont_y"+pcount] = mc._y;
    		};
    
    
    
    		//RESIZE FOR HEIGHT
    		/*
    		mc._xscale=100
    		_root.tester.text=mc._xscale
    		if(mc._width > mc.height){
    		if(mc._height>216){
    		factor = Math.round((216/mc._height)*100);
    		
    		}
    		}else{
    		if(mc._width>216){
    		factor = Math.round((216/mc._width)*100);
    		}
    		 
    		}
    		
    		mc._xscale = factor;
    		mc._yscale = factor;
    		mc._x=-108;
    		mc._y=-112; 
    		//_root.objVars["extCont_y
    		_root.objVars["extCont_y=mc._y
    		_root.objVars["extCont_x=mc._x
    		
    		_root.objVars["extCont_xscale=factor
    		_root.objVars["extCont_yscale=factor
    		*/
    		// end resize
    	};
    	myData = new LoadVars();
    	myData.ref = this;
    	myData.load("http://www.mysite.com/printCards/lastPhotoUpload.aspx?noCache="+date.getTime());
    	//myData.load("http://www.brunoaun.com/mask/simplefileupload.php");
    	myData.onLoad = function(success) {
    		if (success) {
    
    			tester.text = this["resultss"];
    			_root.objVars["myImage"+pcount] = this["resultss"];
    
    			//myLoader.loadClip(file.name,capsule.extCont.photoCont);
    			myLoader.loadClip("http://www.mysite.com/printCards/"+_root.objVars["myImage"+pcount],capsule.extCont.photoCont);
    			capsule.extCont.photoCont._x = -100;
    			capsule.extCont.photoCont._y = -100;
    
    			// 
    			// Multi Photo upload Start 
    			//
    			updateCount("dimmed");
    
    
    			// 
    			// Multi Photo upload Finish 
    			//
    
    
    		} else {
    			myLoader.loadClip(file.name,capsule.extCont.photoCont);
    			trace("Error loading data");
    			tester.text = "Error loading data";
    		}
    	};
    
    };
    
    var myUpload:FileReference = new FileReference();
    myUpload.addListener(listener);
    
    this.attachMovie("upButt","upButt",39);
    upButt._x = 436;
    upButt._y = 240;
    upButt.onPress = function() {
    	myUpload.browse(allTypes);
    
    };
    
    //DRAW FRAME
    
    this.attachMovie("dashed_h","dh1",40);
    this.attachMovie("dashed_h","dh2",41);
    this.attachMovie("dashed_v","dv1",42);
    this.attachMovie("dashed_v","dv2",43);
    
    dh1._x = capsule._x;
    //dh1._y = capsule._y - frame_h / 2;
    dh2._x = capsule._x;
    //dh2._y = capsule._y + frame_h / 2;
    //dv1._x = capsule._x - frame_w / 2;;
    dv1._y = capsule._y;
    //dv2._x = capsule._x + frame_w / 2;
    dv2._y = capsule._y;
    
    dh1._alpha = 30;
    dh2._alpha = 30;
    dv1._alpha = 30;
    dv2._alpha = 30;
    
    // HINT SECTION
    
    this.attachMovie("hint","hintboard",44);
    hintboard._visible = false;
    hintboard._x = 444;
    hintboard._y = 150;
    hintboard.filters = [dropShadow];
    this.attachMovie("hintbutt","hintme",45);
    hintme._x = 56;
    hintme._y = 280;
    hintme.onRollOver = function() {
    	hintboard._visible = true;
    };
    hintme.onRollOut = function() {
    	hintboard._visible = false;
    };
    
    
    
    
    // btn_NextPhoto                       
    btn_NextPhoto.onPress = function() {
    	updateCount("plus");
    };
    btn_PrevPhoto.onPress = function() {
    	updateCount("min");
    };
    
    
    
    function updateCount(PlusMin) {
    	if (PlusMin == "plus") {
    		//capsule.extCont.photoCont.attachMovie("imgHolder","photoCont",capsule.extCont.photoCont.getNextHighestDepth());
    		capsule.extCont.photoCont.unloadMovie();
    		pcount++;
    		btn_NextPhoto._visible = false;
    	} else if (PlusMin == "dimmed") {
    		if (pcount<_root.objVars.cUploadPhoto) {
    			btn_NextPhoto._visible = true;
    		}
    	}
    	if (pcount<=1) {
    		btn_PrevPhoto._visible = false;
    	} else {
    		btn_PrevPhoto._visible = false;
    	}
    	/*if (pcount>=_root.objVars.cUploadPhoto) {
    	btn_NextPhoto._visible = false;
    	} else {
    	btn_NextPhoto._visible = true;
    	}*/
    
    
    }
    this.onEnterFrame = function() {
    	uploadNum.text = "Upload number "+pcount+" of "+_root.objVars.cUploadPhoto;
    };
    Moises Zaragoza

  3. #3
    Participant jide's Avatar
    Join Date
    May 2003
    Posts
    264
    If thats not working, maybe you could create an swf on each domain that all it does is upload the file/files. Then from the website, it just loads those swf.
    glhf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center