addChild and Loader


i'm rather new flex, moving on world of .net. bit confused on loading external image using loader class. created following class:

public class imgview extends uicomponent
{
private const image_path:string = "{image url here}";
private var loader:loader;
private var request:urlrequest;

public function imgview()
{
loader=new loader();
request=new urlrequest(image_path);
loader.contentloaderinfo.addeventlistener(event.complete,oncomplete);
loader.load(request);

}
private function oncomplete(event:event):void
{
addchild(loader);
}
}

in oncomplete event, loader instance added imgview instance inherites uicomponent. code works , able see image. i'm guessing addchild smart enough @ data contained in loader, , determine it's image based on mime type, and/or image header. assumption correct?

also, uicomponent seems display correctly when it's control added state. otherwise see blank screen. there additional work need ui component play nicely other controls?

any insight appreciated!

--eric

first of all, why can't use mx.controls.image have taken of problems go away.

ps: addchild() doesn't know - adds child display list of component. don't have wait complete event add loader uicomponent.


More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support