1 Reply Latest reply on May 9, 2012 5:09 AM by Ned Murphy

    Help on adobe animation


      I need a help on adobe animation , i am using adobe flash pro cs and actionscript2.0(for certain reason i need to use as2.0)


      The scenario is:


      i want to loop between frame 1 and 189 for display 3 sentence and several animation as long as certain button didnt being press and hold(let say mouse left click), when the mouse is left click and hold, the animation should   loop between frame 190 and 240.


      i using the action code as below:


      this.onEnterFrame = function(){






      i create an empty timeline and put the code above  on it while i also put a gotoAndPlay(1) on  keyframe 189 for looping it back to frame 1. Another animation was set between frame 190 to 240 as well.


      However, the outcome was that, when i press and hold the left key of mouse, it did go to frame 190 but it end up stuck in frame 190 forever until i release the mouse then it going back to frame 1 and loop from 1 to 189 again.


      Anybody can provide me a little suggestion or alternate way for solviing this problem? I am newbie on this software so  your explaination in detail will be more appreciated.


      PS : the favorable solving outcome : 1) loop  frame 190 to 240 until key is relase


                                                           2) loop 190 to 240  when key is pressed,then after some time(let                                                          say 5 second), then back to frame 1.

        • 1. Re: Help on adobe animation
          Ned Murphy Adobe Community Professional & MVP

          The reason you get stuck at frame 190 is because you are constantly telling it to go there if the key is pressed in the onEnterFrame function


          You should get away from using the onEnterFrame and use listeners for the keys instead...


               var keyListener:Object = new Object();



               keyListener.onKeyDown = keyDownF;


               keyListener.onKeyUp = keyUpF;


          Then just create the keyDownF and keyUpF functions to do what you need.