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.

Exemple<br />

L'exemple suivant définit la propriété _visible pour <strong>de</strong>ux clips appelés myMC1_mc et<br />

myMC2_mc. Cette propriété doit être définie sur true pour l'une <strong>de</strong>s occurrences et sur false<br />

pour l'autre. Vous pouvez alors constater qu'il est impossible <strong>de</strong> cliquer sur l'occurrence<br />

myMC1_mc lorsque la propriété _visible est définie sur false.<br />

myMC1_mc.onRelease = function() {<br />

trace(this._name+"._visible = false");<br />

this._visible = false;<br />

};<br />

myMC2_mc.onRelease = function() {<br />

trace(this._name+"._alpha = 0");<br />

this._alpha = 0;<br />

};<br />

Voir également<br />

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

TextField._visible)<br />

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

public _width : Number<br />

Largeur <strong>du</strong> clip, en pixels.<br />

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

Exemple<br />

L'exemple <strong>de</strong> co<strong>de</strong> suivant affiche la hauteur et la largeur d'un clip dans le panneau <strong>de</strong> sortie :<br />

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

triangle.beginFill(0x0000FF, 100);<br />

triangle.moveTo(100, 100);<br />

triangle.lineTo(100, 150);<br />

triangle.lineTo(150, 100);<br />

triangle.lineTo(100, 100);<br />

trace(triangle._name + " = " + triangle._width + " X " + triangle._height +<br />

" pixels");<br />

La métho<strong>de</strong> MovieClip.getNextHighestDepth() utilisée dans cet exemple nécessite Flash<br />

Player 7 ou une version ultérieure. Si votre fichier SWF comprend un composant <strong>de</strong> la version<br />

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

MovieClip.getNextHighestDepth().<br />

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

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

Saved successfully!

Ooh no, something went wrong!