Skip to main content
ambitious_Miracle1549
Participating Frequently
November 21, 2010
Question

Problem with Flash CS5

  • November 21, 2010
  • 1 reply
  • 585 views

Hi there,

I got a problem with my Flash IDE. When unticked "Automatically declare stage instance" for AS3 programming, I encounter an problem with my TLFTextField, debugger fire an Error #1009: Cannot access a property or method of a null object reference.

The object is very basic, containing two TLFTextField called respectively title and info, my as3 class is very basic as well:

package fr.lcclub.bubbles

{

    import fl.text.TLFTextField;

    import flash.display.Sprite;

    public class FlyInfo extends Sprite

    {

        public var title:TLFTextField;

        public var info:TLFTextField;

    }

}

Let me know if I am doing something wrong but as it is very basic I don't really see what can be misunderstood.

Thanks for your help,

Regards

Sylvain Lecoy

This topic has been closed for replies.

1 reply

November 24, 2010

Ether-x,

I have used your example, and built a FLA file that uses it. There is a trick that isn't so obvious. When you make a document class, it gets instantiated before the objects on the stage. So, in the constructor, I added an eventListener for Event.ADDED_TO_STAGE for one of the TLF objects. Once that gets fired, you can use it as you would normally. I've uploaded my example here:

http://dl.dropbox.com/u/9110597/Ether-x.zip

Let me know if that doesn't answer your question.