Copy link to clipboard
Copied
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!
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:MouseEv
...Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Show what you tried. I'd rather help repair your attempt than write it all out for you.
Copy link to clipboard
Copied
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)
}
Copy link to clipboard
Copied
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
}
}
Copy link to clipboard
Copied
Thanks HEAPS!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now