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.

Vous pouvez étendre les métho<strong>de</strong>s et les gestionnaires d'événements <strong>de</strong> la classe MovieClip en<br />

créant une sous-classe.<br />

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

Paramètres<br />

x:Number - Entier indiquant la position horizontale par rapport au point d'alignement <strong>du</strong> clip<br />

parent.<br />

y:Number - Entier indiquant la position verticale par rapport au point d'alignement <strong>du</strong> clip<br />

parent.<br />

Exemple<br />

L'exemple suivant <strong>de</strong>ssine un triangle avec une ligne en magenta <strong>de</strong> 5 pixels et un remplissage<br />

bleu partiellement transparent.<br />

this.createEmptyMovieClip("triangle_mc", 1);<br />

triangle_mc.beginFill(0x0000FF, 30);<br />

triangle_mc.lineStyle(5, 0xFF00FF, 100);<br />

triangle_mc.moveTo(200, 200);<br />

triangle_mc.lineTo(300, 300);<br />

triangle_mc.lineTo(100, 300);<br />

triangle_mc.lineTo(200, 200);<br />

triangle_mc.endFill();<br />

Voir également<br />

createEmptyMovieClip (métho<strong>de</strong> MovieClip.createEmptyMovieClip), lineStyle<br />

(métho<strong>de</strong> MovieClip.lineStyle), lineTo (métho<strong>de</strong> MovieClip.lineTo)<br />

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

public _name : String<br />

Le nom d'occurrence <strong>du</strong> clip.<br />

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

Exemple<br />

L'exemple suivant permet <strong>de</strong> cliquer avec le bouton droit <strong>de</strong> la souris (Windows) ou en<br />

appuyant sur la touche contrôle (Macintosh) sur un clip figurant dans la scène et <strong>de</strong><br />

sélectionner Info dans le menu contextuel pour afficher <strong>de</strong>s informations sur cette<br />

occurrence. Ajoutez plusieurs clips avec <strong>de</strong>s noms d'occurrence, puis ajoutez le co<strong>de</strong><br />

<strong>ActionScript</strong> suivant au fichier AS ou FLA :<br />

var menu_cm:ContextMenu = new ContextMenu();<br />

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

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

Saved successfully!

Ooh no, something went wrong!