Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-10-2012, 05:25 PM   PM User | #1
NancyJ
Senior Coder

 
NancyJ's Avatar
 
Join Date: Feb 2005
Location: Bradford, UK
Posts: 3,162
Thanks: 19
Thanked 65 Times in 64 Posts
NancyJ will become famous soon enough
Why can one class access root variables but another can't?

root.somepropertyofmain works in every class in my project (so far) except one. If I trace root from within both say [object main] but one of my classes wont let me access the main variables - it gives a compile error: Access of possibly undefined property name through a reference with static type flash.displayisplayObject.
The property I'm trying to access is not undefined.It is declared and a value assigned to it in the class definition of Main.as, I cannot attempt to access any root variables from within this class, even ones that work in other classes.

The class that doesn't work is a class that is totally written in actionscript, when the app is run a movieclip (swatch_group) creates a bunch of these movieclips (paint_sample) within itself . When a paint sample is clicked it needs to know which item to apply itself to, which is a string stored in Main.as

[Update]

It will let me do this:

Code:
root[root['wall1'].parent.currentwall]
It allows me to access a property of root that I know is on the stage, access that object's parent (which is root) then access it variables... which is horribly kludgey.
__________________
http://www.hazelryan.co.uk

Last edited by NancyJ; 12-10-2012 at 05:37 PM..
NancyJ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 11:17 AM.


Advertisement
Log in to turn off these ads.