PDA

View Full Version : Can an object's "this" property be reassigned?


techfreak11
10-22-2009, 02:52 PM
I have an object that passes itself to an inherited static function using the "this" property, but by the time the function is called "this" becomes a global variable.
Can anyone shed some light on way this happens?

senocular
10-22-2009, 03:20 PM
I don't understand what you mean by '"this" becomes a global variable' ?

ASWC
10-22-2009, 05:14 PM
If you mean that by the time you call this static function and pass this to it the this does not point to what you expect then it's just a code logic problem not a weird bug from Flash. "this" just points to the current object in scope and no this cannot be reassigned only the "this" changes when the scope changes.

henke37
10-22-2009, 07:29 PM
Technically, the Function class allows you to set the value of "this" prior to invocation, but it's a stupid thing to do.