3 Replies Latest reply on May 26, 2008 2:43 PM by kglad

    Assigning a class to symbols

    Bob Pierce Level 1
      I'm just getting the hang of creating my own classes and linking them to a symbol. But I've found that the resulting instance has an undefined depth and doesn't respond to .swapDepth() or .setDepthTo(). I've reduced the problem down to a very simple demo situation. This is my class file, DemoClass.as:

      class DemoClass{
      public function DemoClass() {
      trace("DemoClass: this = "+this);

      This is my test file which has a symbol "demoClass" in the library:

      import mx.managers.DepthManager;
      demo_mc = this.attachMovie("demoClass_id","demoMC",1);
      trace("demo_mc.getDepth(): "+demo_mc.getDepth());
      trace("demo_mc.getDepth(): "+demo_mc.getDepth());

      When the symbol has NO link to DemoClass, the output is:

      demo_mc.getDepth(): 1
      demo_mc.getDepth(): 21

      When the symbol is linked the output is:

      DemoClass: this = _level0.demoMC
      demo_mc.getDepth(): undefined
      demo_mc.getDepth(): undefined

      Is this what you'd expect or have I made an error somewhere?