header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
khze86
Points:180
Posts:8

4/11/2010 7:56:05 PM

Title: ComboBox


Basically, I have three comboboxes with different drop-down menus. When one item is selected on “myCombobox2”, I want another item on ”myCombobox3”. Below is some of my current code for the project.


myCombobox2.dropdown.setRendererStyle("textFormat" , myTextFormat);
myCombobox2.textField.setStyle("textFormat", myTextFormat);
myCombobox2.dropdown.rowHeight = 30;
myCombobox2.prompt = "Select";
myCombobox2.addItem({label:"Green", text:"green"}) 
myCombobox2.addItem({label:"Blue", text:"blue"}) 
myCombobox2.addItem({label:"Purple", text:"purple"}) 
myCombobox2.addItem({label:"Red", text:"red"}) 


myCombobox3.dropdown.setRendererStyle("textFormat" , myTextFormat);
myCombobox3.textField.setStyle("textFormat", myTextFormat);
myCombobox3.dropdown.rowHeight = 30;
myCombobox3.prompt = "Select";
myCombobox3.addItem({label:"Sweatshirt", text:"sweatshirt"})
myCombobox3.addItem({label:"T-shirt", text:"t-shirt"})
myCombobox3.addItem({label:"Pants", text:"pants"})
myCombobox3.addItem({label:"Shoes", text:"shoes"})
myCombobox3.addItem({label:"Sweater", text:"Sweater"})
How do I create code that says when “Green” has been selected, delete the “Sweater” option from “myCombobox3.” I also need “Sweater” to disappear when “Purple” has been selected. Any help would be greatly appreciated. Thanks!



1
Inder
Points: 2980
Posts:0
4/11/2010 9:49:57 PM



for such category filters , the values are predefined in a function or come from database when selected. For e.g see code below. Below code i have just written in notepad so code syntax is not checked. Wanted to give u an idea. When color combo is changed inside change listener function first remove all the items of myCombobox3 and then add the option depending upon whats selected from color combo using switch case statement



function comboChangeListener(evt:Event):void{
	myCombobox3.removeAll();
	switch slectedItem;
	case "green"
		myCombobox3.addItem({label:"Sweatshirt", text:"sweatshirt"})
		myCombobox3.addItem({label:"T-shirt", text:"t-shirt"})
		myCombobox3.addItem({label:"Pants", text:"pants"})
		myCombobox3.addItem({label:"Shoes", text:"shoes"}) 
		break;
	case "purple"
		myCombobox3.addItem({label:"Sweatshirt", text:"sweatshirt"})
		myCombobox3.addItem({label:"T-shirt", text:"t-shirt"})
		myCombobox3.addItem({label:"Pants", text:"pants"})
		myCombobox3.addItem({label:"Shoes", text:"shoes"}) 
		break;
	case "Blue"
		myCombobox3.addItem({label:"Pants", text:"pants"})
		myCombobox3.addItem({label:"Shoes", text:"shoes"}) 
		break;
}



Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 6+4 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions