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.

Paramètres<br />

expression:Object - Une valeur booléenne, une variable ou toute autre expression à évaluer.<br />

Renvoie<br />

Boolean - Une valeur booléenne.<br />

Exemple<br />

Le co<strong>de</strong> suivant illustre les valeurs renvoyées pour la fonction isNaN() :<br />

trace( isNaN("Tree") );<br />

// returns true<br />

trace( isNaN(56) );<br />

// returns false<br />

trace( isNaN(Number.POSITIVE_INFINITY) )<br />

// returns false<br />

L'exemple suivant indique comment utiliser la fonction isNAN() afin <strong>de</strong> vérifier si une<br />

expression mathématique contient une erreur :<br />

var divi<strong>de</strong>nd:Number;<br />

var divisor:Number;<br />

divisor = 1;<br />

trace( isNaN(divi<strong>de</strong>nd/divisor) );<br />

// output: true<br />

// The output is true because the variable divi<strong>de</strong>nd is un<strong>de</strong>fined.<br />

// Do not use isNAN() to check for division by 0 because it will return<br />

false.<br />

// A positive number divi<strong>de</strong>d by 0 equals Infinity<br />

(Number.POSITIVE_INFINITY).<br />

// A negative number divi<strong>de</strong>d by 0 equals -Infinity<br />

(Number.NEGATIVE_INFINITY).<br />

Voir également<br />

Constante NaN, NaN (propriété Number.NaN)<br />

Fonction length<br />

length(expression:String)length(variable)<br />

Déconseillée à partir <strong>de</strong> Flash Player 5. Cette fonction, à l'instar <strong>de</strong> toutes les fonctions <strong>de</strong><br />

chaîne, est déconseillée. Macromedia vous recomman<strong>de</strong> d'utiliser les métho<strong>de</strong>s <strong>de</strong> la classe<br />

String et la propriété String.length pour effectuer les mêmes opérations.<br />

Renvoie la longueur <strong>de</strong> la chaîne ou variable spécifiée.<br />

Fonctions globales 69

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

Saved successfully!

Ooh no, something went wrong!