[Laszlo-dev] Using 'this' within static LzNode.initialize
Donald Anderson
dda at ddanderson.com
Thu Dec 13 15:33:57 PST 2007
If I'm in a static function (like initialize), I get errors when I
reference 'this'.
Reading http://livedocs.adobe.com/flex/201/langref/
Object.html#constructor
it seems like we can get to the 'this' object using the prototype,
provided
the object wasn't created with a 'constructor function'.
Here's what I had in mind:
// class initializer
static function initialize (prototype) {
var thisobj;
if ($swf9) {
thisobj = prototype.constructor;
}
else {
thisobj = this;
}
// Hereafter use thisobj in place of this, needed for SWF9.
// was: if (this.hasOwnProperty('tagname')) ....
if (thisobj.hasOwnProperty('tagname')) {
Does that seem like it would work?
- Don
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
Voice: 617-547-7881
Email: dda at ddanderson.com
WWW: http://www.ddanderson.com
More information about the Laszlo-dev
mailing list