03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

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.

}<br />

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

listener.onProgress = function(file:FileReference, bytesLoa<strong>de</strong>d:Number,<br />

bytesTotal:Number):Void {<br />

trace("onProgress with bytesLoa<strong>de</strong>d: " + bytesLoa<strong>de</strong>d + " bytesTotal: " +<br />

bytesTotal);<br />

}<br />

listener.onComplete = function(file:FileReference):Void {<br />

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

}<br />

listener.onIOError = function(file:FileReference):Void {<br />

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

}<br />

var fileRef:FileReference = new FileReference();<br />

fileRef.addListener(listener);<br />

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

platform_overview.pdf";<br />

if(!fileRef.download(url, "FlashPlatform.pdf")) {<br />

trace("dialog box failed to open.");<br />

}<br />

Voir également<br />

browse (métho<strong>de</strong> FileReference.browse), browse (métho<strong>de</strong><br />

FileReferenceList.browse), upload (métho<strong>de</strong> FileReference.upload)<br />

constructeur FileReference<br />

public FileReference()<br />

Crée un nouvel objet FileReference. Quand il est complété, un objet FileReference représente<br />

un fichier sur le disque local <strong>de</strong> l'utilisateur.<br />

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

Exemple<br />

L'exemple suivant crée un nouvel objet FileReference et initie le téléchargement d'un fichier<br />

PDF.<br />

import flash.net.FileReference;<br />

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

listener.onComplete = function(file:FileReference) {<br />

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

FileReference (flash.net.FileReference) 589

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

Saved successfully!

Ooh no, something went wrong!