1 Reply Latest reply on Dec 6, 2007 1:19 PM by NathanThibert

    Embedding Image

    NathanThibert
      Hello,

      I am very new to Flex. Though I do have an issue already. I am trying to create an icon library which I can draw into my flex app. Though I am unable to bring in the image. I don't know why and I have seen an example done of this but it's still not working for me. The following is what I have done:

      ImageLibrary.as:
      package com
      {
      public class ImageLibrary
      {
      [Embed(source="../images/webCam.jpg")]
      [Bindable]
      public var imgClass:Class;

      }
      }

      TestProject.mxml:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" >
      <mx:Script>
      <![CDATA[

      import com.ImageLibrary;

      [Bindable]
      private var imgLib:ImageLibrary;

      ]]>
      </mx:Script>
      <mx:Image source="{imgLib.imgClass}" />
      </mx:Application>

      Ever time I run this I get run-time errors and The it says "Cannot access a property or method of a null object reference." I have no clue what that means. I hope someone out there can help me solve this issue.

      Thank you

      Nathan