Use a combobox control to access scenes with as3

I am a novice.  I try to use a combobox control to navigate to a different scene in my. Fla.  I was able to use a conditional statement (if) that seems to work but it only allows me to use the 'if' and a 'else if' stated once before giving an error.  I have reviewed all the information on the use of a 'switch', but did not have a chance to understand the coding or make it work.  Here is the code I wrote.  Can someone give me some advice?  Thanks in advance.

CB1.addEventListener (Event.CHANGE, home_dl);

function home_dl(e:Event)

{

If (cb1.selectedItem.label is 'A - B')

{

gotoAndPlay (65, "a - b" "");

}

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

gotoAndPlay (65, 'c - d');

}

A quick glance, it looks like you are missing an opening brace after your second if()

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

In addition, it is probably just a mistake of copying and pasting, you are short a closing brace of the function

function home_dl(e:Event)

{

If (cb1.selectedItem.label is 'A - B')

{

gotoAndPlay (65, "a - b" "");

}

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

gotoAndPlay (65, 'c - d');

}

}

Tags: Adobe Animate

Similar Questions

  • How to use the combobox control to filter datagrid in Flash Builder 4?

    Hello

    I worked through the TestDrive with Flash Builder 4 application and I would like to know how to filter a datagrid using a combobox control.  I googled the subject and results for many different versions of Flash, some who look like they're going to take a considerable amount of time to implement.  I hope, with Flash Builder 4, there is a simple way to do this without writing code pages.

    I think I can be close to getting this work by passing the combobox value in a PHP script that queries the database with a WHERE clause.

    Thakns,

    David

    On the change of the ComboBox, you can filter on the ArrayCollection.source that contains the data. And define the table filtered as the dataprovider for a datagrid. Take a look at the function of class filter Array.

    -Gerard

    http://www.gauravj.com/blog

  • Using a remote control or the remote with two Apple TV app?

    1 can a remote AppleTV, is the most recent or a last generation we use with two different AppleTV (one is the most recent and is the older generation)?

    2. an iPhone Remote APP can be used with two different Apple TV?

    Thank you.

    1 not easily. There is no way to select the device to control, you end up control both. You could get a programmable remote control and lead to control different devices, but this would require a deception.

    2. no doubt. The Remote app offers a grid of all ATVS, he knows, and you choose the one to control. It has the advantage of a keyboard for searches, passwords, etc. Do you need a remote pair with each ATV.

  • Help, DG filtering using the combobox controls and the text box

    I have a DG populated an arrayCollection collection. I have a text input where I can type in my search criteria to filter the DG. I also have a combo box that contains a list of all the columns in my DG, so I can determine what column to apply the filter.

    I was able to make a filter text on a DG in the past, if I use a static data in my arraycollection collection name, but this time I want it to be dynamic using the drop-down list box.
    Here is an example of my configuration:
    DG contains columns A, B, C, D and E. The drop-down list box contains the choices A, B, C, D and E - including the label and the value of the data are the same in this case. If I select choices from the drop-down list box and start typing in my text entry, the DG should start to filter according to my entry that is contrary to the values of column D.

    Here's my code work for static column D filtering:
    private function filterColumn (): void {}
    sFilter = TextFilter.text;
    myAC.filterFunction = doFilter;
    myAC.refresh ();
    }
    private void doFilter(obj:Object):Boolean {}
    var result: Boolean = false;
    If (! obj.) D.Length | obj. D.toUpperCase () .indexOf (sFilter.toUpperCase ()) > = 0) {}
    result = true;
    }
    return the result;
    }

    This code will allow me to type in text and it will only filter the D column. The value of the combo box has no importance at this stage.

    I need the code to make what use the value combobox.selectedItem.data instead of D. However when I try this, he told me - TypeError: Error #1123: filter operator is not compatible with the Object type

    Using most of the above code, I just changed the IF statement to:
    If (! obj.) (cbx.selectedItem.data) .length | obj. ((cbx.selectedItem.data) .toUpperCase () .indexOf (sFilter.toUpperCase ()) > = 0)
    And which generates the above error.

    Can someone help me find a way to replace by a static column for the dynamic combobox value value? Any help is appreciated.

    I thought about it.

    If (! obj [cbx.selectedItem.data] .length: obj [cbx.selectedItem.data] .toUpperCase () .indexOf (sFilter.toUpperCase ()) > = 0)

    For anyone who wants to try it.

  • Get the library MovieClip is on the scene with AS3

    Hey guys, a simple I think, right

    Could I please have the answer to get an element of MovieClip on the stage within say the class Document.

    The trick is

    I want to do when the MovieClip is link refers to a class name, but doesn't actually have a document class that is created.

    I know you can give a complete class with the document and which would not be easy.  But if you have 10 enemy objects literally doing the same thing, but just look different, why create 10 separate classes!

    or I am barking the wrong tree and that I should just set up 10 different enemy styles in the MovieClip 1 and just 1 class join her?

    Although always, I would like to know how to get dynamically a MovieClip on the stage of the library, when he isn't a class file associated with the class name in the link

    I saw that somewhere there are many moons but do not remember how it was done: s

    Thanks in advance

    Pocketninja

    I'll spare you any attempt by me to answer the questions of the Document class, but here are the basics to dynamically load a symbol in the library...

    First of all you must designate the object in the library as an element that can be dynamically loaded.

    Right-click on it in the library and select the link in the menu that appears. In the interface that appears, select export for Actionscript. A class name will be automatically assigned, you can change as you wish (let's just say you name MyObject). Is the name you will use to call in the library item.

    When you click OK to close this interface, it can come up with an indication saying that he finds not only the class so it will create a moment complie... click OK here.  You are made to prepare the object in the library.

    To add the item to the scene, treat it like any other new object instance:

    var newObject:MyObject = new MyObject();
    newObject.x =... etc...
    this.addChild (newObject);

  • XML to fill some movieclips added to the scene with AS3

    OK, I am new to AS3 and it's the biggest thing that I tried to do.

    I'm just at a loss for the right path to take to achieve what I want to do.

    In short, here is what the final result will look like:

    The scene contains a large (about X size) movieclip with a scroll bar (not important for this discussion). This movieclip is created using AS3.

    The large movieclip is filled with many small movieclips created from a template in the library. This model contains certain dynamic text fields (let's call them text1_MC and text2_MC). Dynamic text for each small movieclip is provided of an XML file that contains the text and text1 2 data.

    I was watching tutorials to dynamically add a text as well as the instructions of plotting xml data analysis and others. What I can't find is how add dynamically the text to a text field in a movieclip and then add the movieclip on the stage and then start everything for the next bit of data.

    What we call this process? I know that I am using a loop statement, but someone could give me an overview of all the different things I do to get my data on xml, fill a single movieclip, and then adding this movieclip to the greatest MC, then doing that everywhere for all xml entries I've got, then adding that great MC on the stage?  I would be happy to get it all myself.

    Thank you!

    Hello

    You have created a single object. Only, I changed your code. pls watch it.

    var Timeline_mc:MovieClip = new Timeline_MC();

    var flag: Flag_MC.

    function ParseFlags(flagInput:XML):void
    {
    var locationList:XMLList = flagInput.Flag.Location;
    var titleList:XMLList = flagInput.Flag.Title;
    var actionList:XMLList = flagInput.Flag.Action;
    for (var i: int = 0; i< locationlist.length();="">
    {

    flag = new Flag_MC();

    var locationElement: Number = locationList [i];
    var titleElement:XML = titleList [i];
    var actionElement: XML = actionList [i];
    Flag.txt_title. Text = (titleElement);
    Flag.txt_intro. Text = (actionElement;)
    Flag.x = (location element);

    Timeline_mc. AddChild (flag); / /[i] ;

    }
    }

    addChild (Timeline_mc);

    Thank you

    Concerning

    Bala.S

  • Control a Movie Clip with as3

    I try to control my mc. I want to put a MovieClip to another.

    I use the following code:

    box_mc.addChild(pic_mc);
    

    but it's not working.

    box_mc a clip of box, I want to put my pic_mc in this mc.

    I think it works well... try the photo to 0,0 first to see:

    box_mc. AddChild (pic_mc);
    pic_mc.x = 0;
    pic_mc.y = 0;
    box_mc.x = 0;

  • simple. (add a clip to the scene with AS3 code)

    var s1:MovieClip;
    S1.x = 100;
    S1.y = 100;
    S1.z = 10;
    addChild (s1);

    I get object draw and I study like this

    var s1:MovieClip = new MovieClip();
    S1.x = 100;
    S1.y = 100;
    S1.z = 10;
    addChild (s1);

    AM that I solved null object? and why I don't have anything in my point yet?

    The second approach is the right approach.  You don't see anything, because your movieclip contains nothing of Visual nature... everything what you have done is created an empty container.

  • Customization of the style (font, color, etc.) of a combobox control

    Hello

    Is anyone know how to change the police and look across to a ComboBox in Flash / ActionScript 3?

    There are theme files, I could download, or a script that I can use?

    I'm quite familiar with AS3 / Flash, but have never had need of a combobox so far of the skin.

    Pointers would be much appreciated!

    Thank you very much

    Ben

    You can style the main text (assuming your name of the instance of cb combobox) with:

    var tf:TextFormat = new TextFormat ("Arial", 24, 0xFF0000);
    cb.textField.setStyle ("textFormat", tf);

    the drop is more problematic - I have never been able to properly do this style (perhaps because it is not created until it must be displayed if setStyle gets ignored?)

  • Using Firefox 7.0.1; having problems with hotmail. Cannot click on controls at the top of MSG, which is New, reply, delete, etc.. Can click on the same commands @ the bottom of the problem w/no MSG. Also cannot click on Inbox folder once I have access to

    Using Firefox 7.0.1; having problems with hotmail. Cannot click on controls at the top of MSG, which is New, reply, delete, etc.. Can click on the same commands @ the bottom of the problem w/no MSG. Also cannot click on Inbox folder once I have access to another folder. All known solutions?

    This problem may be caused by the Yahoo! toolbar as scopes as well down and covers the top of the browser window, allowing links in this part of the screen not clickable.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • Direct access to scenes with a Combobox

    Hello!

    I made a flash drive to get the movie from a separate server. There are also a few slide shows, depending on the time in the movie, chances are the pictures are relevant with what you look., this photo chansements with the help of an xml file. Now, I also have a Combobox that works as a selecter chapter. I 'did' the combobox and the text I have in the xml file appears however now I can't the combobox control to work.

    I hope you understand there were im going with this and that somone have a good idea that I could do to solve this problem.

    OPS im working in AS2

    Of after your descriptions so far I can't determine what measures would be taken when the user clicks the drop-down list box.  You mentioned 'when I press one of the titles in the drop down list I want that she then jumps a precise moment in the film' but I don't know what this means... is a time in a video or picture in the timeline panel or something else?

    What you need to do is all first get your combobox filled with information/data of the label.   I suggest that everything that defines "a specific time" is the data of the ComboBox element.  When you click on it, therefore a listener assigned Exchange (look that up in the help documentation) as triggers for the event regardless of the action "go to" implies the selectedItem.data properties help (look for those too).

  • Using the ComboBox data with addChild

    I use AS3 with a ComboBox and click on items within the comboBox, I would like to add items to the library of my step.

    What I'm trying to do is access the property data of the addItem method and passing in the addChild method. Given that it is by the way the property data as string, it won't work. And I can't seem to find one solution other than a bunch of statements based on the selectedIndex property of the comboBox control. I prefer not to use the statements fi... it is messy and even more when I removeChild. Here is my code that does not work because the data property is passed as a string that is not accepted by the method addChild. Any suggestions?


    var newCat:Cat = new Cat();
    var newDog:Dog = new Dog();
    var newHam:Hamster = new Hamster();

    combo.addItem ({label: "Cat", data: newCat});
    combo.addItem ({label: "Dog", data: newDog});
    combo.addItem ({label: "Hamster", data: newHam});

    combo.addEventListener (Event.CHANGE, showImage);

    function showImage(myEvent:Event):void {}
    var theTarget:DisplayObject =
    myEvent.currentTarget.selectedItem.data as DisplayObject;

    stage.addChild (theTarget);
    }

  • I want to access and control my other laptop with wifi.

    * Original title: remote access

    I don't know anything then please help me from 0. I want to access and control my other laptop with wifi. I don't know where to start? Please?  Reference Dell w7 while the other is toshiba w8.

    (Moved from devices and drivers)

    You can do this with Remote Desktop.

    These can be useful:

    Remote Desktop connection: frequently asked questions

    The application of remote desktop help

    Remote Desktop in Windows 8

    John

  • How to use the "Toshiba controls" with other players?

    Heey

    I have a Satellite with Toshiba controls. How can I change so I can use the buttons for other media players and not only Windows Media Player?

    A dude sorry for the bad news, but I fear that it is not possible to use the Toshiba controls with another application as with WMP (CD) and WinDVD (DVD)
    I think that the utility was already programmed and designed to use only these two applications.

  • text messages sent with an email address from a touch ipod duplicated on a second ipod touch using a different email address, but the two ipods are controlled by a parent with the same apple ID and password.

    Text messages sent with an email address from a touch ipod duplicated on a second ipod touch using a different email address, but the two ipods are controlled by a parent with the same apple ID and password.  This has happened recently.  My two girls have used their respective ipods and texting, without their messages of duplication for each of the other ipods for more than a year.  Somehow recently, both addresses seem to be synced with them or something, so that both see each and other messages.  I've recently updated two ipods, iTunes on my computer--not the cloud and added music for two ipods, but has not changed anything by email email settings or message I know.  Help, please!

    Welcome to the Apple community.

    I can't fully follow how you have everything set up, but a glance at the settings > messages > send & receive

Maybe you are looking for