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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Voir également<br />

tabEnabled (propriété Button.tabEnabled), tabChildren (propriété<br />

MovieClip.tabChildren), tabEnabled (propriété MovieClip.tabEnabled), tabIn<strong>de</strong>x<br />

(propriété MovieClip.tabIn<strong>de</strong>x), tabIn<strong>de</strong>x (propriété TextField.tabIn<strong>de</strong>x)<br />

_target (propriété Button._target)<br />

public _target : String [lecture seule]<br />

Renvoie le chemin cible <strong>de</strong> l'occurrence <strong>de</strong> bouton spécifiée par my_btn.<br />

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

Exemple<br />

Ajoutez une occurrence <strong>de</strong> bouton intitulée my_btn sur la scène, puis ajoutez le co<strong>de</strong> suivant<br />

à l'image 1 <strong>du</strong> scénario :<br />

trace(my_btn._target); //displays /my_btn<br />

Sélectionnez my_btn et convertissez-le en clip. Attribuez au nouveau clip un nom<br />

d'occurrence my_mc. Supprimez le co<strong>de</strong> <strong>ActionScript</strong> existant dans l'image 1 <strong>du</strong> scénario et<br />

remplacez-le par le co<strong>de</strong> suivant :<br />

my_mc.my_btn.onRelease = function(){<br />

trace(this._target); //displays /my_mc/my_btn<br />

};<br />

Pour convertir la notation avec barre oblique en notation avec point, modifiez l'exemple <strong>de</strong><br />

co<strong>de</strong> précé<strong>de</strong>nt comme suit :<br />

my_mc.my_btn.onRelease = function(){<br />

trace(eval(this._target)); //displays _level0.my_mc.my_btn<br />

};<br />

Ceci vous permet d'accé<strong>de</strong>r aux métho<strong>de</strong>s et paramètres <strong>de</strong> l'objet cible, tels que :<br />

my_mc.my_btn.onRelease = function(){<br />

var target_btn:Button = eval(this._target);<br />

trace(target_btn._name); //displays my_btn<br />

};<br />

Voir également<br />

_target (propriété MovieClip._target)<br />

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

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

Saved successfully!

Ooh no, something went wrong!