Copy link to clipboard
Copied
stop() won't work in the code i want it in or just a new project to test it. it is in the first frame. In both of them it still continues the code and everything works fine.
I used this to test it :
stop();
trace("abc");
And here is the code i'm working on:
stop();
addEventListener(Event.ENTER_FRAME,LoadingProgress)
function LoadingProgress(evt:Event){
if(this.currentFrame == 1){
var moviebytesloaded:int = this.root.loaderInfo.bytesLoaded
var moviebytesleft:int = this.root.loaderInfo.bytesTotal
var movieKloaded = moviebytesloaded / 1024;
var movieKleft = moviebytesleft / 1024;
var loadLoc1:int = stage.width / 2;
var loadLoc2:int = stage.height / 2;
var loadingText:TextField = new TextField()
loadingText.text = "Loading: "+movieKloaded+"K/ "+movieKleft+"K";
loadingText.x = loadLoc1;
loadingText.y = loadLoc2;
trace("LoadingProgress")
}
}
var gravity:Number = .0098;
var accelY = 6;
var accelX =10;
var dragX = .5;
ball.x = 10;
ball.y = 10;
addEventListener(Event.ENTER_FRAME,Gravity)
addEventListener(Event.ENTER_FRAME,Throw)
addEventListener(Event.ENTER_FRAME,Drag)
addEventListener(Event.ENTER_FRAME,CheckCollision)
function CheckCollision(evt:Event){
if (floor.hitTestObject(ball)){
accelY = 0;
accelX = 0;
ball.y + .0098;
dragX = 0;
}
}
function Drag(evt:Event){
ball.x -= dragX;
}
function Throw(evt:Event){
ball.x += accelY;
ball.y += accelX;
}
function Gravity(evt:Event){
ball.y -= gravity;
}
The stop() command is a timeline command, not a command to inhibit execution of code.
If you do not want any other code to execute until a certain time, then you need to not execute any other code until then. That means you do not want to be assigning things like your various ENTER_FRAME listeners until they are wanted. Otherwise, they will execute immediately.
Copy link to clipboard
Copied
What do you want to stop here? Can you please explain your problem clearly. I will try to solve that as my level best.
Copy link to clipboard
Copied
I'm trying to stop everything so I can put in a loading screen and load the entire thing right away rather than stream it.
Copy link to clipboard
Copied
The stop() command is a timeline command, not a command to inhibit execution of code.
If you do not want any other code to execute until a certain time, then you need to not execute any other code until then. That means you do not want to be assigning things like your various ENTER_FRAME listeners until they are wanted. Otherwise, they will execute immediately.
Copy link to clipboard
Copied
Thanks that helped me figure it out.
Copy link to clipboard
Copied
You're welcome