Hi!
I am new to Actionscript 3.0 and to create classes but I am trying to create a class to preload every swfFile I have on my site.How would I do this?
I was trying this:
Package
{
public class Carregador
{
public function loadSwf(swfFile:String):void
{
var request:URLRequest = new URLRequest(swfFile);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.load(request);
addChild(loader);
}
public function loadProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
trace("Loading: "+percentLoaded+"%");
}
function loadComplete(event:Event):void {
trace("Complete");
}
}
}
How would I show a progress bar(MC) that is on my stage?Would I have to send the name of a bar so that my class could increment its _x property?How does It work?
And how would I load my swf file into an empty MC like usual?