Neros
Neros

Reputation: 1129

single frame loop, gotoandplay same frame

I'm having trouble with something that should be incredibly basic, yet i have no idea how to solve my problem.


frame1:

x = 1

button1 makes x = 3

frame2:

trace x

gotoAndPlay(2)


the problem:

trace always = 1, even after you hit the button.

it shows x as being 3 when you hit the button but it reverts back right away, so it looks like gotoAndPlay(2) is still playing frame 1.

how do i stop it from reseting my variables?

Upvotes: 0

Views: 2032

Answers (1)

crooksy88
crooksy88

Reputation: 3851

If you're wanting to remain on frame 2 use gotoAndStop(2);

If you're wanting to create a loop for frame 2 try adding gotoAndPlay(2); to frame 3.

So frame 1 code:

var x:int = 1;

Button code would be moving to frame 2. Code on frame 2 would be

x = 3;
trace(x);

Upvotes: 1

Related Questions