View Full Version : Make gotoAndPlay go to frame & keep going
SteelCity
March 12th, 2008, 11:25 PM
(AS3)
I have a preloader that upon completion will goto whichever frame I like.
The problem is that it stays on that frame, and I want it continue playing from that point. How can I make this happen?
icio
March 13th, 2008, 01:18 AM
What code are you using? This is what gotoAndPlay is supposed to do. Is there perhaps a stop action on the frame that you're going to?
SteelCity
March 13th, 2008, 01:26 AM
There is no stop action in that frame. The Preloader is in frame 1
percentTXT.text = "";
var loaded:Number = new Number();
var total:Number = stage.loaderInfo.bytesTotal;
var percent:Number = 0;
addEventListener(Event.ENTER_FRAME, function(){
if(percent > 99){
loadBar.width = 140;
(root as MovieClip).gotoAndPlay(2);
}
loaded = stage.loaderInfo.bytesLoaded;
percent += Math.round(((loaded/total)*100 -percent)/2);
percentTXT.text = percent.toString();
loadBar.width += (1.4*Math.round((loaded/total)*100) - loadBar.width)/2;
SteelCity
March 13th, 2008, 02:34 PM
Thank you all so much!!!
For future visitors here is my fully functional preloader script
percentTXT.text = "";
var loaded:Number = new Number();
var total:Number = stage.loaderInfo.bytesTotal;
var percent:Number = 0;
addEventListener(Event.ENTER_FRAME, goto2);
function goto2(e:Event):void
{
if(percent > 99){
loadBar.width = 140;
(root as MovieClip).gotoAndPlay(2);
removeEventListener(Event.ENTER_FRAME,goto2);
}
loaded = stage.loaderInfo.bytesLoaded;
percent += Math.round(((loaded/total)*100 -percent)/2);
percentTXT.text = percent.toString();
loadBar.width += (1.4*Math.round((loaded/total)*100) - loadBar.width)/2;
}
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.