That returns true.
package  {
   import flash.display.*;
   public class Test2 extends Sprite {
        public function Test2 () {
            var test:top  = new middle();
            trace (test.options === test['constructor'].prototype.options);
        }
   }
}

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


As an experiment I tried declaring the variable "test" to be of type
"middle", and that gives
a compilation error

             var test:middle  = new middle();

/Users/hqm/openlaszlo/devildog/WEB-INF/lps/lfc/kernel/swf9/Test2.as(6): col:
26 Error: Access of possibly undefined property options through a reference
with static type Test2.as$23:middle.

             trace (test.options === test['constructor'].prototype.options);
                         ^

badtzmaru:swf9 hqm$
class middle extends top {}

On Thu, Mar 20, 2008 at 4:16 PM, P T Withington <[EMAIL PROTECTED]> wrote:
> 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]
>
>



-- 
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to