Copy link to clipboard
Copied
New to Flash...I am making an interactive E Learning Module. I created a menu with 4 buttons. Each button takes you through a different section of the module. What i am trying to accomplish is a notification that you have completed a section by changing the Menu Button to be grey. I created 2 buttons (one in color and one in Black and White). I placed the colored button on top of the Black and white button and then wrote this code. The problem is that even though the code works it resets every time you return to the Menu. How do i make it permanent (until the module is reloaded)
// Amp_Btn1 Click function
function mouseHandler(event:MouseEvent):void
{
//stop listening for clicks
Amp_btn1.removeEventListener(MouseEvent.CLICK, mouseHandler);
//make button invisible
Amp_btn1.visible = false
}
Copy link to clipboard
Copied
use a boolean to determine whether that button should appear and use the boolean to assign the button's visible property at the keyframe where you create your button and when clicking.
Copy link to clipboard
Copied
Example? New to Flash...sorry. Not sure how to use boolean
Copy link to clipboard
Copied
Let me make sure, This is a movie clip, that I created from a image that i imported. It is not an object i created in Flash
Copy link to clipboard
Copied
var button_inviz:Boolean
if(button_inviz){
Amp_btn1.visible=false;
}
// Amp_Btn1 Click function
function mouseHandler(event:MouseEvent):void
{
//stop listening for clicks
Amp_btn1.removeEventListener(MouseEvent.CLICK, mouseHandler);
//make button invisible
Amp_btn1.visible = false
button_inviz=true;
}
Copy link to clipboard
Copied
Ok, I copied the entire code you sent into frame1, but when i click Amp_btn1 it goes to the assigned frame, but when i return to frame 1 (menu) Amp_btn1 is still there.
Copy link to clipboard
Copied
I also tried creating a new project with 1 frame. 1 button on that frame. When i copy the code above into frame 1 and export swf still nothing. When i click Amp_btn1 it does not disappear.
Copy link to clipboard
Copied
then you may have lost your button reference by having that button in more than 1 keyframe or using it in a tween.
make sure your button exists on no other keyframe before the one with the code.
Copy link to clipboard
Copied
got it....
var byebyeButton:Boolean;
if (!byebyeButton) {
Amp_btn1.visible = true;
byebyeButton = true;
}
else
Amp_btn1.visible = false;
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more