4 Replies Latest reply on Aug 13, 2006 6:40 PM by Rothrock

    Limiting # of times a peice of script is activated

    Jimmathy
      I was wondering if was possible to make it so that you can only click on a button once and then the script is disregarded or destroyed. The reason that I want this to happen is because when the mc is clicked on it goes to and plays at the next frame, i already know how to do this, but i dont want it to be able to be clicked on again and go back to the frame and play again. I know that i could set this up through a series of attach movies, but (since im using swift 3D for the art, and wasnt thinking ahead)making that work would take longer than it is worth. I am ng an on (press) ,gotoAndPlay blah blah, on the mc. and the mc has a stop(); on the first frame, and the second frame is labeled fall. how would i do this?

      thanks
        • 1. Re: Limiting # of times a peice of script is activated
          kglad Adobe Community Professional & MVP
          if you want a button/movieclip button to only work once you can use its enabled property. if you want a button/movieclip button to continue to execute some code (but not all code) and continue to act like a button, the code you want to execute only once can be put in a conditional statement:

          • 2. Re: Limiting # of times a peice of script is activated
            Jimmathy Level 1
            You are amazing!!!!!! I didn't even know there was such a thing as enabled property! But when you said it, i tried it and it worked perfectly! How do you know all this stuff? Thanks once again kglad!( i think you are the only person who's ever really answered my questions.
            • 3. Re: Limiting # of times a peice of script is activated
              kglad Adobe Community Professional & MVP
              i learned mostly from this forum. for many months i would read questions (that had titles i could understand) that had responses. and i would continue to track those threads that i could understand and slowly gain information contributed by others.

              now i learn mostly by helping others. for most questions posed on this forum either i know the answer because it's been asked and answered before or i can solve the issue using the information i've gathered, sometimes working through the problem using the flash program.

              everytime i help solve a problem using the latter, i learn a little more. after 18,000+ responses and solving a few thousand problems i can't help but accumulate a substantial help data base. and the more you know, the easier it is to add more information and learn more.
              • 4. Re: Limiting # of times a peice of script is activated
                Rothrock Level 5
                Anytime you use something, oh I don't know, let's say a "button," go to the help files and find the Actionscript dictionary. Don't bother with searching for what you are trying to do, just go to that section. Under Flash MX04 it is

                Help Menu–>ActionScript Dictionary

                With Flash 8 I think it is called the ActionScript 2.0 Language reference.

                Anyways, you can then look up the item by class. In this case, the button class. There you will find everything you can do with that class – all the properties, methods, and events.

                Of course that won't make you a master all at once, but it will always provide a good starting place.