Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-12-2009, 09:45 AM   #1
matt_sh
Registered User
 
Join Date: May 2009
Posts: 11
Default [AS3] First item in ComboBox

Hi,

I've got a two ComboBoxes set up and when a user clicks the first one it populates the second one and then after a user selects an item from the second one it add a MovieClip to the stage.

The problem I have is that when a user clicks itemA nothing happens. The only way to get itemA to load the MC to the stage is to click another item and then go back and click itemA.

Any idea how to get around this?

Thanks


ActionScript Code:
cb1.addItem({label:"Item1"}); cb1.addItem({label:"Item2"}); cb1.addItem({label:"Item3"}); cb1.addEventListener(Event.CHANGE, cb1Handler); function cb1Handler(event:Event):void {     if (cb1.selectedItem.label == "Item1"){ cb2.addItem({label:"ItemA"}); cb2.addItem({label:"ItemB"}); cb2.addItem({label:"ItemC"}); }
matt_sh is offline   Reply With Quote
Old 10-14-2009, 09:19 PM   #2
heddle
Multimedia Production
 
Join Date: Dec 2005
Posts: 17
Default

Couldn't you force the cb2 to show the content immediately, since the cb1 already has the focus on Item 1? I am assuming that when you select a new item from cb1, there is a "clear list" function before re-populating cb2.

cb1.selectedIndex=0;
cb2.addItem({label:"ItemA"});
cb2.addItem({label:"ItemB"});
cb2.addItem({label:"ItemC"});



cb1.addItem({label:"Item1"});
cb1.addItem({label:"Item2"});
cb1.addItem({label:"Item3"});

cb1.addEventListener(Event.CHANGE, cb1Handler);

function cb1Handler(event:Event):void {

if (cb1.selectedItem.label == "Item1"){

cb2.addItem({label:"ItemA"});
cb2.addItem({label:"ItemB"});
cb2.addItem({label:"ItemC"});
}
heddle is offline   Reply With Quote
Old 03-03-2010, 11:12 AM   #3
seraulu1
Registered User
 
Join Date: Mar 2010
Posts: 1
Default

Thanks for the comment!how to hypnotize someone
seraulu1 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:35 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.