Re: [flexcoders] loading image with AS and Loader

2007-04-10 Thread Daniel Freiman

Only UIComponents (or IUIComponents) can be added as a child to Containers.
Loader is not a UIComponent and I assume this is the Application and thus
a Container.  You're either going to need to add the Loader to a UIComponent
and add that component to the application, or you can use
mx.controls.SWFLoader, which is similar to the Loader but a UIComponent.

- Daniel Freiman
nondocs? http://nodocs.blogspot.com

On 10 Apr 2007 00:25:43 -0700, ronnlixx [EMAIL PROTECTED] wrote:


  I'm trying this example from the documentation:

var pictLdr:Loader = new Loader();
var pictURL:String = banana.jpg
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr.load(pictURLReq);
this.addChild(pictLdr);

I'm trying it in my creationComplete callback and get this error:

cannot coerce the Loader into an IUIComponent.

What am I doing wrong here?

 



RE: [flexcoders] loading image with AS and Loader

2007-04-10 Thread Gordon Smith
What doc was this in? It won't work if 'this' is a Flex Container,
because a Container expects that its children are IUIComponents.
 
If you're putting an image into a Flex Container, you should be using a
Flex Image control, not a low-level Flash Loader.
 
- Gordon



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ronnlixx
Sent: Monday, April 09, 2007 3:11 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] loading image with AS and Loader



I'm trying this example from the documentation:

var pictLdr:Loader = new Loader();
var pictURL:String = banana.jpg
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr.load(pictURLReq);
this.addChild(pictLdr);

I'm trying it in my creationComplete callback and get this error:

cannot coerce the Loader into an IUIComponent.

What am I doing wrong here?