# Bilingual Texts w/ global variables?

**URL:** https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168
**Category:** flash
**Created:** [September 3, 2002, 4:26pm UTC](https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168 "2002-09-03T16:26:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![PuReDe](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@PuReDe](https://forum.kirupa.com/u/PuReDe)
#### Post date: [September 3, 2002, 4:26pm UTC](https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168/1 "2002-09-03T16:26:02Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 3, 2002, 7:00pm UTC](https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168/2 "2002-09-03T19:00:35Z")

</div>

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](http://www.actionscript.org/tutorials/beginner/variables/index.shtml) .

They should be covered on the site I think…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 3, 2002, 7:18pm UTC](https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168/3 "2002-09-03T19:18:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 3, 2002, 9:15pm UTC](https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168/4 "2002-09-03T21:15:18Z")

</div>

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… 😉

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…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 3, 2002, 9:52pm UTC](https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168/5 "2002-09-03T21:52:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 4, 2002, 6:07am UTC](https://forum.kirupa.com/t/bilingual-texts-w-global-variables/5168/6 "2002-09-04T06:07:06Z")

</div>

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
