Little trickery and I resolved the problem
anyway 
basically I used name to keep checkbox number 

at  creation
var k1 : uint = k*2;
cbJ_L.name = k1.toString();
var k2 : uint = k*2+1;
cbJ_R.name = k2.toString();

and in function called upon change event 
public function setCheckBox(event:Event):void {
        var currNumber:uint = Number(event.currentTarget.name);
        var otherNumber:uint;
        if (currNumber%2 == 1) { 
                otherNumber = currNumber-1;
        } else {
                otherNumber = currNumber+1;
        }
        if (event.currentTarget.selected) {
                cbJ_arr[otherNumber].selected = false;
        } 
}

I am good at making things work but I would like to do it right way ;)

--- In flexcoders@yahoogroups.com, "alex steel" <[EMAIL PROTECTED]> wrote:
>
> Thanks again :)
> I understand referencing by array,
> but isn't it possible to reference by dynamiclly created name
> like in flash you can use name to create movieclip 
> _root.createEmptyMovieClip("name", 1000)
> 
> and then 
> name or _root["name"] can be use as reference
> 
> 
> another question is
> how I can pass variable via event
> basiclly if I have array of elements then I would like to pass array
> position of element in array so I can determine if it's left or right
> checkbox so I can keep only one of two checkboxes selected
> if I could add variables to elements that would be good
> like I can do in flash with movieclips mc.number = i
> or that need extending checkbox class ?
> 
> 
> thanks in advance
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Gordon Smith" <gosmith@> wrote:
> >
> > 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
> > 
> > 
> >
>


Reply via email to