OZONE Asylum
Forums
Multimedia/Animation
erm... attachMovie in class constructors?
This page's ID:
11466
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Well, back to scope problems -- and this is MX-relevant, so I hope you can give me a hand. It's very simple: I have a generic object acting as a keyboard handler, and within the onKeyDown inline function I want to refer to an object on the same level as the handler object. An example should make it more clear: [code] var test = 12; var watch_keyboard = new Object(); watch_keyboard.onKeyDown = function() { trace("Key pressed."); trace(test); } Key.addListener(watch_keyboard); [/code] When I do this, hitting any key displays "Key pressed" as it should, but the variable [i]test[/i] is undefined. So I tried _parent.test, and _parent._parent.test (just to see), and nope. Same with _root.test, and so forth. I even tried this._parent.test. A newly-created object should be able to access variables that are available to the scope at which it was created, right? There has to be a way to do it, I just don't know what it is. edit: Sorry, a little itchy on the Post finger. [url=http://faq.ozoneasylum.com/1250]Cell 1250[/url] :: [url=http://www.alanmacdougall.com]alanmacdougall.com[/url] :: [url=http://www.gurusnetwork.com/tutorials/illustrator/index.html]Illustrator tips[/url] [This message has been edited by Perfect Thunder (edited 10-20-2003).] [This message has been edited by Perfect Thunder (edited 10-20-2003).]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »