Jump to content
Search Community

Search the Community

Showing results for tags 'URLRequest'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

Found 3 results

  1. The first parameter of the various loaders (ImageLoader, XMLLoader, SWFLoader, MP3Loader, etc.) accepts either a simple String URL or a URLRequest. So if you want to pass data to the server, simply construct a URLRequest accordingly, like: var request:URLRequest = new URLRequest("http://www.yourDomain.com/whatever.php"); var data:URLVariables = new URLVariables(); data.exampleSessionId = new Date().getTime(); data.exampleUserLabel = "label1"; request.data = data; request.method = URLRequestMethod.POST; var loader:ImageLoader = new ImageLoader(request, {name:"image1"});
  2. Hello, I'm on a project created in Flash Builder 4.7 and Flash Professional CS6, nice. I need the project load's a SWF in the "preloaded SWF", the first SWF, loads a second SWF, and this second would be the "Home" of the project. At this point, work's perfectly. but when the home try to load secondaries SWF sends me The code of the first SWF: package { import flash.display.DisplayObject; import flash.display.Loader; import flash.display.MovieClip; import flash.events.Event; import flash.events.IOErrorEvent; import flash.events.ProgressEvent; import flash.net.URLRequest; public class InitialSWF extends MovieClip { private var _loader_:Loader; private var _applicationContent_:DisplayObject; private var _loaderContent_:MovieClip; private var _loaderIcon_:MovieClip; public function InitialSWF() { super(); _loader_ = new Loader(); _loader_.contentLoaderInfo.addEventListener(Event.COMPLETE,_onComplete_,false,0,true); _loader_.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,_onIoError_,false,0,true); _loader_.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,_onProgress_,false,0,true); _loader_.load(new URLRequest("Home.swf")); } private function _onComplete_(param1:Event) : void { _applicationContent_ = _loader_.content; _applicationContent_.visible = true; stage.addChild(_applicationContent_); _applicationContent_.addEventListener("onApplicationComplete",_onApplicationComplete_,false,0,true); _loader_.contentLoaderInfo.removeEventListener(Event.COMPLETE,_onComplete_); _loader_.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,_onIoError_); _loader_.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,_onProgress_); _loader_.unload(); _loader_ = null; } private function _onApplicationComplete_(tmpEvt:Event) : void { _applicationContent_.removeEventListener("onApplicationComplete",_onApplicationComplete_); _loaderContent_.addEventListener("loaderOut",_onLoaderOut_,false,0,true); // do something } private function _onLoaderOut_(param1:Event) : void { _loaderContent_.removeEventListener("loaderOut",_onLoaderOut_); _applicationContent_.visible = true; stage.removeChild(this); } private function _onIoError_(tmpError:IOErrorEvent) : void { trace(tmpError); } private function _onProgress_(param1:ProgressEvent) : void { var _progress_:Number = Math.round(param1.bytesLoaded / param1.bytesTotal * 100); //Do animation loading } } } And the HomeSWF: package { import flash.display.DisplayObject; import flash.display.Loader; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.DataEvent; import flash.events.Event; import flash.events.IOErrorEvent; import flash.events.ProgressEvent; import flash.events.HTTPStatusEvent; import flash.net.URLRequest; public class SecondarySWF extends Sprite { private var _loader_:Loader; private var _loaderContent_:MovieClip; private var _loaderIcon_:MovieClip; private var _applicationContent_:DisplayObject; public function SecondarySWF() { this.addEventListener(Event.ADDED_TO_STAGE,this._GoLogin_,false,0,true); } public function _GoLogin_(tmpEvent:Event) { _loader_ = new Loader(); _loader_.contentLoaderInfo.addEventListener(Event.COMPLETE,_onComplete_,false,0,true); _loader_.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,_onIoError_,false,0,true); _loader_.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,_onProgress_,false,0,true); _loader_.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); _loader_.load(new URLRequest("SecondarySWF.swf")); } private function httpStatusHandler(event:HTTPStatusEvent):void { trace(event); } private function _onComplete_(param1:Event) : * { _applicationContent_ = _loader_.content; _applicationContent_.visible = true; stage.addChild(_applicationContent_); _applicationContent_.addEventListener("onApplicationComplete",_onApplicationComplete_,false,0,true); _loader_.contentLoaderInfo.removeEventListener(Event.COMPLETE,_onComplete_); _loader_.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,_onIoError_); _loader_.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,_onProgress_); _loader_.unload(); _loader_ = null; this.removeEventListener(Event.ADDED_TO_STAGE,this._GoLogin_); } private function _onApplicationComplete_(param1:Event) : void { _applicationContent_.removeEventListener("onApplicationComplete",_onApplicationComplete_); _loaderContent_.addEventListener("loaderOut",_onLoaderOut_,false,0,true); // .. } private function _onLoaderOut_(param1:Event) : void { _loaderContent_.removeEventListener("loaderOut",_onLoaderOut_); //_applicationContent_.visible = true; //stage.removeChild(this); } private function _onIoError_(tmpError:IOErrorEvent) : void { trace(tmpError); } private function _onProgress_(param1:ProgressEvent) : void { var _progress_:Number = Math.round(param1.bytesLoaded / param1.bytesTotal * 100); // .. } } } This is an image of the Google console.log, and catch this: -start InitialSWF -Load HomeSWF -Complete loaded of HomeSWF -Start HomeSWF -The link of the Secondary SWF, I deleted the link in the image because contains data of me... -Load SecondarySWF - ERROR I don't know why the SecondarySWF is 100% loaded but return an error... Regards!
  3. I can't figure something out. I am trying to: Simply stated, I have loaded an XML doc. Changed it within Flash. I then want to update the XML doc on the server. Then reload the XML back into Flash. I have one main .xml document - "StudentXML.xml" (This is the file I want to overwrite with new info - it is also the file I read from with the application begins.) And one main .php document - "index.php" (sorry for my crappy naming standards..) Here is the PHP code I found (hoping it would do what I wanted) located in "index.php": <?php $filename = "StudentXML.xml"; $raw_xml = file_get_contents("php://input"); print $raw_xml; $fp = fopen($filename, "w"); fwrite($fp, $raw_xml); fclose($fp); ?> Here is my data I want to change and see transfered to the server to overwrite the current XML Document. At this point, I have already loaded, accessed, and read my StudentXML.xml within Flash. var newLogin:XML = <badge>eStudioLogin</badge>; studentXML.id.(@number == studentID.toString()).allBadgeNames.prependChild(newLogin); studentXML.id.(@number == studentID.toString()).badgesEarned = int(studentXML.id.(@number == studentID.toString()).badgesEarned) + 1; So far, and this is not working, I have pieced together this lovely bit of code: var requested:URLRequest = new URLRequest("www.mysite.com/index.php"); requested.data = studentXML; // This does trace the entire [i]edited[/i] XML document that is in Flash requested.method = URLRequestMethod.POST; var loader:XMLLoader = new XMLLoader(requested,{name:"StudentXML",onProgress:showProgress}); loader.load(); I know I am being dumb. It can't be this hard to transfer data and overwrite an existing xml document. Any help would truly be appreciated. Thanks, Adam
×
×
  • Create New...