5 Replies Latest reply on Feb 23, 2012 10:14 AM by ErikaDparit

    How to switch between languages

    ErikaDparit Level 1


      Im working on a Flash Catalyst application where I need to use 3 different languages as the language of the application (english-russian-italian).

      What do I have to do in order for the language to change when any of these 3 buttons indicating the different language  is pressed by the user??

      In other words, how can I change the language of the application from italian to english? (the change would have to be in the buttons and the texts showing in each state of the application).

      Do I have to make 3 different applications with the 3 languages that I want so that when for example the IT button is pressed then the italian application should be loaded?

      I think that this is not the best solution that someone should follow but I can't think of something else, since my coding abilities are very very limited.

      I would really appreciate if someone could help me with this or give me a hint of where should I search for help.


      Thank you in advance


        • 1. Re: How to switch between languages

          I think you should use of dynamic RichText. Then you create 3 buttons which changes language. When user select language, varible is creating at the same time (the type of varible: String). When application reads data from XML file, then URL changes into XML files with the value of varible. Example:



                              public var something:RichText;



            public var language:String;

                              private var _somethingData: XML = null;

                              private var _somethingService:HTTPService;


          public function loadSomething():void


                                        var date:Date = new Date();

                                        _somethingService = new HTTPService();

                                        _somethingService.url = "biografie/"+language+".xml".concat("?nochace=", date.time);

                                        _somethingService.resultFormat = "e4x";

                                        _somethingService.method ="GET";

                                        _somethingService.addEventListener(ResultEvent.RESULT, onResultLoadSomethingData);

                                        _somethingService.addEventListener(FaultEvent.FAULT, onFault);





                              private function onResultLoadSomethingData(event:ResultEvent):void


                                        somethingText.text = String(event.result.welcom[0].text);



                              private function onFault(event:FaultEvent):void





          Ofc you must create 3 XML files of 3 language version. But you can't create that code in Flash Catalyst, you must use Flash Builder.

          1 person found this helpful
          • 2. Re: How to switch between languages
            Chris W. Griffith Adobe Community Professional

            Jacob's solution is on the right track. There are two methods to solve this. One is to manually load an external file, then write the ActionScript (in Flash Builder) to update all the text in the app to the correct value. Another solution is to leverage the built-in localization capabilities in Flex. For this see: http://devgirl.org/2011/03/15/flex-4-localization/ for some guidance. It also requires Flash Builder and some work.


            Good luck!


            1 person found this helpful
            • 3. Re: How to switch between languages
              ErikaDparit Level 1


              I want to thank you both for your replies!!


              Well, the main problem to this all is that I have no knowledge as far as flash builder and scripting is conserned which means that I find it very difficult to understand what is that you are talking about and how would I find your precious replies helpful or even meaningful.

              In that case I would go with the "best for me" solution which would be: create 3 different states in the same application with the 3 different languages and share the 3 "change language" buttons which would go from state to state. So I guess the application would only load once , in the start, and then just switch between states-languages to change the layout content.

              Of course, in this case the whole swf would be huge and I still don't know what problems I might encounter with memory and project size, but there is only one way to find out I guess...

              Unfortunately I don't know how to do it with Actionscript and Flash Builder, I only hope that I will find someone help me (do it for me) in case that the way I mentioned above proves to be completely wrong.

              So, what do you say, am I completely wrong about how I am going to do it, given the fact that my application is going to be "buttons that play very small videos and display images X 3" ?


              Again thank you both for trying to help me about this and Im surely going to need lots of luck about doing this!!!!


              • 4. Re: How to switch between languages
                Chris W. Griffith Adobe Community Professional

                For your case, you are going to have to solve it via the brute force method of creating it 3 times. The graphics will be shared between all the versions (assuming you build it as one app). The only thing to warn you about is that, FC only supports 20 states. If you run out of states, you will need to create custom components to hold more states. See the forums for more on this.


                Good Luck,


                • 5. Re: How to switch between languages
                  ErikaDparit Level 1

                  I will not run out of states because I have already built the 3 language states and all the content of each language state is placed inside custom components which again do not reach the limit of 20 states (I had to do this a couple of times until I find the solution to only limit all my application to 3 main states).

                  Again,thank you very much Chris!!! It is very kind of you!