Bilingual Texts w/ global variables?

I’m trying to make a bilingual site, here’s an example of what I’m trying for http://www.fcmm.com/2001/flash.html

I want the user to be able to switch languages anytime during the movie by pressing either an ENGLISH or PORTUGUESE button (which willl always be shown).

The main movie is pretty simple, 4 main nav buttons (paintings, info, photos, etc). The subnav will load external swfs or jpgs into the main movie.

Anyhow, I am more of a designer and am only starting to discover actionscript. I think I have to define a global Lang variable on each text box, then do an “if , then” statement with the language buttons, but I have NO idea where or how to do this. Any help would be greatly appreciated. Thanks.

To set a variable that would be remembered throughout the movie use the [COLOR=blue]set[/COLOR]. Eg

[COLOR=blue]set(“lang”, “(whatever)”;[/COLOR] if it’s a string. If it’s a numerical value then lose the quotes.

I’m sure someone will want to ellaborate.

Click here for a link to more variable explanations .

They should be covered on the site I think…

You could have

[COLOR=blue]on (release) {
set (lang, 1);
}[/COLOR]

for a button that would mean English.

and

[COLOR=blue]on (release) {
set (lang, 0);
}[/COLOR]

that would change to portuguese.

you could then use

[COLOR=blue]if (lang == 1) {
//do whatever
} else {
//do whatever else
}[/COLOR]

This will have to go in an “on” event handler like [COLOR=blue]onClipEvent (load)[/COLOR] or [COLOR=blue]on (release)[/COLOR].

I think that should work.

1.make all the textfields you want to change dynamic and assign a variable name to each.
2.make one txt file with all the variables and their english text, another with the same for portugese (example: &myFirstButton=Info&mySecondButton=Contact&myTitle=whatever in one fole, then &myFirstButton=Infomacioa&… (sorry, i don’t speak any portugese, lol…just make sure the variables are the same in both txt files and correspond to the textfields in your fla)
3. button English: on release, loadVariables “english.txt”
4. button portugese: imagine… :wink:

of course, you don’t need txt files to load in, it’s just easier to change if you need to, else just hardcode the variable values in the fla…

There you go. That’s fine for loading in dynamic content, but the if, else statements are there if you want something loaded or moved depending on the language set.

yeah, use both of those options… use the second to change any content you may have in text fields - although it doesnt sound like youll be loading much outside text… so use the first option with any flash elements. ex if you have a MC that is a bit of text have two frames of text one english and one portugese, then use the method described above to switch between these frames based on what the use selects.

Peace