Copy link to clipboard
Copied
Hello. I want to ask something and I hope somebody would help.
I want to make a button go to particular scene when particular items are hidden and exist.
I tried this, however it doesn't work.
but_yes.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_13);
function fl_ClickToGoToAndPlayFromFrame_13(event:MouseEvent):void
{ if(book_red.visible = true)
if(skirt.visible = true)
if(book_purple.visible = true)
if(belt.visible = true)
if(doll.visible = true)
if(plate.visible = true)
if(paper.visible = true)
if(paper2.visible = true)
if(wardrobe_door_close.visible = false)
if(blanket_tidy.visible = false)
{
gotoAndPlay(99);
blanket_mess.visible = false;
}
}
I wonder where do I do wrong or lack.
1) that is not a correct syntax for arranging multiple conditions
2) when comparing for equality you use ==, not =.... but if you are comparing a boolean property you can just check the property...
3) you can use the ' ! ' to test for a false
function fl_ClickToGoToAndPlayFromFrame_13(event:MouseEvent):void
{
if(book_red.visible && skirt.visible && book_purple.visible && belt.visible && doll.visible && plate.visible && paper.visible && paper2.visible && !wardrobe_door_close.visible && !blanke
...Copy link to clipboard
Copied
1) that is not a correct syntax for arranging multiple conditions
2) when comparing for equality you use ==, not =.... but if you are comparing a boolean property you can just check the property...
3) you can use the ' ! ' to test for a false
function fl_ClickToGoToAndPlayFromFrame_13(event:MouseEvent):void
{
if(book_red.visible && skirt.visible && book_purple.visible && belt.visible && doll.visible && plate.visible && paper.visible && paper2.visible && !wardrobe_door_close.visible && !blanket_tidy.visible) {
gotoAndPlay(99);
blanket_mess.visible = false;
}
}
Copy link to clipboard
Copied
thank you for answering, but it still does not work
Copy link to clipboard
Copied
The code I provided works okay, so you must have a problem elsewhere. If you get any error messages you should include them.
Copy link to clipboard
Copied
Yes! It works now! Thank you again! The problem was I had 2 of the same but_yes MouseEvent. Even though there was not any error message.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now