3 Replies Latest reply on Oct 29, 2009 6:55 AM by Rob M Love

    dynamicaly loading an image (runtime) Cannot access a property or method

    Rob M Love

      Hope someone can help with this. I have a group that when a function is called creates a new var that is of type image. I set the propertys of the image in script and then use the add child method to add it to the group. When I do I get TypeError: Error #1009: Cannot access a property or method of a null object reference.

       

      public function loadImage():void
                  {

       

                      var im:Image = new Image();
                      im.percentHeight = 100;
                      im.percentWidth = 100;
                      im.source = s;

       

                
                      contentFrame.addChild(im);
                  }

       

      Can someone please tell me what I'm doing wrong?

       

      Thanks

      Rob