This works too:

<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.containers.Canvas;
[Embed(source="/images/splash.png")]
[Bindable]
private var myHelpImageSource:Class;
private function initUI():void {
var myCanvas2:Canvas = new Canvas();
var myHelpImage:Image = new Image();
myHelpImage.source = myHelpImageSource;
myCanvas2.addChild(myHelpImage); 
myCanvas.addChild(myCanvas2);  
}
]]>
</mx:Script>

<mx:Canvas id="myCanvas" width="600" height="500" />

So maybe I'm missing something, but I'm not seeing why you need either 
UIComponent or Sprite, as things seem to work and be simpler replacing the two 
of them with canvas
 Sid Maskit
Partner 
CraftySpace
Better Websites for a Better World
http://www.CraftySpace.com
blog: http://smaskit.blogspot.com/



----- Original Message ----
From: Sid Maskit <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, July 31, 2008 2:41:37 PM
Subject: Re: [flexcoders] Re: problem adding images to UIComponents using AS3


 I'm not going to pretend to understand this, but here's a little more 
information which may be useful.

This works:

myCanvas.addChild( myHelpImage) ; 

This doesn't work:

myHelpUIComponent. addChild( myHelpImage) ; 
myCanvas.addChild( myHelpUIComponen t); 

Which leads me to suspect that the problem is with the UIComponent rather than 
the sprite, but again I have no idea really.
 Sid Maskit
Partner 
CraftySpace
Better Websites for a Better World
http://www.CraftySp ace.com
blog: http://smaskit. blogspot. com/



----- Original Message ----
From: Jason <jason.merrill@ bankofamerica. com>
To: [EMAIL PROTECTED] ups.com
Sent: Thursday, July 31, 2008 2:18:09 PM
Subject: [flexcoders] Re: problem adding images to UIComponents using AS3


Oh, and also an article which discusses the problem adding a sprite as 
a child to a Flex container:

http://www.sebastia anholtrop. com/archives/ 3

Jason


    


      

Reply via email to