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.

Exemple<br />

L'exemple suivant utilise un intervalle <strong>de</strong> 10 millisecon<strong>de</strong>s afin <strong>de</strong> vérifier si le fichier <strong>de</strong><br />

langue a été chargé avec succès. Une fois le fichier XML chargé, l'occurrence <strong>de</strong> champ <strong>de</strong><br />

texte greeting_txt présente sur la scène est renseignée par la chaîne IDS_GREETING <strong>du</strong><br />

fichier <strong>de</strong> langue XML.<br />

import mx.lang.Locale;<br />

Locale.setLoadCallback(localeCallback);<br />

Locale.loadLanguageXML("en");<br />

// create interval to check if language XML file is loa<strong>de</strong>d<br />

var locale_int:Number = setInterval(checkLocaleStatus, 10);<br />

function checkLocaleStatus():Void {<br />

if (Locale.checkXMLStatus()) {<br />

clearInterval(locale_int);<br />

trace("clearing interval @ " + getTimer() + " ms");<br />

}<br />

}<br />

// callback function for Locale.setLoadCallback()<br />

function localeCallback(success:Boolean):Void {<br />

greeting_txt.text = Locale.loadString("IDS_GREETING");<br />

}<br />

Voir également<br />

loadStringEx (métho<strong>de</strong> Locale.loadStringEx)<br />

loadStringEx (métho<strong>de</strong> Locale.loadStringEx)<br />

statique publique loadStringEx(stringID:String, languageCo<strong>de</strong>:String) :<br />

String<br />

Renvoie la valeur <strong>de</strong> chaîne associée à l'ID <strong>de</strong> chaîne et au co<strong>de</strong> <strong>de</strong> langue spécifiés. Pour éviter<br />

le chargement inatten<strong>du</strong> <strong>du</strong> fichier XML, loadStringEx() ne charge pas le fichier <strong>de</strong> langue<br />

XML si le fichier XML n'est pas déjà chargé. Vous <strong>de</strong>vez déci<strong>de</strong>r d'appeler la métho<strong>de</strong><br />

loadLanguageXML() au moment opportun si vous souhaitez charger un fichier <strong>de</strong> langue<br />

XML.<br />

Disponibilité : <strong>ActionScript</strong> <strong>2.0</strong> ; Flash Player 8<br />

Paramètres<br />

stringID:String - Le numéro d'i<strong>de</strong>ntification (ID) <strong>de</strong> la chaîne à charger.<br />

languageCo<strong>de</strong>:String - Le co<strong>de</strong> <strong>de</strong> langue.<br />

Locale (mx.lang.Locale) 763

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

Saved successfully!

Ooh no, something went wrong!