# 1119: Access of possibly undefined property parent through a reference with static ty

**URL:** <https://forum.kirupa.com/t/1119-access-of-possibly-undefined-property-parent-through-a-reference-with-static-ty/324070>\
**Category:** flash\
**Created:** [July 31, 2011, 8:20pm UTC](https://forum.kirupa.com/t/1119-access-of-possibly-undefined-property-parent-through-a-reference-with-static-ty/324070 "2011-07-31T20:20:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeeto](https://avatars.discourse-cdn.com/v4/letter/z/e274bd/32.png) [@zeeto](https://forum.kirupa.com/u/zeeto)\
**Post date:** [July 31, 2011, 8:20pm UTC](https://forum.kirupa.com/t/1119-access-of-possibly-undefined-property-parent-through-a-reference-with-static-ty/324070/1 "2011-07-31T20:20:04Z")

</div>

Hi,

I’m having bit of a headache with 1119 error and I can’t figure out why.  
The problematic line is in red.

What I’m trying to do is:

1. Add Display Object “imagesGallery” to mainWin
2. Add MovieClip “imagesPreloader” to “imagesGallery”
3. Fire the “load” function from “imagesListLoader” which should fireup the function imagesLoaded in “imagesGallery”

Here’s the code:

_ **mystage/MainWin.as:** _

```auto
package mystage {
 
 import flash.display.MovieClip;
 import flash.events.Event;
 
 import gallery.*; // Importing all the classes below
 
 public class MainWin extends MovieClip {
  private var imagesGallery = new ImagesGallery;

  public function MainWin() {
   addEventListener(Event.ADDED_TO_STAGE, Init);   
  }
  
  private function Init(e:Event):void {
   removeEventListener(Event.ADDED_TO_STAGE, Init);
   addChild(imagesGallery);
  }
 }
}

```

_ **gallery/ImagesGallery.as** _

```auto
package gallery {
 
 import flash.display.MovieClip;
 import flash.events.Event;
 
 public class ImagesGallery extends MovieClip {
  
  private var imagesPreloader:ImagesPreloader = new ImagesPreloader;
  private var imagesListLoader:ImagesListLoader = new ImagesListLoader;
  
  public function ImagesGallery():void {
   addEventListener(Event.ADDED_TO_STAGE, init);
  }
  
  private function init(e:Event):void {
   removeEventListener(Event.ADDED_TO_STAGE, init);
   addChild(imagesPreloader);
   imagesListLoader.load();
  }
  
  public function imagesLoaded():void {
   trace("Images List Loaded");
  }
 }
}

```

\*\*\*gallery/ImagesPreloader \*\*\*

```auto

package gallery {
 
 import flash.display.MovieClip;
 import flash.events.Event;
 
 public class ImagesPreloader extends MovieClip {
  
  public function ImagesPreloader():void {
   addEventListener(Event.ADDED_TO_STAGE, init);
  }
  
  private function init(e:Event):void {
   removeEventListener(Event.ADDED_TO_STAGE, init);
   trace("Preloader Initiated");
  }
 }
}

```

_ **gallery/ImagesListLoader** _

```auto
package gallery {
 
 import flash.display.MovieClip;
 
 public class ImagesListLoader {
 
  public function ImagesListLoader():void {
    trace("ImagesList Loader Inititated");
   }
  
  public function load():void {
    trace("Images List Loading");
  [COLOR=#ff0000] MovieClip(this.parent).imagesLoaded();
[/COLOR] }
  }
}

```

What am I doing wrong?

Thanks
