Last active
December 21, 2015 20:49
-
-
Save caubry/6364388 to your computer and use it in GitHub Desktop.
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
| protected var fileStream:FileStream; | |
| protected static const LOCATION_XML:String = "/d/.../myXML.xml"; // Location of your XML | |
| public function loadXML():void | |
| { | |
| var fileSettings:File = File.applicationStorageDirectory.resolvePath(LOCATION_XML); | |
| if (fileSettings.exists) | |
| { | |
| fileStream = new FileStream(); | |
| fileStream.addEventListener(Event.COMPLETE, onXMLContentLoaded); | |
| fileStream.openAsync(fileSettings, FileMode.READ); | |
| } | |
| } | |
| public function onXMLContentLoaded(event:Event):void | |
| { | |
| var myXML:XML = new XML(fileStream.readUTFBytes(fileStream.bytesAvailable)); | |
| dispatch(new GeneralInformationEvent(GeneralInformationEvent.XML_CONTENT_LOADED, myXML)); | |
| fileStream.removeEventListener(Event.COMPLETE, onXMLContentLoaded); | |
| fileStream.close(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment