1 Reply Latest reply on Dec 15, 2009 8:05 AM by DazFaz

    Help with buttuns and Movie Clips


      I really hope you can help me! I am desperate!




      My main scene in only on 2 frames.

      On the second layers I have some buttons that activate my movie clips (on the third layer)...

      These buttons can be pressed 'randomly' and after the muvie clips are played my buttons (one by one) disappear to

      reaveal what on the first layer. Here there's another button, but I want it to be active only after all my movie clips have been played.


      ...here is the problem: what kind of ActionScript should I use to tell flash to go to the second frame of my time line (where my button on the first layer is active) only after all the mcs have been played?

      I tried everything I know, but I confess I am mostly a designer so my knowledge of Action Script is not so grent!


      Thanks for your help!




      Ps. My file at the moment is in AS2...
      This should be a second part of a game. People who arrive at this stage should now which are the right buttons to press. If they press the right one a pop up opens and some buttons disappear to reveal the massage that's behind. When all the right buttons have been pressed I need to play the frame 'end' on my timeline...
      The attached fla is an example of mine animation the right buttons are the red ones...  if you want to take a look would be great.

        • 1. Re: Help with buttuns and Movie Clips
          DazFaz Level 1



          The script below will look for your buttons and then add everything they need



          var myButtonsArray:Array = new Array();
          function reloadActions() {
          var detectForWord:String = "btn";// yu can have anything here as long as this string appears within the name of your buttons
          for (var i in _root) {
            if (i.indexOf(detectForWord) != -1) {
             myButtonsArray.push(i);// add all the buttons on screen to an array for checking purposes
             i["pressed"] = false;// set the variable "pressed" to false within all your buttons
             eval(i).onRelease = function() {// all function to detect if it has been pressed or not
              this.pressed = true;// if button has been pressed then set it to true
              // you could alternate this to treu and false with the code below
              //this.pressed = !this.pressed;
              areWeAllPressedYet();//now check to see if all the buttons have been pressed

          function areWeAllPressedYet() {
          var nope:String = new String();
          for (var i in myButtonsArray) {
            if (!eval(myButtonsArray[i]).pressed) {
             nope = "We are not all yet pressed";
            } else {
             nope = "Oh YES we are all pressed";
          trace("nope = "+nope);



          Hope this helps.


          This was done very quickly so if anyone can see any mistakes then please comment.