USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 5/31/08 07:21 AM
Sign-Up: 04/18/04
Posts: 26
Hello. I got a question considering clickable movie clips. Let's say that I have a movie clip that looks like a melon. When I click the melon it's squshed and then the movieclip stops. That's fine, but how do I make the movieclip clickable only once? It's a bit wierd when the watermelon is rebuilt when clicked a second time :>
Thanks.
Posted at: 5/31/08 07:38 AM
Sign-Up: 03/14/05
Posts: 738
You need to tell us what Actionscript version you are using.
Posted at: 5/31/08 07:39 AM
Sign-Up: 02/19/04
Posts: 2,743
Make a variable that is initially true, then add an if statement that checks if the variable is still true when clicked, if it is then play the animation and set the variable to false.
So something like
var _root.clickable = true; on(press){ if(_root.clickable == true){ _root.melon.play(); _root.clickable = false; } }
The code might not be perfect, but its the jist.
Also, don't post irrelevant pictures.
Posted at: 5/31/08 07:51 AM
I'm using 2.0.
Posted at: 5/31/08 08:49 AM
Sign-Up: 03/18/05
Posts: 5,033
At 5/31/08 07:39 AM, Ssilver7 wrote: So something like
Right idea, just missed defining the variable on a load event
onClipEvent(load){ var pushed:Boolean = false; } on(press){ if(!this.pushed){ // If the button hasn't been pushed this.play(); // Play! this.pushed=true; //Tell the movieclip that it's been pushed. } }
========|| WWWWWWWW>[-[Blog] - [Audio] - [Userpage] - [Flash] - [Last.fm]-]<WWWWWWWW ||========
Posted at: 5/31/08 09:14 AM
Thanks alot guys! :]
Posted at: 5/31/08 09:30 AM
At 5/31/08 08:49 AM, Vengeance wrote: At 5/31/08 07:39 AM, Ssilver7 wrote: So something likeRight idea, just missed defining the variable on a load event
Yeah, I figured it wouldn't work.
Plugged in what I had into flash after a bit of inefficient coding got it to work.
Unrelated - It also seems that you live close to me.
All times are Eastern Standard Time (GMT -5) | Current Time: 07:16 AM
<< Back