A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: click three buttons to run movie clip

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    2

    click three buttons to run movie clip

    Hi, I'm wondering if anyone has code that runs a movie clip after the three buttons on the screen have been clicked. any help would be great. Thanks

  2. #2
    Member
    Join Date
    Jul 2011
    Posts
    51
    Welcome juliestudent


    Actionscript Code:
    var count:int=0;
    for (var i=0; i<3; i++) {
        this["btn"+(i+1)].stop();
        this["btn"+(i+1)].buttonMode=true;
        this["btn"+(i+1)].clicked=false;
        this["btn"+(i+1)].addEventListener(MouseEvent.CLICK,handleMovieClip);
    }

    function handleMovieClip(evt:MouseEvent):void {
        if (evt.target.clicked==false) {
            count++;
            evt.target.clicked=true;
            evt.target.gotoAndStop(2);
            if (count==3) {
                trace("MoveMovieClip");
            }
        }
    }



    FFA

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    2
    Thanks, is the "btn" supposed to be the name of the button to be pressed? Also, in the end should it say gotoandstop or gotoandplay since I want it to play the movie in frame 2? thanks

  4. #4
    Member
    Join Date
    Jul 2011
    Posts
    51
    instance name of three buttons are btn1 btn2 and btn3

    These buttons has two frames inside it so that you can see the button was clicked.

    Your Movie Playing code will goes where the trace statement is.

    It will be the instancename.gotoAndPlay(2);


    FFA

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