A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How would I code this......

  1. #1
    Member
    Join Date
    Jul 2012
    Posts
    71

    How would I code this......

    Ok in my game there are 4 buttons. The player has to click the buttons in a certain order to win.
    For instance: The player has to click Button 1----> Button 3------> Button 1-------> Button 2------> Button 4
    How would I code that?
    .fla file: http://s000.tinyupload.com/index.php...21626332523324

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    First of all, your .fla doesn't open. It has 0.00 of size.

    Second, there is many way to achieving this, but i know one that works for me.

    I put all my buttons in a movieclip. Then I make few frames with a copy of my buttons. I put a stop(); on the first frame.
    Then in my frame 1, i assign the on(release){gotoAndStop(2); } function to my first button of the sequence, in your case, button1. The other buttons don't have script. Then in the frame 2, i do the same, but with my next button of the sequence, in your case button3. on(release){gotoAndStop(3); } and the other buttons I put the same script but to go to frame 1. So this is what gonna happen. The flash starts, we are at frame 1 of the movieclip holding all the buttons and frames. When you click buttons 3, 4, and 2, nothing happens, but when you click button 1, you are redirected to frame 2. In frame 2, you click button 3, and redirects to frame 3, but if you click buttons 2, 1, or 4, it goes to frame 1 and start the sequence again. Keep doing that until reaching frame 5, because your sequence is about 5 steps. Hope that helps. If you need to do this with actionscript, let me know.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

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