I load a swf file in a swf file in action script 3.
I have a movie clip with a rectangle in it. I want to change the dimensions of the movie clip (width) corresponding to the percent of bytes loaded, like a progress bar.
The action script is attach on the timeline is not external.
up_mc is the movie clip; the width is just not chancing, he remain the same.
Code:
var req:URLRequest = new URLRequest("clip2.swf");
var loader:Loader = new Loader();
//thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
loader.addEventListener( ProgressEvent.PROGRESS, handleProgress );
loader.load(req);
function handleProgress( event:ProgressEvent ):void {
// Calculate the percentage by multiplying the loaded-to-total ratio by 100
up_mc.x = Math.round( event.bytesLoaded / event.bytesTotal * 100 );
}
/*function doneLoading(evt:Event):void {
holdermc = MovieClip(thisLoader.content);
stage.addChild(holdermc);
}*/