Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Traversing objects in AS3
Old 02-12-2010, 03:22 PM Traversing objects in AS3
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
Hoping there are some AS3 helpers here.
I am very new to actionscript 3.0 so please bare with me!

I have 2 classes Main.as and RedPawn.as (yes, in the same folder).
I am wanting to check if a child exists on a movie clip in Main.as through RedPawn.as.

This is within a for loop since I am checking 24 possible values for _dest until I find a match.

This minified code example would be in the RedPawn class:

Code:
_dest = 'example_mc'; // example_mc is normally pulled from an array
if ( MovieClip(root)._dest.numChildren < 2 ) { // do stuff; }
Error:
Property _dest not found on Main and there is no default value.

I am assuming the code thinks I am looking for a variable that is within the Main.as class(?) but this variable is in the RedPawn class.

Is there a way to traverse this properly so it uses the _dest var set in this RedPawn.as class? For testing, I hard coded the _dest var then it worked fine.

Thanks so much!

Last edited by racer x; 02-12-2010 at 03:23 PM..
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
 
Register now for full access!
Old 02-12-2010, 06:15 PM Re: Traversing objects in AS3
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
with a fully qualified reference

RedPawn._dest
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-12-2010, 10:44 PM Re: Traversing objects in AS3
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
Thanks. I found a good board game style sample here and I realize it is bad practice to do what I was doing.

I shoulda started by making tic tac toe! ****!

I always pick a project that is over my head to begin with!
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Reply     « Reply to Traversing objects in AS3
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.63139 seconds with 12 queries