/ Published in: ActionScript 3
URL: http://www.destroyyourcomputer.com
Expand |
Embed | Plain Text
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();"> <mx:Script> <![CDATA[ private var file : File; private var fileStream : FileStream; private var fileContents : String; private const ISO_CS : String = "iso-8859-1"; private function init() : void { file = new File(); file = File.applicationDirectory.resolvePath("file.txt"); fileStream = new FileStream(); fileStream.addEventListener( Event.COMPLETE, fileComplete ); fileStream.openAsync( file, FileMode.READ ); } private function fileComplete( event : Event ):void { fileContents = fileStream.readMultiByte( fileStream.bytesAvailable, ISO_CS ); trace( "fileContents="+fileContents ); } ]]> </mx:Script> </mx:WindowedApplication>
You need to login to post a comment.
