1
\$\begingroup\$

I am working on a game inside Flash with ActionScript 3.

I have a horse game object with different animations for Walk, Run and so on. I have never worked with different animation types with Flash timeline. I want to have all these animations setup on the timeline at different key frames with different labels for each animation.

After setting this up, how do I select a specific animation?

Currently what I have setup inside Flash does not seem to work. When the walk animation is about to end, I want it to loop and start from the beginning. Currently what it does is it plays all the animations set on the timeline and not just the walk animation.

horseOne.gotoAndPlay("startwalk");

if(horseOne.currentLabel == "endwalk"){
    horseOne.gotoAndPlay("startwalk");
}

Please refer to the image of my fla timeline.

enter image description here

\$\endgroup\$
0
\$\begingroup\$

Currently your script plays the animation and immediately checks if the currently label is "endwalk" only once.

What you need to do is use an onEnterFrame event and check what frame the animation is on.

That would fix your current issue.

You could also put simple actions on the frames themselves without having to use events.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.