Skip to main content
Participant
April 12, 2010
Answered

movieclip plays before the preloader finishes

  • April 12, 2010
  • 1 reply
  • 513 views

here is my AS3

var requestObj:URLRequest = new URLRequest("portfoliohome.swf");
var loaderObj:Loader = new Loader();
addChild(loaderObj);
loaderObj.load(requestObj);

loaderObj.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preloadProgress);

function preloadProgress(event:ProgressEvent):void {
    var loadedPercent:int = event.bytesLoaded / event.bytesTotal * 100;
    animation.preloader_mc.loadingBar_mc.loaderText_txt.text =  loadedPercent + "%";
   
}

loaderObj.contentLoaderInfo.addEventListener(Event.COMPLETE, preloadComplete);
function preloadComplete(event:Event):void {
    animation.preloader_mc.visible = false;
}

I do have stop(); on the 1st frame of the portfoliohome.swf, but It plays the movieclip(my intro)

before the loader finishes.  Is there a way for me to move the play head to frame 2 while I have the stop() on the frame 1?

or if there is a better way of solving the problem, please let me know

thank you

This topic has been closed for replies.
Correct answer Ned Murphy

You could try waiting until loading is complete before you addChild(loaderObj); and see if that helps.  Also, since this involves an swf file, you might want to use INIT rather than COMPLETE to decide when to let it loose.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
April 12, 2010

You could try waiting until loading is complete before you addChild(loaderObj); and see if that helps.  Also, since this involves an swf file, you might want to use INIT rather than COMPLETE to decide when to let it loose.

chicachiqAuthor
Participant
April 13, 2010

omg it works...

i did it by putting the addChild in the preloadercomplete function

thank you very much

Ned Murphy
Legend
April 13, 2010

You're welcome