03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example<br />

The following example adds a listener to an instance of File<strong>Reference</strong>.<br />

import flash.net.File<strong>Reference</strong>;<br />

var listener:Object = new Object();<br />

listener.onProgress = function(file:File<strong>Reference</strong>, bytesLoaded:Number,<br />

bytesTotal:Number):Void {<br />

trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " +<br />

bytesTotal);<br />

}<br />

listener.onComplete = function(file:File<strong>Reference</strong>):Void {<br />

trace("onComplete: " + file.name);<br />

}<br />

var fileRef:File<strong>Reference</strong> = new File<strong>Reference</strong>();<br />

fileRef.addListener(listener);<br />

var url:String = "http://www.adobe.com/platform/whitepapers/<br />

platform_overview.pdf";<br />

fileRef.download(url, "FlashPlatform.pdf");<br />

browse (File<strong>Reference</strong>.browse method)<br />

public browse([typelist:Array]) : Boolean<br />

Displays a file-browsing dialog box in which the user can select a local file to upload. The<br />

dialog box is native to the user's operating system. When you call this method <strong>and</strong> the user<br />

successfully selects a file, the properties of this File<strong>Reference</strong> object are populated with the<br />

properties of that file. Each subsequent time that File<strong>Reference</strong>.browse() is called, the<br />

File<strong>Reference</strong> object's properties are reset to the file selected by the user in the dialog box.<br />

Only one browse() or download() session can be performed at a time (because only one<br />

dialog box can be displayed at a time).<br />

You can pass an array of file types to determine which files the dialog box displays.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

File<strong>Reference</strong> (flash.net.File<strong>Reference</strong>) 569

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!