Return to Snippet

Revision: 40353
at January 31, 2011 14:15 by GrfxGuru


Initial Code
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" );
}

Initial URL

                                

Initial Description

                                

Initial Title
Adobe AIR - Load local text file

Initial Tags
file, actionscript, text

Initial Language
ActionScript 3