Skip to main content
Alexanderite
Participant
July 4, 2016
Answered

If object true / false, go to scene

  • July 4, 2016
  • 1 reply
  • 467 views

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.

This topic has been closed for replies.
Correct answer Ned Murphy

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;

      }

}

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
July 4, 2016

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;

      }

}

Alexanderite
Participant
July 5, 2016

thank you for answering, but it still does not work

Ned Murphy
Legend
July 5, 2016

The code I provided works okay, so you must have a problem elsewhere.  If you get any error messages you should include them.