<mx:CheckBox id="checkbox1" ... />

 

is referred to in the <mx:Script> block as:

 

checkbox1

this.checkbox1

this["checkbox1"]

 

as in:

 

trace(checkbox1.selected)         // get the selected property

 

There is no function since they are actually properties on the document.
Subdocuments use parentDocument to talk to parent documents.

 

-Alex

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of carl_steinhilber
Sent: Friday, May 18, 2007 4:46 PM
To: [email protected]
Subject: [flexcoders] AS/Flex equivilent of getElementById() ??

 


Given a string that represents the id of a given component, is there a
way to get a handle to that component?

Something like:

var myCheckboxName:String = "checkbox1";
var myActualCheckbox:CheckBox = getElementById(myCheckboxName);
myActualCheckbox.selected = true;

I figured if nothing else I'd be able to eval() the string... but then
I remembered that AS3 deprecated eval().

Anyone know of a way to do this?
Thanks in advance!
-Carl

 

Reply via email to