Killing me, Silent failure with class properties

Please observe the following code:

 
class A{
 
     private var canvas_mc:MovieClip
 
     public function A (mc:MovieClip)
    {
          this.canvas_mc = mc;
    }
 
    private function loadData(XMLLocation:String)
    {
         var xml = new XML()
         xml.onLoad = function (success)
         {
               if (success)
               {
                    trace("hi");
               }
               else
               {
                    trace("i didnt load");
               }
         }
         xml.load(XMLLocation);
    }
}

If i run this, say:

 
var a:A = new A (_root);
a.loadData("random.xml");

Then the following output is generated.

//hi

However… this is what stumps me and has done all weekend (i dont have the net yet). If i change the class to:

 
class A{
 
     private var canvas_mc:MovieClip
 
     public function A (mc:MovieClip)
    {
          this.canvas_mc = mc;
    }
 
    private function loadData(XMLLocation:String)
    {
         var xml = new XML()
         xml.onLoad = function (success)
         {
               if (success)
               {
                    trace("hi");
                   **trace(canvas_mc);**
               }
               else
               {
                    trace("i didnt load");
               }
         }
         xml.load(XMLLocation);
    }
}

then canvas_mc is undefined or null… i cant remember which.

Also, on top of that, i can change the class again to:

 
class A{
 
     private var canvas_mc:MovieClip
 
     public function A (mc:MovieClip)
    {
          this.canvas_mc = mc;
    }
 
    private function loadData(XMLLocation:String)
    {
         var xml = new XML()
         xml.onLoad = function (success)
         {
               if (success)
               {
                    trace("hi");
                    **tracerFunction();**
               }
               else
               {
                    trace("i didnt load");
               }
         }
         xml.load(XMLLocation);
    }
 
    **private function tracerFunction (): Void**
**   {**
**        trace("Im just a useless function");**
**   }**
}

Again, it will fail silently, the tracer function is never called.

Does anyone know what im doing wrong? :frowning:

Cheers.

Clarky.

PS & Edit Reason:

I am attempting to use Flash-Lite 2.1 and according to all my books, this is perfectly valid for 2.1.