@Embed is a compiler directive so you can't put it in quotes.

 

You have to declare a variable

 

[Embed('../assets/mixipix.swf');

Var mixipix:Class

 

And load that

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Giles Roadnight
Sent: Friday, March 09, 2007 7:16 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Using an embedded image at runtime, Please help.

 

Hi

 

I am still trying to get this print job done. I have got all of the text
working fine but I can't get the logo to appear at the top, I hope
someone can help.

 

I have this code:

 

private function printMovies(e:Event):void

{

                var mixiLogo:Image = new Image();

                mixiLogo.load("@Embed('../assets/mixipix.swf')");

                this.addChild(mixiLogo);

}

 

But I just get a broken image appearing when I fire the function.

 

With this version of the function:

 

private function printMovies(e:Event):void

{

                

                this.printJob = new FlexPrintJob();

                

                if(this.printJob.start()){

                                

                                this.printPanel = new Panel();

                                var txtApprovedList:Text = new Text();

                                var mixLogo:Image = new Image();

                                

                                mixLogo.load("assets/logo.swf");

                                

 
txtApprovedList.setStyle("color",0x000000);

                                txtApprovedList.width =
printJob.pageWidth;

                                txtApprovedList.text =
this.txtMovieIDs.text;                    

                                

                                this.printPanel.addChild(mixLogo);

 
this.printPanel.addChild(txtApprovedList);

 
this.printPanel.setStyle("borderStyle","none");

                                

                                this.addChild(this.printPanel);

                                

 
printPanel.addEventListener(FlexEvent.CREATION_COMPLETE,this.doPrintCanv
as);

                }

}

 

I get the panel and text appearing but no iamge at all, not even a
broken one.

 

I hope someone can help.

 

Giles Roadnight 

 

Reply via email to