Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for Percentage Display of Loading Own Content

Status
Not open for further replies.

paradisewolf

Programmer
Mar 15, 2007
17
GB
I need an AS3 code for an external AS file that would provide the percentage of loading the content of its own swf
( library assets, etc ) and not external files. And then, after the loading is complete, it should add an instance of the main MovieClip ( from the library) into the stage.

( So far I only found code for preloading an external swf)

Any idea ?
 
I already have a code that goes embedded in first frame of a fla file and it works. The fla has two scenes, one called “preloader” and the other just “scene”.

In the “preloader” scene I have this code in the first frame:

import flash.events.ProgressEvent;

function LoadingProgress(e: ProgressEvent):void
{
var percent:Number = Math.floor( (e.bytesLoaded*100)/e.bytesTotal );

t.text = ""+percent;


if(percent == 100)
{
play();
}
}

loaderInfo.addEventListener(ProgressEvent.PROGRESS , LoadingProgres);

stop();

It also has an instance of an animation movieclip in the stage that shows the loading progress.

And in the “scene” scene it has a simple instruction as code in the first frame:

stop();

And it also has an instance of the main movieclip on the stage.

It works fine, but my version of a separated AS file ( using package/class ) is not working.
 
I just gave up, kenneth.

Instead, I am going to create a separate swf for the main content and then use a Loader to load it into a preloader.

Thank you anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top