ActionScript 2.0: Using a variable to stop a movie clip.

I'm not very good with scripts.

I have a movie clip that has certain key frames, where it can be stopped. You can think of them as indices.

There is a button, which when pressed, shall stop the movie clip at the next index.

I thought to have a variable, somehow associate it with the button, and set it to zero (not pressed) and if pressed, it toggles to 1.

Then, at each index, to check what value the variable has. Something like:

if(_global.knapp = 1)
      stop();

      else
            nextFrame();

Can anyone help me with this?
LVL 11
Jason210Asked:
Who is Participating?
 
section25Connect With a Mentor Commented:
It looks like you have the logic correct. Althought I do see an error in your statement. For comparison use == instead of just = as in:

if(_global.knapp == 1) {
      stop();
}
 else {
            nextFrame();
}

Also you need to add the brackets {} for each staement. Try cutting and pasting the above code and see if it works for you.
0
All Courses

From novice to tech pro — start learning today.