all groups > flash actionscript > august 2006 >
You're in the

flash actionscript

group:

Limiting # of times a peice of script is activated


Limiting # of times a peice of script is activated Jimmathy
8/13/2006 2:55:40 PM
flash actionscript:
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

Re: Limiting # of times a peice of script is activated kglad
8/13/2006 3:00:53 PM
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:



if(!hasBeenExecutedPreviously){
// code you want to execute exactly once
hasBeenExecutedPreviously=true;
}
Re: Limiting # of times a peice of script is activated Jimmathy
8/13/2006 3:38:25 PM
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.
Re: Limiting # of times a peice of script is activated kglad
8/13/2006 4:04:57 PM
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.
AddThis Social Bookmark Button