Copy link to clipboard
Copied
I used below code in the time line to navigate between swf files if I press on nextBtn, but after 15 to 20 navigations Flash player is getting struck and I was not able to navigate to next swf file. Could you please check the below code and make necessary corrections if there are any mistakes
import flash.events.MouseEvent;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.MouseEvent;
fscommand("fullscreen","true");
nextBtn.addEventListener(MouseEvent.CLICK, nextFile);
function nextFile(evt:MouseEvent):void
{
stop(); // To stop the playing frame and move to next scene on click of next button
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("abc.swf");
/*var i:Number = 0;
for (i=numChildren-1;i>=0; i--)
{
removeChildAt(i);
} */
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
}
function onCompleteHandler(loadEvent:Event):void
{
addChild(loadEvent.currentTarget.loader);
}
function onProgressHandler(mProgress:ProgressEvent):void
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
}
Copy link to clipboard
Copied
only one swf file is loaded by thta code (abc.swf) so your snippet is not the (only) problem.
[moved from Creative Suites to ActionScript 3]
p.s. please don't cross-post
Find more inspiration, events, and resources on the new Adobe Community
Explore Now