Kushubhai,
Doug is correct. @Embed is a compile-time directive. Therefore, in order to
reference the image dynamically, you will have to embed the image and
associate it with a variable.
Typically, I will create a class (appnameAssets.as) that contains all of the
embedded assets for my application. I then instantiate that class on an
'assets' property of my ModelLocator. Then I can reference the embedded
image dynamically as ... source="{ ModelLocator.assets.myImage }" ...
HTH
Rob Rusher
RIA Consultant
Macromedia Certified Flex Instructor
e:[EMAIL PROTECTED] c:303.885.7044 im:robrusher
blog:http://www.robrusher.com
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Doug Lowder
Sent: Friday, March 17, 2006 12:52 PM
To: [email protected]
Subject: [flexcoders] Re: Passing actionscript variable for image path into
@Embed()
You can do something like this to bind an Image tag to a variable that
refers to an embedded file.
In script:
[Embed("path/to/some/image.png")]
var myImage: String;
And in mxml:
<mx:Image source="{myImage}" />
Doug
--- In [email protected], "kushubhai" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am trying to pass a actionscript variable to the @Embed(..)syntax
> inside a <mx:Image [EMAIL PROTECTED](...) /> tag , but am unable to get
> the actual path of the image from the variable.Instead the variable
is
> picked up as the literal image path..and so the image is not
displayed.
>
> Need help on this..
>
> Thanks
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/