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 />

public function executeCallback():Void {<br />

trace("executeCallback intervalId: " + intervalId + " count: " + count);<br />

if(count >= maxCount) {<br />

clearInterval(intervalId);<br />

}<br />

count++;<br />

}<br />

}<br />

Dans un nouveau document, instanciez une nouvelle occurrence <strong>de</strong> la nouvelle classe :<br />

var custom:CustomClass = new CustomClass();<br />

Voir également<br />

Fonction clearInterval, Fonction updateAfterEvent, Instruction class<br />

Fonction setProperty<br />

setProperty(target:Object, property:Object, expression:Object) : Void<br />

Modifie la valeur <strong>de</strong>s propriétés d'un clip pendant la lecture <strong>de</strong> ce <strong>de</strong>rnier.<br />

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

Paramètres<br />

target:Object - Le chemin <strong>du</strong> nom d'occurrence <strong>du</strong> clip dont la propriété doit être définie.<br />

property:Object - La propriété à définir.<br />

expression:Object - Soit la nouvelle valeur littérale <strong>de</strong> la propriété, soit une équation qui<br />

reprend la nouvelle valeur <strong>de</strong> la propriété.<br />

Exemple<br />

Le co<strong>de</strong> <strong>ActionScript</strong> suivant crée un nouveau clip et charge une image dans celui-ci. Les<br />

coordonnées _xet _y sont définies pour le clip à l'ai<strong>de</strong> <strong>de</strong> setProperty(). Lorsque vous<br />

cliquez sur le bouton intitulé right_btn, la coordonnée _x d'un clip nommé params_mc est<br />

incrémentée <strong>de</strong> 20 pixels.<br />

this.createEmptyMovieClip("params_mc", 999);<br />

params_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");<br />

setProperty(this.params_mc, _y, 20);<br />

setProperty(this.params_mc, _x, 20);<br />

this.right_btn.onRelease = function() {<br />

104 Chapitre 1: Eléments <strong>du</strong> <strong>langage</strong> <strong>ActionScript</strong>

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

Saved successfully!

Ooh no, something went wrong!