Share Posted May 5, 2014 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. HenrikQuick 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 storagePlease 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(); } Link to comment Share on other sites More sharing options...
Share Posted May 5, 2014 I believe you need to use .url instead of .nativePath And remember on IOS youre not using AIR Runtime, your flash code will be converted, why you will also not be able to load SWF's into your application at runtime (i was baffled by this, and it was something that took my stubborn head, days to realize) 2 Link to comment Share on other sites More sharing options...
Author Share Posted May 6, 2014 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now