Henrik
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by Henrik
-
-
Hi Guys,
I have been strugling with getting Maxloader to load a png fil stored in my Ipads applicationStorageDirectory. I hope someone would be so kind and give som advice.
Im working with Adobe Air 13.0, iOS 7.
Thanx.Henrik
Quick Code walk though:
Loading the file://LOADING THE FILE FROM WEBSERVER var loader:BinaryDataLoader = new BinaryDataLoader(filePathServer, {name:"downloadedfile.png", requireWithRoot:this.root, estimatedBytes:6800, onProgress:progressHandler, onComplete:completeHandler}); loader.load();
Saving the file:
//SAVING THE FILE TO APPLICATION STORAGE DIRECTORY function completeHandler(event:LoaderEvent):void { var fileStream:FileStream = new FileStream(); var _dataD = LoaderMax.getContent(event.target.name); var _dFile = File.applicationStorageDirectory.resolvePath("includes/"+event.target.name); fileStream.open(_dFile, FileMode.WRITE); fileStream.writeBytes(_dataD, 0, _dataD.length); setTimeout(loadFileFromLocal, 2000); }
// Re-Loading the file from Local storage
Please note that when loading the file into a stageWebView it works fine!//RE LOADING THE FILE FROM LOCAL STORAGE function loadFileFromLocal():void { var file:String = "downloadedfile.png"; var pdf:File = File.applicationStorageDirectory.resolvePath("includes/"+file); //PHONE //LOADING IT INTO STAGEWEBVIEW WORKS !! var yOffset:Number = 40; var stageWebView:StageWebView = new StageWebView(); stageWebView.stage = stage; stageWebView.viewPort = new Rectangle(0, yOffset, 500, 500 - yOffset); stageWebView.loadURL(pdf.nativePath); //TRY TO LOAD VIA LOADERMAX - DOES NOT WORK ON IOS DEVICE, DOES WORK ON PC var myImage:ImageLoader = new ImageLoader(pdf.nativePath, {container:imgContainer, alpha:1,onProgress:progressHandlerRELOAD,onComplete:completeHandlerRELOAD}); myImage.load(); }
Loading image from iOS applicationStorageDirectory
in Loading (Flash)
Posted
Hi Squadjot,
Thank you very much. That did the trick. Great tip and thanks again.
And thanks for the heads up on swf loading. Good to know as this ofcouse has been a standard aproach doing flash for web.
Best
Henrik