A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to make button do something different on second click?

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    4

    How to make button do something different on second click?

    I want a button where by clicking on it the first time it takes you to one frame. Something like this:

    Code:
    on(press) {
    gotoAndPlay(2)
    }
    But I want it to go to another frame on the second click. (And after that when I click on it the third time it goes back to the first script).

    Any ideas?

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Wrong forum, moved to Actionscript.

    You can create a counter. However, you should not associate the script with the button. That makes it more difficult.

    Place this in a frame on the main timeline where your button is:

    var count:Boolean = false;
    myButton.onPress=function()
    {
    if(!count)
    {
    gotoAndPlay(2);
    count=true;
    }
    else
    {
    gotoAndPlay(3);
    count=false;
    }
    }
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

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