I'm confused as to why the following gets a runtime error:

package nes
{
  import mx.collections.ArrayCollection;

  public class WATIcons
  {

    [Embed(source="/assets/customIcons/eye-16x16--CCFFF.png")] public static
var eye:Class;
    public static var customIcons:ArrayCollection = new
ArrayCollection([eye]);
  }
}

TypeError: Error #1009: Cannot access a property or method of a null object
reference.
    at nes::WATIcons$/get eye()[C:\Documents and Settings\xxxxxxxx\My
Documents\Flex Builder 3\WATControl\nes\WATIcons.as:70]
    at nes::WATIcons$cinit()

Yet if I remove the static and create an instance of the class, I don't get
any errors.  I can then use the customIcons array element 0 just fine.  I'd
really rather have them as static, as they are used all over in the
application.  Is there some way around this, or is it unavoidable?  If it's
unavoidable, then just out of curiosity what is causing the problem for the
compiler?

-- 
Jason

Reply via email to