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

trace(randomInt(8));<br />

Utilisation 3 : L'exemple suivant définit une fonction intitulée ssquareRoot() qui prend un<br />

paramètre intitulé val <strong>de</strong> type Number et renvoie la racine carrée <strong>de</strong> val, également <strong>de</strong> type<br />

Number :<br />

function squareRoot(val:Number):Number {<br />

return Math.sqrt(val);<br />

}<br />

trace(squareRoot(121));<br />

Voir également<br />

Instruction var, Instruction function<br />

Opérateur typeof<br />

typeof(expression)<br />

Evalue l' expression et renvoie une chaîne spécifiant si l'expression est une valeur <strong>de</strong> type<br />

String, MovieClip, Object, Function, Number, ou Boolean.<br />

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

Opéran<strong>de</strong>s<br />

expression : Object - Chaîne, clip, bouton, objet ou fonction.<br />

Valeur renvoyée<br />

String - Représentation sous forme <strong>de</strong> String <strong>du</strong> type d'expression. Le tableau suivant<br />

affiche les résultats <strong>de</strong> l'opérateur typeof pour chaque type d'expression.<br />

Type d'expression Résultat<br />

String string<br />

Movie clip movieclip<br />

Button object<br />

Text field object<br />

Number number<br />

Boolean boolean<br />

Object object<br />

Function function<br />

196 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!