load is asyncrhonous. Loader.content won't be available until after the "complete" event.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of srikanth_reddy_007 Sent: Wednesday, December 26, 2007 9:30 AM To: [email protected] Subject: [flexcoders] Converting the Loader info to Class I have a Dictionary of Image objects which is implemented as below public class IconMap { [Bindable] public var images:Dictionary = new Dictionary (); [Embed(source="/resources/app_extx_32.svg")] public static var SOFTWARE:Class; [Embed(source="/resources/computer.svg")] public static var COMPUTER:Class; [Embed(source="resources/docx_32.svg")] public static var DOCUMENT:Class; public function IconMap() { images["600"] = COMPUTER; images["601"] = SOFTWARE; images["602"] = DOCUMENT; } } which are binded to an item renderer inside a list as <mx:Image x="2" y="7" source="{ModelLocator.getInstance ().iconMap.images[data.id]}". but at run time if the client uploads some more images for the other signatures like 603,604,605 I get the signatures and the location at the server and to the client i get the location of the images and for each item i send a server request to load the image. below is the xml i get in the first request and the code to load the images in the subsequent requests. but it is not working as i can't convert loader.content which is an UI object to a class object to bind it to image. can any body please suggest a way or an alternative approach to make it work. I can't keep all the images at server because thay are svg images and can't be loaded at run time. <Body> <ICON_MAP> <FAMILY_ID id="605">projx_32.jpg</FAMILY_ID> <FAMILY_ID id="400039">conx_32.jpg</FAMILY_ID> <FAMILY_ID id="600">har_othx_32.jpg</FAMILY_ID> </ICON_MAP> </Body> for(var index:int = 0; index < iconXMLList.length(); index ++) { var context:LoaderContext = new LoaderContext(); context.checkPolicyFile = true; var url:String = "resource/" + iconXMLList[index].text(); var urlReq:URLRequest = new URLRequest(url); var loader:Loader = new Loader(); loader.load(urlReq, context); Alert.show("Key: " + key + " Value: " + url); var key:String = XML(iconXMLList[index])[EMAIL PROTECTED]; iconMap.images[key] = loader.content as Class; }

