Forum Moderators: open

Message Too Old, No Replies

Setting Flash combobox default via FlashVars

Can this be done?

         

catcherintherye51

11:19 pm on Jun 26, 2006 (gmt 0)

10+ Year Member



I have a combobox in Flash that is created dynamically via an XML file. Currently the first item in the XML is the default value, but I want to be able to tell Flash which item should be the default selection via FlashVars.

Here's the script to create the comboBox:

var myData:XML = new XML ();
myData.ignoreWhite = true;
myData.load ("myData.xml");
myData.onLoad = function (success:Boolean):Void
{
if (success)
{
var data:XMLNode = this.firstChild;
var children:Array = data.childNodes;
var numItems:Number = children.length;

for (var i:Number = 0; i < numItems; i++)
{
var child:XMLNode = children[i];
var name:String = child.attributes.name;
var URL:String = child.attributes.URL;
comboBox.addItem (name,URL);
}
}
};

I don't want the default value to be designated by the XML file. Any ideas? Thanks!