6 Replies Latest reply on Dec 5, 2008 2:56 AM by groveman

    AS 2 help please

      Hi all, I need a script to check platform user language and then load external XML files with corresponding en, fr, and de identifiers. I have the script below, but need to adapt it to load English, French or German XML depending on user language


      function initMainMenu() {



      Many thanks in advance
        • 1. Re: AS 2 help please
          Rothrock Level 5
          System.capabilities.language is I think what you need.

          Remember that there are people who use computers that aren't their first or preferred language. So it is always a good idea to give the user a choice.
          • 2. Re: AS 2 help please
            groveman Level 1
            Thanks for the info, but could you provide an example of what the script should be to achieve this!

            Many thanks
            • 3. Re: AS 2 help please
              Rothrock Level 5
              Have you tried using System.capabilities.language? Looked it up in the help files?

              It returns a string that reports on the user's language. Mine returns "en" so you could use an if or switch statement to decide which xml file to load. Or you could name your files with the abbreviation in them and then just do that.

              What part are you having trouble with?
              • 4. Re: AS 2 help please
                groveman Level 1
                Thanks, yes I looked it up and added this script with named external xml files, but it still does not work. I need it in AS2 syntax, Any script corrections appreciated.


                switch (lang) {
                case "en":
                case "de":
                case "fr":

                • 5. Re: AS 2 help please
                  Rothrock Level 5
                  Trace will only show YOU the value. To make your code work you need to assign the results of System.capabilities.language to a variable. And in your case you already have "lang" in the switch statement. So this line should be before the switch:

                  var lang:String=System.capabilities.language

                  Once you have that you could replace the switch with:


                  But what if somebody with an italian system or a japanese system logs on?

                  You might want to go back to the switch statement and put one at the end:


                  • 6. Re: AS 2 help please
                    groveman Level 1
                    Hi Rothrock,

                    Many thanks you were a great help, now it all works