/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public var file:FileReference = new FileReference(); public function doLoad( event:Event ):void { file.addEventListener( Event.SELECT, doFileSelect ); file.addEventListener( Event.COMPLETE, doFileComplete ); file.browse( [new FileFilter( "Text File", "*.txt" )] ); } public function doFileSelect( event:Event ):void { file.load(); } public function doFileComplete( event:Event ):void { // txtField is the instance name of a text field used to display loaded content. txtField.text = file.data.readMultiByte( file.data.bytesAvailable, "utf-8" ); }
Comments
