Forum Topic: Making a movieclip clickable once?

(134 views • 6 replies)

This topic is 1 page long.

<< < > >>
None

The-master-tommy

Reply To Post Reply & Quote

Posted at: 5/31/08 07:21 AM

The-master-tommy NEUTRAL LEVEL 07

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.

Making a movieclip clickable once?


None

Montycarlo

Reply To Post Reply & Quote

Posted at: 5/31/08 07:38 AM

Montycarlo LIGHT LEVEL 19

Sign-Up: 03/14/05

Posts: 738

You need to tell us what Actionscript version you are using.


None

Ssilver7

Reply To Post Reply & Quote

Posted at: 5/31/08 07:39 AM

Ssilver7 EVIL LEVEL 34

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.
BBS Signature

None

The-master-tommy

Reply To Post Reply & Quote

Posted at: 5/31/08 07:51 AM

The-master-tommy NEUTRAL LEVEL 07

Sign-Up: 04/18/04

Posts: 26

I'm using 2.0.


None

Vengeance

Reply To Post Reply & Quote

Posted at: 5/31/08 08:49 AM

Vengeance EVIL LEVEL 28

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 ||========

BBS Signature

None

The-master-tommy

Reply To Post Reply & Quote

Posted at: 5/31/08 09:14 AM

The-master-tommy NEUTRAL LEVEL 07

Sign-Up: 04/18/04

Posts: 26

Thanks alot guys! :]


None

Ssilver7

Reply To Post Reply & Quote

Posted at: 5/31/08 09:30 AM

Ssilver7 EVIL LEVEL 34

Sign-Up: 02/19/04

Posts: 2,743

At 5/31/08 08:49 AM, Vengeance wrote:
At 5/31/08 07:39 AM, Ssilver7 wrote: So something like
Right 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.
BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 07:16 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!