I have a SWF with text embedded from an external .txt file. Is there a way I can have a different file used as the text source through the embedcode (swfObject) depending on the language?

Here is my current actionscript:

myData = new LoadVars();
myData.onLoad = function() {
info_clip.info_details.text_clips.project_title.text = this.projecttitle1;
};
myData.load("translatetext.txt");

var loader:MovieClipLoader = new MovieClipLoader();
loader.loadClip(_level0.projectimage1,pic1.image_holder);

This is the content of translatetext.txt:

projecttitle1=This is my translatable text

This is the embed code I'm using:

<object width="960" height="275" id="rvFlashcontent">
<param name="movie" value="rvflashtour8.2.swf" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="projectimage1=flashimages/brit_cafe_rc2.jpg" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="rvflashtour8.2.swf" width="960" height="275">
<param name="wmode" value="transparent" />
<param name="flashvars" value="projectimage1=flashimages/brit_cafe_rc2.jpg" />
<!--<![endif]-->
<img src="/images/french_cafe.jpg" alt="French Cafe">
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>

What I want to do is add a Flashvars parameter to name the file to load, so I can change the language:

<param name="flashvars" value="projectimage1=flashimages/brit_cafe_rc2.jpg&projecttext=textfrench.txt" />

Thanks in advance all!

1 answer

0
points

Where do you get the language var from? because then id say just give the language variable to your actionscript (which im not familiar with btw) and then switch the language variable. (only good if you know which languages are available, but i presume you do if you have multilingual text files. pseudo code: from HTML:

 --snip--
    language_var='fr';
    load: swf + language_var;
--snip--

IN SWF:

--snip--
var file = '';
switch(language_var)
{
   case 'fr': file ='textfrench.txt';break;
   case 'en': file='textenglish.txt'break;
   ....
  default: break;

}
--snip--

I have some swf embedded in my current project and this is kindof the way i pass variables to it ( not that i know for sure, someone else made the swf ;P )

Hope you can progress. Cheers

Answered over 6 years ago by Menno Geelen
  • That's not a bad idea, but it would mean the developers would need to get a new SWF each time they add a language, which I'd prefer to avoid since I don't work with them full time, and don't know exactly which languages are going to be added in the future. Cormac over 6 years ago