There is a way to do this and I've seen write ups on it. Search around and you'll find it. It would be nice if AIR supported this out of the box but there are security concerns when apps are being updated without involving someone who has admin rights to the machine.
Jeff ________________________________ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Alex Harui Sent: Friday, October 09, 2009 1:13 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] ADOBE AIR Qs: How do you load modules from "app-storage" domain? I'm not sure what moduleLoader is. You should be using IModuleInfo.load(). Then, a UIComponent makes a poor container. It doesn't know how to measure or layout the child so the child might have 0 size. Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of handitan Sent: Thursday, October 08, 2009 8:03 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] ADOBE AIR Qs: How do you load modules from "app-storage" domain? Hi all, I am using AIR 1.5 SDK. I am trying to find a way to build patching mechanism for my AIR app, which consists modules, sqlite DBs, and other files, by updating ONLY files that need to be updated. I know that this is not possible using AIR Update Framework because the way I understand it works is that any update that you have both minor and major, you will have to reinstall everything. This is a pain if you have a huge size AIR app. I have sort of an idea to build my own update mechanism but in order for this to work, I will need to be able to do update operation on my AIR app files. Since "app" domain doesn't allow us to do that, I have to find a place where updates can take place and my app could still work. I read that "app-storage" allows you to do all of that. Okay... so I build a really simple AIR app that the sole purpose is to load swf module from "app-storage" to prove my theory. So here's my AIR app code the short version: <mx:WindowedApplication> <mx:Script> private function loadSwf():void { var dir:File = File.applicationStorageDirectory dir = dir.resolvePath("SimpleSwf.swf");//SimpleSwf is the module var myURLRequest:URLRequest = new URLRequest(dir.url); var myURLLoader:URLLoader = new URLLoader(); myURLLoader.dataFormat = URLLoaderDataFormat.BINARY; myURLLoader.load(myURLRequest); myURLLoader.addEventListener(Event.COMPLETE,loadModuleCompleteHandler); } private function loadModuleCompleteHandler(pEvent:Event):void { var context:LoaderContext = new LoaderContext(); context.allowLoadBytesCodeExecution = true; context.applicationDomain = ApplicationDomain.currentDomain; var moduleLoader:Loader = new Loader(); var loader:URLLoader = URLLoader(pEvent.target); moduleLoader.loadBytes(loader.data,context); container.addChild(moduleLoader); } </mx:Script> <mx:VBox width="100%" height="100%"> <mx:Button label="Load SWF" click="loadSwf()"/> <mx:UIComponent id="container"/> </mx:VBox> </mx:WindowedApplication> The result is: When I click the button "Load SWF", I could see that the loader loads the SWF correctly (it got the right size, etc) but I didn't see the module shows up on the screen at all. I didn't know what I do wrong. Please enlighten me.