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.

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

MovieClipLoa<strong>de</strong>r.onLoadStart)<br />

onLoadStart = function([target_mc:MovieClip]) {}<br />

Appelé lorsqu'un appel à MovieClipLoa<strong>de</strong>r.loadClip() a commencé à charger un fichier.<br />

Appelle cet écouteur sur un objet d'écoute que vous ajoutez à l'ai<strong>de</strong> <strong>de</strong><br />

MovieClipLoa<strong>de</strong>r.addListener().<br />

La valeur target_mc i<strong>de</strong>ntifie le clip pour lequel cet appel est effectué. Ce paramètre est<br />

particulièrement utile si vous chargez plusieurs fichiers avec le même jeu d'écouteurs.<br />

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

Paramètres<br />

target_mc:MovieClip [facultatif] - Clip chargé par la métho<strong>de</strong><br />

MovieClipLoa<strong>de</strong>r.loadClip().<br />

Exemple<br />

L'exemple suivant charge une image dans une occurrence <strong>de</strong> clip appelée image_mc. Les<br />

événements onLoadInit et onLoadComplete permettent <strong>de</strong> déterminer le temps <strong>de</strong><br />

chargement <strong>de</strong> l'image. Les informations s'affichent dans le champ texte appelé timer_txt.<br />

this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());<br />

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

mclListener.onLoadStart = function(target_mc:MovieClip) {<br />

target_mc.startTimer = getTimer();<br />

};<br />

mclListener.onLoadComplete = function(target_mc:MovieClip) {<br />

target_mc.completeTimer = getTimer();<br />

};<br />

mclListener.onLoadInit = function(target_mc:MovieClip) {<br />

var timerMS:Number = target_mc.completeTimer-target_mc.startTimer;<br />

target_mc.createTextField("timer_txt", target_mc.getNextHighestDepth(),<br />

0, target_mc._height,<br />

target_mc._width, 22);<br />

target_mc.timer_txt.text = "loa<strong>de</strong>d in "+timerMS+" ms.";<br />

};<br />

var image_mcl:MovieClipLoa<strong>de</strong>r = new MovieClipLoa<strong>de</strong>r();<br />

image_mcl.addListener(mclListener);<br />

image_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",<br />

image_mc);<br />

Si votre fichier SWF comprend un composant <strong>de</strong> la version 2, utilisez les composants <strong>de</strong> la<br />

version 2 <strong>de</strong> la classe DepthManager au lieu <strong>de</strong> la métho<strong>de</strong><br />

MovieClip.getNextHighestDepth(), utilisée dans cet exemple.<br />

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

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

Saved successfully!

Ooh no, something went wrong!