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.

La classe FileReferenceList inclut une métho<strong>de</strong> browse() et une propriété fileList pour<br />

travailler avec plusieurs fichiers.<br />

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

Exemple<br />

L'exemple suivant permet à l'utilisateur <strong>de</strong> choisir plusieurs fichiers et ensuite <strong>de</strong> charger<br />

chacun d'entre eux sur un serveur.<br />

import flash.net.FileReferenceList;<br />

import flash.net.FileReference;<br />

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

listener.onSelect = function(fileRefList:FileReferenceList) {<br />

trace("onSelect");<br />

var list:Array = fileRefList.fileList;<br />

var item:FileReference;<br />

for(var i:Number = 0; i < list.length; i++) {<br />

item = list[i];<br />

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

trace(item.addListener(this));<br />

item.upload("http://www.yourdomain.com/");<br />

}<br />

}<br />

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

trace("onCancel");<br />

}<br />

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

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

}<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.onHTTPError = function(file:FileReference, httpError:Number):Void<br />

{<br />

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

}<br />

FileReferenceList (flash.net.FileReferenceList) 607

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

Saved successfully!

Ooh no, something went wrong!