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

If object true / false, go to scene

New Here ,
Jul 04, 2016 Jul 04, 2016

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.

TOPICS
ActionScript
437
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

correct answers 1 Correct answer

LEGEND , Jul 04, 2016 Jul 04, 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 && !blanke

...
Translate
LEGEND ,
Jul 04, 2016 Jul 04, 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;

      }

}

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 ,
Jul 04, 2016 Jul 04, 2016

thank you for answering, but it still does not work

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
LEGEND ,
Jul 04, 2016 Jul 04, 2016

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

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 ,
Jul 04, 2016 Jul 04, 2016
LATEST

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.

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