Thanks Doug! When I do that I'm getting the error: Error: Error #2099: The loading object is not sufficiently loaded to provide this information. at flash.display::LoaderInfo/get width() at mx.controls::SWFLoader/get ::contentHolderWidth() at mx.controls::SWFLoader/::doScaleContent() at mx.controls::SWFLoader/mx.controls:SWFLoader::updateDisplayList() at mx.controls::Image/mx.controls:Image::updateDisplayList() at mx.core::UIComponent/validateDisplayList() at mx.managers::LayoutManager/::validateDisplayList() at mx.managers::LayoutManager/::doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/::callLaterDispatcher2()
Does anyone know what event is fired when the load is complete? I can't find any docs on FlexLoader and Event.COMPLETE doesn't seem to ever fire... -Andy On 2/2/07, Doug McCune <[EMAIL PROTECTED]> wrote:
Your problem is that you're calling addChild on the Image component. This won't work with how the ImageComponent works (or rather SWFLoader, which is the base class). But the SWFLoader should be able to load a DisplayObject, if you set that as the source. Also, BTW, you don't need the URLLoader in your code So try doing this: private var loader:FlexLoader = new FlexLoader(); loader.loadBytes (imageByteArray); previewImage.source = loader; <mx:Image scaleContent="true" height="260" width="215" id="previewImage"/> -Doug Andrew D. Goodfellow wrote: (I have searched for this answer on the list and in the docs and can't find anything so I'm gonna go ahead and post. If I missed a previous post, I apologize, please point me towards it.) I have an image in a ByteArray and I want to display it within a specific width and height inside an Image object. Here is my logic: private var urlloader:URLLoader = new URLLoader(); private var loader:Loader = new Loader(); urlloader.dataFormat = URLLoaderDataFormat.BINARY; urlloader.data = ByteArray(imageByteArray); loader.loadBytes (ByteArray(urlloader.data)); var child:DisplayObject = previewImage.addChild(genericLoader); <mx:Image scaleContent="true" height="260" width="215" id="previewImage"/> When it displays it does not scale automatically, it simply displays at 1:1 of the original ByteArray image. If I set child.width and child.heightto specific values ( i.e. 215x260) the Image (or child) just doesn't display. I CAN change scale directly or use a Matrix to scale it, but the problem there is that the child.width and .height are returning 0 so I can't calculate the correct scale. Any ideas??? -Andy

