Last active
July 31, 2016 02:29
-
-
Save marchbold/05bc6d2b729368caf3ba53f9429e7889 to your computer and use it in GitHub Desktop.
Read files from a mounted OBB file using the ExpansionFiles ANE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var obbFile:ExpansionFile = new ExpansionFile( ExpansionFile.MAIN, 1001003, 93147195 ); | |
| if (ExpansionFiles.service.obbUtils.isMounted( obbFile )) | |
| { | |
| var path:String = ExpansionFiles.service.obbUtils.getMountedPath( obbFile ); | |
| var file:File = new File( path + "/images/image.jpg" ); | |
| // You can use normal file operations | |
| trace( file.url ); | |
| trace( "exists="+file.exists ); | |
| trace( "size="+file.size ); | |
| var loader:Loader = new Loader(); | |
| loader.load( new URLRequest( file.url ) ); | |
| loader.contentLoaderInfo.addEventListener( Event.COMPLETE, loader_completeHandler ); | |
| } | |
| ... | |
| private function loader_completeHandler(event:flash.events.Event):void | |
| { | |
| var bitmap:Bitmap = event.currentTarget.loader.content as Bitmap; | |
| // Use your bitmap as required | |
| } | |
| // com.distriqt.ExpansionFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment