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.

var firstChar_num:Number = my_str.charCo<strong>de</strong>At(0);<br />

trace(firstChar_num); // output: 67<br />

Voir également<br />

charAt (métho<strong>de</strong> String.charAt)<br />

concat (String.concat method)<br />

public concat(value:Object) : String<br />

Combine la valeur <strong>de</strong> l'objet String avec les paramètres et renvoie la nouvelle chaîne formée :<br />

la valeur d'origine, my_str, n'est pas modifiée.<br />

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

Paramètres<br />

value:Object - value1[,...valueN] Valeurs supérieures ou égales à zéro à concaténer.<br />

Valeur renvoyée<br />

String - Chaîne.<br />

Exemple<br />

L'exemple suivant crée <strong>de</strong>ux chaînes et les combine avec String.concat():<br />

var stringA:String = "Hello";<br />

var stringB:String = "World";<br />

var combinedAB:String = stringA.concat(" ", stringB);<br />

trace(combinedAB); // output: Hello World<br />

fromCharCo<strong>de</strong> (métho<strong>de</strong> String.fromCharCo<strong>de</strong>)<br />

public static fromCharCo<strong>de</strong>() : String<br />

Renvoie une chaîne comprenant les caractères représentés par les valeurs Unico<strong>de</strong> dans les<br />

paramètres.<br />

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

Valeur renvoyée<br />

String - Chaîne correspondant à la valeur <strong>de</strong>s co<strong>de</strong>s <strong>de</strong> caractère Unico<strong>de</strong> spécifiés.<br />

Exemple<br />

L'exemple suivant utilise fromCharCo<strong>de</strong>() pour insérer un @ dans l'adresse électronique :<br />

var address_str:String = "dog"+String.fromCharCo<strong>de</strong>(64)+"house.net";<br />

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

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

Saved successfully!

Ooh no, something went wrong!