When you assign an 'id' in MXML, an instance variable containing a reference to the component gets created in your Application or MXML component.

 

So you would simply do this:

 

    <mx:Script>

 

        private 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, just as if you had declared

 

    <mx:RadioButton id="r"/>

 

- Gordon

 


From: [email protected] [mailto:[email protected]] On Behalf Of Aasim Momin
Sent: Tuesday, June 13, 2006 5:32 AM
To: [email protected]
Subject: RE: [flexcoders] Duplicating controls dynamically

 

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
Sent: Tuesday, June 13, 2006 5:47 PM
To: [email protected]
Subject: Re: [flexcoders] Duplicating controls dynamically

 


no duplicateMovie() anymore,
try this whenever you need a new radio button.

var r:RadioButton = new RadioButton();
this.addChild( r );


On 6/13/06, Aasim <[EMAIL PROTECTED]> wrote:

Hi,

I am new to Flex. I would like develop an application which has a
number of radio buttons. How could i possibly duplicate them
dynamically?

Is there anyhing like duplicateMovieClip (as in Flash IDE).

Please suggest.

Regards,
Aasim

 

__._,_.___

--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to