For example, i got video player .swf, where i got URL string that i would like to change inside my parent project, inside video player it looks like this:
ActionScript Code: // url to flv filevar strSource:Object = ("video/video.mp4");
I'm loading .swf inside parent project like this:
ActionScript Code: // create new loader for video playervar loaderVideo:Loader = new Loader();// spceify URL of video player .swfvar videoURL:String = "system/CLplayer.swf";// set video request from videoURLvar videoURLreq:URLRequest = new URLRequest(videoURL);// create container for video playervar video:MovieClip;// check if video is loadedvar videoIsLoaded:Boolean = false; // function to cast 'DisplayObject' to 'MovieClip'function initVideo(event:Event):void { video = MovieClip(loaderVideo.content); // set video loaded flag videoIsLoaded = true;}// Tell the loader to call 'initHandler' after the swf is initialized.loaderVideo.contentLoaderInfo.addEventListener(Event.INIT, initVideo);// load video content from videoURL stringloaderVideo.load(videoURLreq);// add video on stageaddChild(loaderVideo);
And i would like to see the result like in code for this .swf made in panorama2VR:
ActionScript Code: // create new loader for vr playervar loaderVR:Loader = new Loader();// spceify URL of 1st vr .swf to start tourvar vrURL:String = "system/vr/inside.swf";// set vr request from vrURLvar vrURLreq:URLRequest = new URLRequest(vrURL);// create container for vrvar vr:MovieClip;// check if video is loadedvar vrIsLoaded:Boolean = false;// function to cast 'DisplayObject' to 'MovieClip'function initHandler(event:Event):void { vr = MovieClip(loaderVR.content); // add vr to the stage addChild(loaderVR); // set alpha to 0 loaderVR.alpha = 0; // slowly change alpha of loader TweenLite.to(loaderVR, 0.7 ,{alpha: 1, delay: 0.1}); // set vr loaded flag vrIsLoaded = true;}function initPanorama(e:Event) {// check if the panorama object is available and initialize it if ((vr!=null) && (vr.pano!=null)) { removeEventListener( Event.ENTER_FRAME , initPanorama); vr.x=230; vr.y=98; vr.pano.setWindowSize(735, 530); }}// call initPanorama every frameaddEventListener(Event.ENTER_FRAME, initPanorama);// Tell the loader to call 'initHandler' after the swf is initialized.loaderVR.contentLoaderInfo.addEventListener(Event.INIT, initHandler);// load video content from vrURL stringloaderVR.load(vrURLreq);Here i can change vr.x / vr.y and setWindowSize even dynamicly from parent project!
How have they done it?
communications with loaded .swf
Sunday, May 13, 2012
[Action Script] communications with loaded .swf May,2012
Posted by Bimo Hery Prabowo at 7:13 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment