|
When you declare <mx:RadioButton
id="f1"/> in MXML, the RadioButton instance does indeed have its
'name' property (and its 'id' property) set to the String "r1".
However, this isn't what allows you to access the RadioButton instance using
code like r1.label. To make that work, the MXML compiler autogenerates an
instance var var r1:RadioButton; in your Application or MXML component,
rather than a local variable inside a method like you've done. When you create
components dynamically, you can use the same technique: <mx:Script> public var r:RadioButton; private function someMethod():void { ... r = new RadioButton(); addChild(r); ... } </mx:Script> You can then use 'r' anywhere in your
script to access the RadioButton. - Gordon From:
On 6/13/06, Aasim
Momin <[EMAIL PROTECTED]>
wrote: I achieved that but how
do I assign unique ID's to each of them. Could you demonstrate
this via a small snippet of code. Regards, Aasim From: [email protected]
[mailto:
[email protected]] On Behalf Of Jeremy
Lu
On 6/13/06, Aasim
<[EMAIL PROTECTED]>
wrote: Hi, -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
- RE: [flexcoders] Duplicating controls dynamically Gordon Smith

