Skip to main content
June 13, 2013
Question

Movie Clip Not Playing Animation

  • June 13, 2013
  • 1 reply
  • 1076 views

I want to make an RPG game which uses turn-based battles. The problem is that my animations aren't playing when a specific button is pressed.

When the user presses the button labeled "attack", it will set the variable (ryu_action = 1).

On the next frame my animation will detect the variable and set it's "Alpha" value accordingly. My code for the Movie Clip object is the following:

onClipEvent (enterFrame) {

    if (_root.action_ryu == 1) {

        this._Alpha = 100;

        this.gotoAndPlay(4)

        _root.Ryu._Alpha = 0;

    } else {

        _root.Ryu_Attack._Alpha = 0;

    }

}

What I wanted was for multiple layers with objects that play one single animation in them overlapping a certain area. They will all hide/unhide themselves according to what action the user makes.

The problem I have here is that when the user presses the "Attack" button, the movie clip will follow the "gotoAndPlay" command and got to the fourth frame within the Movie Clip but it will get stuck on the fourth frame, not moving at all.

There is a "stop()" command placed on frame 1 of the movie clip but it's in it's own keyframe and shouldn't affect the rest of the animation within the movie clip.

My mentor has alerady told me that the code should be correct but it's just not running right for some reason.

I am using Actionscrip 2.0 on Adobe Flash CS3 Professional with a Windows XP computer.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 13, 2013

1. you should have no code attached to objects.  assign your objects instance names (eg, mc) and use those names in your code.

2. that code should not be in an enterframe loop. 

if(_root.action_ryu==1){

mc._alpha=100;  // not _Alpha

mc.gotoAndPlay(4);

_root.Ryu._alpha=0;

} else {

_root.Ryu_Attack._alpha=0;

}

June 13, 2013

What clip event should I use? Also changing the spelling of "Alpha" to "alpha" doesn't really help nor does giving it an instance name help. Also I've tested it with instance names before only to get the same result

kglad
Community Expert
Community Expert
June 14, 2013

1. no clip event should be used

2. did you assign the movieclip an instance name (in the properties panel)?