9 Replies Latest reply on Dec 3, 2007 4:18 AM by Greg Dove

    scripting for when all buttons are clicked

    Kirstii86
      Im quite new to flash well at least the scripting part of it. I'm much more of a designer and I'm having big problems I know that it is prob very simple but I am totally useless at it! Can some1 please just point me in the right direction thank you xxx
        • 1. Re: scripting for when all buttons are clicked
          Greg Dove Level 4
          You might need to post an example of any code you're currently using, if you have anything currently.
          Also do you know how to do some simple button scripts?
          If not, do your buttons have instance names in the property panel e.g. button1, button2 etc. And do you know how to 'play the message' ( I assume its a movieclip or a sound or something like that) from actionscript once all the buttons are clicked?

          Here's an example of a timeline script (on a frame, not attached to a button) that will do something like what you want.

          • 2. Re: scripting for when all buttons are clicked
            Kirstii86 Level 1
            hey thank you for that, I have given then instance names (btn_bat, btn_plug, btn_water) on each button I have scripts saying

            on (press) {
            gotoAndStop (2);
            }

            and different frames for each button.
            • 3. scripting for when all buttons are clicked
              Greg Dove Level 4
              Give this a try.

              1.Back up your fla in case you don't like this way of doing things.

              2. Delete the on (press) code on each of your buttons, so there's nothing left.

              3. Create a new layer. name it actionscript. Put a empty keyframe at the same frame number in the actionscript layer where your buttons are visible on another layer.

              4. click on that new keyframe in the actionscript layer. Then open the actions panel. (f9 in windows, don't know mac).

              5. Paste the following code in the actions panel.

              6. Test your movie. Is that the type of thing you want?

              • 4. Re: scripting for when all buttons are clicked
                Kirstii86 Level 1
                Thank you so much for all your help and I know I sound incredibly thick but just copying that doesnt do nething do I not need to some how tell it to go to the frame to play the congratulations sign??
                • 5. Re: scripting for when all buttons are clicked
                  Greg Dove Level 4
                  If you're testing in flash you should see some trace outputs in the output panel. If you don't then there's something not working right.

                  When you press each of your buttons, you want the main timeline to go to a different frame right? You need to set those frame targets in the code.

                  example for but_bat:
                  {button:but_bat, gotoFrame:2},

                  this sets things up so that when but_bat is pressed, the timeline goes to frame 2.

                  You will need to set the others for their correct frame targets. Just change the numbers for gotoFrame: number here


                  Is what you want to happen when all of the buttons have been clicked that a congratulations sign movieclip is played? (You haven't said what you wanted it to do at that point, so I'm afraid I couldn't know that ;-) ) At the moment I've set the script up so that it checks... but all it does is trace an output:'I would normally want to do something special from this point' where whatever you want to have happen when they're all pressed would be requested by actionscript. If you tell me what that is, I can tell you the code to do it.

                  • 6. Re: scripting for when all buttons are clicked
                    Greg Dove Level 4
                    If in doubt...or if you think we're not 'speaking the same language', put your fla somewhere online and post a link to it here. I'll take a look at it and answer that way.
                    • 7. Re: scripting for when all buttons are clicked
                      Kirstii86 Level 1
                      hey sorry for not explaining. This is for uni course work and Ive stressed so much I should of tried forums when I first got stuck! Its a simple activity for a child to do once they have found all the dangers I would like it to play a movie clip that I have set on frame 10. The buttons when individually clicked go to frames 2, 3 and 4. I was trying to send u the file as I'm not very good at explaining things but I cant seem to work that out either sorry. Thanx again for the help!
                      • 8. Re: scripting for when all buttons are clicked
                        Kirstii86 Level 1
                        I think the problem is the fact I no very little about flash's actionscript I'm an animation student been thrown into the deep end of a mulitimedia project. I would like to send you the file but I dont no how to put it on the web would I been able to send you it if I game you my email adress in a private message ?
                        • 9. scripting for when all buttons are clicked
                          Greg Dove Level 4
                          Once last try and if it doesn't work then you can send me your email address in PM and we'll do the exchange of the fla by email.

                          Try this:
                          replace all the code on that actionscript layer/frame with this (I'm assuming your congratulations message plays from frame 10 of your main clip and not inside another movieclip on frame 10... it can be done that way too):