Can you see what this test case does:

dynamic class top {
  prototype.options = {};
}

class middle extends top {}

var test = new middle;

test.options === test['constructor'].prototype.options;

I think the syntax will be slightly different in JS2, but it will continue to work. I think for now this will be the best way to implement options, unless we find that making our classes all dynamic kills performance.


On 2008-03-20, at 15:47 EDT, Henry Minsky wrote:
I'm not sure what this['constructor'].prototype.options will return in
swf9. I can try it with a small test case,
but maybe is there a way to do this
that doesn't need to use .prototype?

function $lzc$set_options(hash) {
   // Ensure you have your own private options dictionary, not the one
   // inherited from your class, nor the default empty one inherited
   // from LzNode!
   if (this.options === this['constructor'].prototype.options) {
     this.options = new LzInheritedHash(this.options);
   }
   for (var key in hash) {
     this.options[ key ] = hash[key];
   }
 }



--
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to