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.

menu_cm.customItems.push(new ContextMenuItem("Info...", getMCInfo));<br />

function getMCInfo(target_mc:MovieClip, obj:Object) {<br />

trace("You clicked on the movie clip '"+target_mc._name+"'.");<br />

trace("\t width:"+target_mc._width+", height:"+target_mc._height);<br />

trace("");<br />

}<br />

for (var i in this) {<br />

if (typeof (this[i]) == 'movieclip') {<br />

this[i].menu = menu_cm;<br />

}<br />

}<br />

Voir également<br />

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

nextFrame (métho<strong>de</strong> MovieClip.nextFrame)<br />

public nextFrame() : Void<br />

Place la tête <strong>de</strong> lecture sur l'image suivante et l'arrête.<br />

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

Exemple<br />

L'exemple suivant utilise _framesloa<strong>de</strong>d et nextFrame() pour charger le contenu dans un<br />

fichier SWF. N'ajoutez pas <strong>de</strong> co<strong>de</strong> sur l'image 1. Par contre, ajoutez le co<strong>de</strong> <strong>ActionScript</strong><br />

suivant sur l'image 2 <strong>du</strong> scénario :<br />

if (this._framesloa<strong>de</strong>d >= 3) {<br />

this.nextFrame();<br />

} else {<br />

this.gotoAndPlay(1);<br />

}<br />

Ensuite, ajoutez le co<strong>de</strong> suivant (et le contenu à charger) dans l'image 3 :<br />

stop();<br />

Voir également<br />

Fonction nextFrame, Fonction prevFrame, prevFrame (métho<strong>de</strong> MovieClip.prevFrame)<br />

onData (gestionnaire MovieClip.onData)<br />

onData = function() {}<br />

MovieClip 935

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

Saved successfully!

Ooh no, something went wrong!