Mac OS X:
Macintosh HD/Users/[ユーザー]/Library/Preferences/[AIRアプリID]/Local Store/
Windows XP:
C:¥Documents and Settings¥[ユーザー]¥Application Data¥[AIRアプリID]¥Local Store¥
アンインストールでは、削除はされない。
ここにモジュールをダウンロードさせて、それを実行しようとするとサンドバッグのせいか、実行できない。
http://blog.esofthead.com/?p=117
にあるように、おまじないをしないといけない。
以下引用
1.Download the remote module and store them in AIR application storage:
//Load the remote module base on moduleUri -
//for example: http://www.esofthead.com/engroup/HrEmployeeModule.swf
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, moduleLoadedCompleteHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, moduleLoaderErrorHandler);
loader.load(new URLRequest(moduleUri))
Save module into application storage when the module is completely downloaded
private function moduleLoadedCompleteHandler(e:Event): void {
var loader:URLLoader = URLLoader(e.target);
var data:ByteArray = ByteArray(loader.data);
var moduleFile:File = File.applicationStorageDirectory.resolvePath("HrEmployeeModule.swf");
var fileStream:FileStream = new FileStream();
fileStream.open(moduleFile, FileMode.WRITE);
fileStream.writeBytes(data);
fileStream.close();
}
2.Load the module (in application storage)
var moduleLoader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.allowLoadBytesCodeExecution = true;
context.applicationDomain = ApplicationDomain.currentDomain;
//data is byte array of module, it could be filled by loading
//bytes from local file (module file is stored in app storage)
moduleLoader.loadBytes(data, context);
moduleLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeLoader);
We process module when it is already loaded
private function completeLoader(e:Event): void {
var moduleLoader:LoaderInfo = LoaderInfo(e.target);
moduleLoader.content.addEventListener("ready", readyHandler);
}
Use module when the module is already loaded
private function readyHandler(e:Event): void {
var factory:IFlexModuleFactory = IFlexModuleFactory(e.target);
var module:Module = factory.create() as Module;
// Do as flex module as usual
...
}
0 件のコメント:
コメントを投稿