# Killing me, Silent failure with class properties

**URL:** https://forum.kirupa.com/t/killing-me-silent-failure-with-class-properties/245102
**Category:** Uncategorized
**Created:** [November 26, 2007, 2:35pm UTC](https://forum.kirupa.com/t/killing-me-silent-failure-with-class-properties/245102 "2007-11-26T14:35:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![grandpaw\_broon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/grandpaw_broon/32/3985_2.png) [@grandpaw\_broon](https://forum.kirupa.com/u/grandpaw_broon)
#### Post date: [November 26, 2007, 2:35pm UTC](https://forum.kirupa.com/t/killing-me-silent-failure-with-class-properties/245102/1 "2007-11-26T14:35:18Z")

</div>

Please observe the following code:

```auto
 
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:

```auto
 
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:

```auto
 
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:

```auto
 
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? ☹

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.
