Re: [Flashcoders] [AS2] Set the default value of a ComboBox

2009-01-08 Thread FlashDev

Thanks Jonathan, Sorted the problem basically i had to use this code...

function setValue (pValue:String):Void
{
for (var i:Number = 0; i < comboBox.length; i++)
{
if (comboBox.getItemAt(i).data == pValue)
{
comboBox.selectedIndex = i;
break;
}
}
}

setValue ("MyVariable");


Regards
SJM


jonathan howe wrote:

That sounds like a potential for unneeded redundancy/potential sync errors
if things change later.. Better to use the ComboBox.getItemAt() method,
right?

trace(myBox.getItemAt(4).label);
-jonathan



On Thu, Jan 8, 2009 at 12:12 PM, Eric E. Dolecki  wrote:

  

populate with an array, and then go through the array, and use the matching
index.

On Thu, Jan 8, 2009 at 11:29 AM, FlashDev  wrote:



Hi Guys, happy new year to you all!

I have a combobox added to the stage in the flash IDE and it is populated
via Actionscript 2 from an external XML file. The trouble is I want to
automatically select a label in the combobox rather than showing the
  

first


label which is the current default.

I populate my combobox like this:

combobox1.addItem({data:"data1", label:"lable1"});
combobox1.addItem({data:"data2", label:"lable2"});

Now I have a combobox with 2 labels, label1 and label2. I want label2 to
display as the default instead of label1, now I understand I could do:

combobox1.selectedIndex = 1;

but I actually want to loop through the combobox labels and match if
  

label2


= label2 then select that index, so is there any way I can read the
  

labels /


data of a combobox? I have tried combobox1.data and combobox1.labels, but
  

it


just returns undefined?

Thanks in advance
SJM
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

  


--
http://ericd.net
Interactive design and development
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders






  

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] [AS2] Set the default value of a ComboBox

2009-01-08 Thread jonathan howe
That sounds like a potential for unneeded redundancy/potential sync errors
if things change later.. Better to use the ComboBox.getItemAt() method,
right?

trace(myBox.getItemAt(4).label);
-jonathan



On Thu, Jan 8, 2009 at 12:12 PM, Eric E. Dolecki  wrote:

> populate with an array, and then go through the array, and use the matching
> index.
>
> On Thu, Jan 8, 2009 at 11:29 AM, FlashDev  wrote:
>
> > Hi Guys, happy new year to you all!
> >
> > I have a combobox added to the stage in the flash IDE and it is populated
> > via Actionscript 2 from an external XML file. The trouble is I want to
> > automatically select a label in the combobox rather than showing the
> first
> > label which is the current default.
> >
> > I populate my combobox like this:
> >
> > combobox1.addItem({data:"data1", label:"lable1"});
> > combobox1.addItem({data:"data2", label:"lable2"});
> >
> > Now I have a combobox with 2 labels, label1 and label2. I want label2 to
> > display as the default instead of label1, now I understand I could do:
> >
> > combobox1.selectedIndex = 1;
> >
> > but I actually want to loop through the combobox labels and match if
> label2
> > = label2 then select that index, so is there any way I can read the
> labels /
> > data of a combobox? I have tried combobox1.data and combobox1.labels, but
> it
> > just returns undefined?
> >
> > Thanks in advance
> > SJM
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> http://ericd.net
> Interactive design and development
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] [AS2] Set the default value of a ComboBox

2009-01-08 Thread Eric E. Dolecki
populate with an array, and then go through the array, and use the matching
index.

On Thu, Jan 8, 2009 at 11:29 AM, FlashDev  wrote:

> Hi Guys, happy new year to you all!
>
> I have a combobox added to the stage in the flash IDE and it is populated
> via Actionscript 2 from an external XML file. The trouble is I want to
> automatically select a label in the combobox rather than showing the first
> label which is the current default.
>
> I populate my combobox like this:
>
> combobox1.addItem({data:"data1", label:"lable1"});
> combobox1.addItem({data:"data2", label:"lable2"});
>
> Now I have a combobox with 2 labels, label1 and label2. I want label2 to
> display as the default instead of label1, now I understand I could do:
>
> combobox1.selectedIndex = 1;
>
> but I actually want to loop through the combobox labels and match if label2
> = label2 then select that index, so is there any way I can read the labels /
> data of a combobox? I have tried combobox1.data and combobox1.labels, but it
> just returns undefined?
>
> Thanks in advance
> SJM
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
http://ericd.net
Interactive design and development
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] [AS2] Set the default value of a ComboBox

2009-01-08 Thread FlashDev

Hi Guys, happy new year to you all!

I have a combobox added to the stage in the flash IDE and it is 
populated via Actionscript 2 from an external XML file. The trouble is I 
want to automatically select a label in the combobox rather than showing 
the first label which is the current default.


I populate my combobox like this:

combobox1.addItem({data:"data1", label:"lable1"});
combobox1.addItem({data:"data2", label:"lable2"});

Now I have a combobox with 2 labels, label1 and label2. I want label2 to 
display as the default instead of label1, now I understand I could do:


combobox1.selectedIndex = 1;

but I actually want to loop through the combobox labels and match if 
label2 = label2 then select that index, so is there any way I can read 
the labels / data of a combobox? I have tried combobox1.data and 
combobox1.labels, but it just returns undefined?


Thanks in advance
SJM
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders