Skip to main content
Participating Frequently
April 11, 2013
Answered

Help!! Visibility of a 3rd Button

  • April 11, 2013
  • 1 reply
  • 662 views

I'm a year12 student creating a major work in which I want to learn the code so that:


Once the user has clicked 2 buttons, a 3rd one will appear (but only once they've both been clicked)

but i'm not sure how to do this because I'm beginning and my teacher doesn't know flash very well
Please help!

This topic has been closed for replies.
Correct answer moccamaximum

This is what I wrote, the pink and blue are the two buttons and green is the button that I want to make visible from them

blue_btn.visible=true;
var blue:Boolean = new Boolean(true);

pink_btn.visible=true;
var pink:Boolean = new Boolean(true);


green_btn.visible=true;
var green:Boolean = new Boolean(true);

blue_btn.visible=false;
pink_btn.visible=false;
green_btn.visible=false;

blue1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void
{
blue_btn.visible=true;
(blue == true)
}

pink1.addEventListener(MouseEvent.CLICK, f2_MouseClickHandler);

function f2_MouseClickHandler(event:MouseEvent):void
{
pink_btn.visible=true;
(pink == true)
}

if(blue == true)
{
return (green == true)
}


var blue_clicked:Boolean = true;

var pink_clicked:Boolean = true;

var green_clicked:Boolean = true;

blue_btn.visible = pink_btn.visible = true;

green_btn.visible = false;

blue_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void

{

    blue_clicked = true;

    if (blue_clicked && pinked_clicked)

    {

        green_btn.visible = true

    }

}

pink_btn.addEventListener(MouseEvent.CLICK, f2_MouseClickHandler);

function f2_MouseClickHandler(event:MouseEvent):void

{

    pink_clicked = true;

    if (blue_clicked && pinked_clicked)

    {

        green_btn.visible = true

    }

}

1 reply

Ned Murphy
Legend
April 11, 2013

One way would be to have boolean two variables, one for each button, that start out being assigned a value of false and are changed to true when the associated button is clicked.  After that click change is made you test to see if both of those variables are true, and they are then you make the third button appear. 

EmmmaC954Author
Participating Frequently
April 11, 2013

I tried that but I wasn't able to do it properly because I don't have enough knowledge of flash and google didn't come up with anything. Would you be able to write out the code to do that for me please? It came up with an error everytime I tried.
Thanks heaps for responding

Ned Murphy
Legend
April 15, 2013

Show what you tried.  I'd rather help repair your attempt than write it all out for you.