RE: [flexcoders] Using an embedded image at runtime, Please help.

2007-03-09 Thread Alex Harui
@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,0x00);

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 

 



RE: [flexcoders] Using an embedded image at runtime, Please help.

2007-03-09 Thread Giles Roadnight
Many thanks for the reply but I am still having some problems.

 

I have this code:

 

[Embed(source=../assets/mixi.swf)]

[Bindable]

 private var mixiLogo:Class;

 

at the top of my class and this code:

 

private function printMovies(e:Event):void

{

var mixiLogo:Image = new Image();

mixiLogo.load({this.mixiLogo});



this.addChild(mixiLogo);

}

 

That fires when I press a button but I am still getting a broken image. When
I try to load the image into a panel that I am building to print nothing
appears.

 

Is this code correct?

 

Thanks

 

Giles Roadnight

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: 09 March 2007 16:43
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Using an embedded image at runtime, Please help.

 

@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,0x00);

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.doPrintCanvas);

}

}

 

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

 

I hope someone can help.

 

Giles Roadnight 

 

attachment: image001.jpg
attachment: image002.jpg


RE: [flexcoders] Using an embedded image at runtime, Please help.

2007-03-09 Thread Alex Harui
Like @embed, {} is a binding directive to the MXML compiler and doesn't
have the same meaning in Actionscript.

 

Note that you are also using mixiLogo twice (class and local variable
name).

 

[Embed(source=../assets/mixi.swf)]

[Bindable]

 private var mixiLogoAsset:Class;

 

at the top of my class and this code:

 

private function printMovies(e:Event):void

{

var mixiLogo:Image = new Image();

mixiLogo.load(mixiLogoAsset);



this.addChild(mixiLogo);

}

 

 



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

 

Many thanks for the reply but I am still having some problems.

 

I have this code:

 

[Embed(source=../assets/mixi.swf)]

[Bindable]

 private var mixiLogo:Class;

 

at the top of my class and this code:

 

private function printMovies(e:Event):void

{

var mixiLogo:Image = new Image();

mixiLogo.load({this.mixiLogo});



this.addChild(mixiLogo);

}

 

That fires when I press a button but I am still getting a broken image.
When I try to load the image into a panel that I am building to print
nothing appears.

 

Is this code correct?

 

Thanks

 

Giles Roadnight

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: 09 March 2007 16:43
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Using an embedded image at runtime, Please
help.

 

@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,0x00);

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 

 



RE: [flexcoders] Using an embedded image at runtime, Please help.

2007-03-09 Thread Stephen Gilson
There is an entire chapter in the docs on this topic that might help:
 
http://livedocs.adobe.com/flex/201/html/embed_082_1.html
 
Stephen



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



Many thanks for the reply but I am still having some problems.

I have this code:

[Embed(source=../assets/mixi.swf)]

[Bindable]

 private var mixiLogo:Class;

at the top of my class and this code:

private function printMovies(e:Event):void

{

var mixiLogo:Image = new Image();

mixiLogo.load({this.mixiLogo});



this.addChild(mixiLogo);

}

That fires when I press a button but I am still getting a broken image.
When I try to load the image into a panel that I am building to print
nothing appears.

Is this code correct?

Thanks

Giles Roadnight

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: 09 March 2007 16:43
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Using an embedded image at runtime, Please
help.

@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,0x00);

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