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

Using a combobox to navigate to scenes with as3

Guest
Jan 16, 2012 Jan 16, 2012

I'm a novice.  I'm trying to use a combobox to navigate to different scene in my .fla.  I was able to use a conditional (if) statement which seems to work but it only allows me to use the "if" and "else if" statement once before giving an error.  i examined information on using a "switch" but haven't had any luck understanding the coding or getting it to work.  The following is the code I've wrote.  Can anyone provide me some guidance?  Thanks in advance.

cb1.addEventListener(Event.CHANGE, home_dl);

function home_dl(e:Event)

{

    if (cb1.selectedItem.label == "A - B")

    {

        gotoAndPlay(65, "a-b");

}

    else if (cb1.selectedItem.label == "C - D")

        gotoAndPlay(65, "c-d");

}

TOPICS
ActionScript
4.0K
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 , Jan 16, 2012 Jan 16, 2012

At a quick glance it looks like you are missing an opening curly brace following your second if()

else if (cb1.selectedItem.label == "C - D") {

Also, while it is probably just a copy/paste error, you are short one closing brace for the function

function home_dl(e:Event)

{

    if (cb1.selectedItem.label == "A - B")

    {

        gotoAndPlay(65, "a-b");

    }

    else if (cb1.selectedItem.label == "C - D") {

        gotoAndPlay(65, "c-d");

   }

}

Translate
Contributor ,
Apr 18, 2023 Apr 18, 2023

Ok, so the other key is knowing that it's a child of fl_controls. I did try looking there, but I wonder if I landed on an obsolete page. When I pick fl.controls, I get a different page, (with a 404 at the bottom):

https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/package-detail.html

Next I'm trying to set the color and thickness of the pulldown button and the border.

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
Community Expert ,
Apr 19, 2023 Apr 19, 2023
LATEST

looks ok to me.  everything i'd expect is listed there.

 

whatever is triggering the 404 at page bottom doesn't appear related to the fl.controls.

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