A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash CS4 Action script help

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    3

    Question Flash CS4 Action script help

    I have done an animation which includes a button that I want to use to start it.

    I've added action script to stop the animation on the last frame, I just have no idea what action script to put in to start it when the button is pressed.

    I have 14 layers + an action script layer. 7 of the layers are animated.

    Any help would be much appreciated.

  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    You can use the gotoAndPlay() method.

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    3
    I'm a total noob mate. I dont fully know how to formulate the code.

    I'm using this to stop the animation after 1 play -

    addEventListener(Event.ENTER_FRAME, function(e:Event):void{
    if(currentFrame == totalFrames) stop();
    })


    I have a normal start button, but don't know how or what actionscript to enter to start the animation off.

  4. #4
    Junior Member
    Join Date
    Dec 2009
    Posts
    3
    I sorted it.

    Used the script -

    play_btn.addEventListener(MouseEvent.CLICK, myButtonFunction);
    function myButtonFunction(event: MouseEvent) {
    gotoAndPlay(2);

    }

    That took me ages to figure out. At least i'll never forget it. )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center