Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Making a button disappear Permanetely....

New Here ,
Feb 13, 2016 Feb 13, 2016

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

}

TOPICS
ActionScript
588
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2016 Feb 13, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 13, 2016 Feb 13, 2016

Example? New to Flash...sorry. Not sure how to use boolean

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 13, 2016 Feb 13, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2016 Feb 13, 2016
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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 13, 2016 Feb 13, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 13, 2016 Feb 13, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2016 Feb 13, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 14, 2016 Feb 14, 2016
LATEST

got it....

var byebyeButton:Boolean;

if (!byebyeButton) {

     Amp_btn1.visible = true;

     byebyeButton = true;

}

else

     Amp_btn1.visible = false;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines