Sorry... in the second example,
 
    var rb:RadioButton;
 
should be
 
    var rb:RadioButton = new RadioButton();
 
- Gordon

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Gordon Smith
Sent: Thursday, April 05, 2007 1:17 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: dynamically created access and event
elements problem and



> can you help me on part "you should keep variable referencing to
checkboxes"

Define an instance variable in your app or component. When you
dynamically create a CheckBox, store it in that variable:
 
<mx:Script>
 
    // Any other method in this class can access the radio buttons using
these variables
    private var radioButton1:RadioButton;
    private var radioButton2::RadioButton;
 
    private function createRadioButtons():void
    {
        radioButton1 = new RadioButton();
        // set properties, styles, and event handlers on radioButton1
  
        radioButton2 = new RadioButton();
        // set properties, styles, and event handlers on radioButton1
    }
 
</mx:Script>
 
If you don't know in advance how many checkboxes you''ll be creating,
use an array:
 
<mx:Script>
 
    // Any other method in this class can access the radio buttons using
this array.
    private var radioButtons:Array /* of RadioButton */ = [];
 
    private function createRadioButtons():void
    {
        for (var i:int = 0; i < ...; i++)
        {
            var rb:RadioButton;
            // set properties, styles, and event handlers on rb
            radioButtons.push(rb);
         }
    }
 
</mx:Script>
 
- Gordon

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of alex steel
Sent: Thursday, April 05, 2007 5:19 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: dynamically created access and event elements
problem and



Hi Alex, 

thanks for your time and help
I manage to get Event working 
but I still have a problem with variables
how should I get to them based on my code
tabs is name of TabNavigator
tab_page3 is name of tab / canvas
and thats the place where checkboxes and text is created
I've tried using getChildByName but with no luck
so can you help me on part
"you should keep variable referencing to checkboxes"

thanks!

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> You should keep variables referencing the checkboxes, call
> addEventListener to listen to the "change" event and set the selected
> property of the other checkbox
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of alex steel
> Sent: Wednesday, April 04, 2007 11:33 AM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: dynamically created access and event
elements
> problem and
> 
> 
> 
> can somebody help me please
> this is second post with question and yet nobody answers and I am sure
> this is pretty easy 
> I count on people here, but if you think I should try to find better
> place for help please let me know
> 
> Alex
> ...
> > This piece of code helps me create dynamically checkboxes in one of
> > the Tabs in my TabNavigator
> > 
> > my problem is how to access now to this elements so I can check
their
> > value and how to make event to make unselected some other checkbox
on
> > click 
> > checkboxes are grouped in Left and Right and only Left or Right can
be
> > selected, that's why I need an event
> > basiclly with hand placed CheckBoxes click=3D"cb_r.selected=3Dfalse"
> is
> > enough but for dynamically created I need your help
> > 
> > THANKS in ADVANCE ;)
> >
>



 

Reply via email to