Embed is a compile-time directive, not a runtime directive.  You need to use mx:Image or mx:Loader to pull in your image.
 
-rg


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of shahnavaz Alware
Sent: Monday, March 06, 2006 1:56 PM
To: [email protected]
Subject: [flexcoders] Dynamic Image Loading

Hi

 

I have to create an image in a TitleWindow when User clicks on one of the button.

<********************************* mxml *********************/>

<?xml version="1.0" encoding="utf-8"?>

   <mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml"

    closeButton="true"

            width="600"             

            height="600"            

            xmlns:attachment="com.hmssoftware.sfm.view.attachment.*"

            modalTransparency="20" click="this.deletePopUp();" creationComplete="createImage();"  >                

 

public var attachmentImageLocation:String;

public var attacmentImageTitle:String;

                                    public var initObject:Object;                                  

                                   

                                    [Embed(icon="../../../../../images/"+attachmentImageLocation)]

                                   

                                    var _imgAttachment;

                                                                                   

                                    public function createImage():Void

                                    {

                                                initObject = new Object();

                                                initObject.source = _imgAttachment;

                                                Image(imageBox.createChild( Image, undefined, initObject));          

                                   

                                    }

 

            <mx:VBox id="imageBox" height="100%" width="100%" hScrollPolicy="on" vScrollPolicy="on">

            </mx:VBox> 

</mx:TitleWindow>

 

I get the following error “result Failed to find resource: ../../../../../images/  “

 

Can show me how to load images dynamically? My attachmentImageLocation is the full name of the image file without path e.g. “Op120.jpg”.

 

Thanks,

 

Shahn

 

Shahnavaz Alware | Software Engineer | Visiprise | office: +1 760-929-2300 ext 140 | cell: +1 858-366-3440 | www.visiprise.com

 

It is our company policy not to accept email of any data controlled by the International Traffic in Arms Regulations (ITAR). Please contact our Security Officer, Matt Reeves, for instructions and authorization to transmit such data.

 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to