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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

section25Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.