Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

as3 child clip help

Status
Not open for further replies.

lucidtech

IS-IT--Management
Jan 17, 2005
267
US
I'm new to AS3 and I'm trying to find an easier way to get a child element of a clip.

AS2 equivelant :
user_mc.btn_mc.btn

AS3 I'm doing this:
var user = this.getChildByName("user_mc");
var btnmc = user.getChildByName("btn_mc");
var btn = btnmc.getChildByName("btn");

Is there an easier syntax? There has to be, right?
 
The short answer is no. However if you are using the timeline you can use the same AS1/2 method. If you're using Classes then assign a public var to an object in order to access the child in this way.

Kenneth Kawamoto
 
Thank you kenneth. I had considered assigning a variable, but I'm looping through 20 tables each with 5 - 20 chairs, every call is to a dynamic seat within a dynamic table. An array might work but seems as though it'd be just as much work and not as intuitive when going back through your code. I'll stick with this way, just wasn't sure if there was a shorthand that I wasn't aware of since I just switched from AS2 to AS3. Gotta say I love it though!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top