msjlogicjunction
asked on
AS3 coding a loader for a swf so that the first scene will play while the others are still loading
Hi,
I have a loader for a 41MB swf that, at the moment makes the swf load in its entirety before it begins playing. I would like to change the code to allow the first scene to play as the others are continuing to download. Is this possible to do in the ActionScript?
My current code is:
Thanks!
I have a loader for a 41MB swf that, at the moment makes the swf load in its entirety before it begins playing. I would like to change the code to allow the first scene to play as the others are continuing to download. Is this possible to do in the ActionScript?
My current code is:
var req:URLRequest = new URLRequest ("VirtualNurseDemo5D.swf");
var loader:Loader = new Loader ();
function fileLoaded(event:Event):void
{
addChild(loader);
}
function preload(event:ProgressEvent):void
{
var percent:Number = Math.round(event.bytesLoaded / event.bytesTotal * 100);
loadertxt.text = String(percent) + "%";
trace (percent);
}
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, fileLoaded);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
loader.load(req);
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.