PDA

View Full Version : [FMX]On button(mc) for two actions



dboers
April 3rd, 2004, 04:58 PM
How can I make a mc witch I us as a button fuctional for two actions.I mean when I press the button that a clib fades out and when I press again it fades in again I tried it with an if but the it only works one time.This is the script


but.onRelease = function(){
if (mc._alpha <= 1){
fadeClip (mc, 100, 4);
}else if (mc._alpha >= 99){
fadeClip (mc, 0, 4);
}
}

What is wrong ?

kode
April 3rd, 2004, 05:23 PM
Try using a flag:

var a = false;
but.onRelease = function() {
fadeClip(mc, (a=!a)*100, 4);
};

dboers
April 3rd, 2004, 05:30 PM
That works perfect. Thanks a lot

kode
April 3rd, 2004, 05:31 PM
Welcome. :beam: