2 Replies Latest reply on Apr 22, 2010 4:02 PM by CrazyMerlin

    Can someone explain this error?

    CrazyMerlin Level 1

      I needed to maintain scope while calling a method on an inherited class that is used as a callback from a HTTPService request. I thought I would try the known JS method of assigning a variable to this and then using that variable as the reference in the callback.


      That is when I noticed this issue: I had been reading about how AS creates a Class object for each class defined in an application, however if I do this:


      protected var self:Class = this;




      protected var self:Class;


      public function className():void {

        this.self = this;



      I get an implicit coersion error: 1067: Implicit coercion of a value of type com.webtop:AdminClass to an unrelated type Class.


      This makes no sense at all. If a Class object is created for my class, then my class is a Class. This can be proved by:


      private var activeClass:Class = null;




      private function someFunction():void {

        this.activeClass = CategoryClass;



      where CategoryClass is an uninstantiated class.


      So if this references my class, what exactly is this?