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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Renvoie<br />

Boolean - Renvoie true si le fichier XML est chargé ; false sinon.<br />

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

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

statique publique getDefaultLang() : String<br />

Le co<strong>de</strong> <strong>de</strong> langue par défaut tel que défini dans la boîte <strong>de</strong> dialogue Paramètres <strong>du</strong> panneau<br />

Chaînes ou en appelant la métho<strong>de</strong> setDefaultLang().<br />

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

Renvoie<br />

String - Renvoie le co<strong>de</strong> <strong>de</strong> langue par défaut.<br />

Exemple<br />

L'exemple suivant crée une variable intitulée <strong>de</strong>fLang, utilisée pour conserver la langue par<br />

défaut initiale <strong>du</strong> document Flash. Dans le panneau Chaînes, cliquez sur le bouton Paramètres<br />

pour ouvrir la boîte <strong>de</strong> dialogue Paramètres. Ensuite, ajoutez <strong>de</strong>ux langues actives : Anglais<br />

(en) et Français (fr), définissez le bouton radio <strong>de</strong> remplacement <strong>de</strong>s chaînes sur "via<br />

<strong>ActionScript</strong> at runtime", puis cliquez sur OK. Dans le panneau Chaînes, ajoutez l'ID <strong>de</strong><br />

chaîne <strong>de</strong> IDS_GREETING, puis ajoutez <strong>du</strong> texte pour chaque langue active.<br />

Locale (mx.lang.Locale) 759

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

Saved successfully!

Ooh no, something went wrong!