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.

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

trace("onCancel");<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 />

onCancel (écouteur d'événement<br />

FileReference.onComplete)<br />

onCancel = function(fileRef:FileReference) {}<br />

Appelé en cas <strong>de</strong> réussite <strong>de</strong> l'opération d'envoi ou <strong>de</strong> téléchargement. L'exécution réussie<br />

signifie que la totalité <strong>du</strong> fichier a été téléchargée (reçue ou envoyée).<br />

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

Paramètres<br />

fileRef:flash.net.FileReference - Objet FileReference qui a initié l'opération.<br />

Exemple<br />

L'exemple suivant trace un message quand l'événement onComplete est déclenché.<br />

import flash.net.FileReference;<br />

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

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

trace("onComplete: " + 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 />

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

592 Chapitre 2: Classes <strong>ActionScript</strong>

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

Saved successfully!

Ooh no, something went wrong!