I ran across an odd situation inside the Flash IDE where I was trying to trace out parameters about the timeline’s class.
Here’s the code I was running:
import flash.events.* this.addEventListener(Event.ENTER_FRAME, function(e:Event){trace(this)});
the result looked something like this:
[object global] [object global] [object global]
This is a result of the dynamically created function created in the event listener. The function is created in some alternate universe called “global” and has nothing to do with the scope of the stage onto which it is placed. The correct code should be:
import flash.events.* this.addEventListener(Event.ENTER_FRAME, handleFrame); function handleFrame(e:Event):void { trace(this); }
This will produce something like:
[object MyClass] [object MyClass] [object MyClass]