That piece of code should be giving you a warning... I don't think you can
bind to static instances because the binding mechanism uses an object as
it's root, and in the case of a static there is no object.

This is one situation where a Singleton is a "good thing" and is the reason
(I believe) why Cairngorm and other similar MVC architectures use a
singleton for their ModelLocator instead of statics.

I got bit with exactly the same issue. Just make your class a singleton and
it'll all work out.

Troy.


On Jan 29, 2008 11:44 AM, Sherif Abdou <[EMAIL PROTECTED]> wrote:

>   *
>
> /**
>
> * The Static Image that we want to use
>
> */
>
> [
> Bindable]*
>
> [*Embed*(source=*'test.jpg'*)]
>
> *public* *static* *var* image:Class;
>
> *private* *function* initApp():*void*{
>
> /**
>
> * Create the image class since it is a DisplayObject
>
> * and add it to wherever u want
>
> */
>
> *var* TempImage:DisplayObject= *new* image();
>
> rawChildren.addChild(TempImage);
>
> }
>
>
>
>   ----- Original Message ----
> From: lytvynyuk <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Tuesday, January 29, 2008 11:24:23 AM
> Subject: [flexcoders] Embedded image and static variable problem.....
>
>  I have problem to bind image to static var
>
> my piece of code is:
> [EMAIL PROTECTED]('/images/ image.png' )]
> [Bindable]
> public static var image:Class;
>
> getting exception:
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
>     at support::PublicCons tants$/get voipguardImage( )[W:\jboss-
> 4.0.5\server\ default\deploy\ ISP.war\isp_ flex\support\ PublicConstants.
> as:117]
>     at support::PublicCons tants$cinit( )
>     at global$init( )[W:\jboss- 4.0.5\server\ default\deploy\ ISP.war\isp_
> flex\support\ PublicConstants. as:5]
>     at isp_flex/initApplic ation()[W: \jboss-4. 0.5\server\default\deploy\
> ISP.war\isp_ flex\isp_ flex.mxml: 66]
>     at isp_flex/___ isp_flex_ Application1_ initialize( )[W:\jboss-
> 4.0.5\server\ default\deploy\ ISP.war\isp_ flex\isp_ flex.mxml: 6]
>     at flash.events: :EventDispatcher /dispatchEventFu nction()
>     at flash.events: :EventDispatcher /dispatchEvent( )
>
> Any ideas why?
>
> Also how to make something like array of embedded images:
>
> var images:Array = [ @Embed('/images/ image1.png' ) , @Embed('/images/
> image2.png' ), @Embed('/images/ image3.png' )]
>
>
>
> ------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ>
> 

Reply via email to