View Full Version : Detecting MovieClip Clicks
brendanww
03-26-2005, 11:12 PM
How do I detect if a movie clip has been clicked (or what is the parallel of the button's on(press)).
Gibberish
03-27-2005, 06:51 AM
to test if the button has been clicked you need to set a boolean value.
pressed = false; // set initializing variable
// Set onPress Function
myBtn.onPress = function(){
if(pressed == false){
pressed = true;
trace('this button has been pressed');
}else{
pressed = false;
trace('this button has been unpressed');
}// End If Statement
}// End onPress Function
daveirish1
03-30-2005, 05:25 PM
so how can you stop it from being pressed more than once?
Gibberish
03-30-2005, 06:14 PM
you want the button to now show as active, the mc to go away, or just nothing happen when the user clicks?
daveirish1
03-30-2005, 06:24 PM
ideally, i suppose, i need the mc to go away when i click on another button (which will create a similar mc but with different values)
removemovieclip();?
i should use this? but where?
Gibberish
03-30-2005, 07:19 PM
i would just turn its visibility off. This way the button is still there if needed later.
myBtn.onPress = function(){
if(!pressed){
pressed = true;
this._visible = false;
}// End If Statement
}// End onPress Function
then to revert it through another button
myBtn2.onPress = function(){
myBtn._visible = true;
pressed = null;
}// End onPress Function
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.