View Full Version : XML ComboBox populating ListBox
beaver88
07-11-2005, 06:17 AM
XML ComboBox populating ListBox
I want to have a ComboBox linked to an xml file so someone could pick a category and the results would show in a listBox.
Example: ComboBox would have the following labels – Accommodations, Attractions, Restaurants, Ski Resorts, etc.
So when the user click on Accommodations it would give you the results in the ListBox – label="Hilton Hotel", Data=”www.hilton.com”
label="Best Western", Data=”www.bestwestern.com”
label="Holiday Inn", Data=”www.holidayindn.com”
etc.
I don’t know if it would be easer just to put it together and just let me look through the source file and see how it’s done, then trying to type it out and explaining it to me.
Oh ya I am using Flash MX 2004 Pro
Any help would be awesome, and greatly appreciated.
Robert
Sunny13
07-11-2005, 06:30 AM
What you are supposed to do is to make a swf file for what your requirement is... and then call the swf IN the MyFile.xml file as follows.....
<dialog id="MyFile" title="MyFile">
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row>
<flash id="choices" width="140" height="100" src="My.swf" />
<property id="author" />
</row>
</rows>
</grid>
</dialog>
Call this file in jsfl as
var xui = fl.getDocumentDOM().xmlPanel(fl.configURI + "Commands/MyFile/MyFile.xml");
if (xui) {
fl.trace(xui.author);
}
the swf file must be having the following code on the press of the ok button
ok_btn.onRelease = function(){
XMLUI.set("author", list.value);
XMLUI.accept();
}
Hope it will work for you..... place all these files in the same folder in commands/MyFile folder .... :)
beaver88
07-13-2005, 05:56 AM
Thanks for the help, but that’s a little over my head. I’m a newbie to components and just trying to figure it out. I'm just trying to use the xml, combobox, and listbox component to make this all work. I have a link to a .fla and it might help anyone figure out what I am trying to do. I have an xml file with but I believe the format is totally wrong.
http://www.robertandkrista.com/sample.zip
Thanks for the answering my question Sunny13, plus thanks to anyone who will help me out.
sleekdigital
07-13-2005, 06:35 PM
I think Sunny13 may have misunderstood your question.
What you can do is have something listen for the combo box's change event...
myCombo.addEventListener("change", someListenerObj);
Then in the listener object have a function called change. When the event fires it will pass an event Object to the change handler function. The target property of the event object will be the combobox that fired the change event. So use that to get the new value that was selected in the combo box
function change(evtObj:Object):Void
{
// get the new value of the combo box
var selectedValue:String = evtObj.target.value;
}
Based on that value you would set the data of the list box... Many different ways to go about that. maybe you have setup dataproviders that correspond to each option in the combobox. So in the change handler you might say..
myList.dataProvider = _root["dataproviderFor" + selectedValue];
I don't advise using root, this is just for the sake of an example.
beaver88
07-13-2005, 10:04 PM
Thank you, I will give it a try
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.