Click to See Complete Forum and Search --> : simple transfer to Flash


guitz
01-14-2004, 07:35 AM
Hello...
I have a JavaScript code wich allows me to detect the language of a Browser... There is a variable called "code" wich gives me this info when I do an Alert function... (in RED in the code)
I just want to transfer the value of this variable to Flash...
So I have tried with the green line in the code... But it transfer the text "code" to my flash and not the value...

Does anybody knows how to do that ???
:confused:

Here is my HTML code :

<HTML>
<HEAD>

<TITLE>TEST</TITLE>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
if (navigator.appName == 'Netscape') var language = navigator.language;
else var language = navigator.browserLanguage;
var code = language.substring(0,2);
alert(code);
//-->
</SCRIPT>

</HEAD>

<BODY BGCOLOR="#ffffff">
<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
ID="vague" WIDTH="465" HEIGHT="100">
<PARAM NAME=movie VALUE="root.swf?codeTxt=code" >
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#ffffff>
<EMBED SRC="root.swf" QUALITY=high BGCOLOR=#ffffff WIDTH="465" HEIGHT="100"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>
</BODY>
</HTML>

CodeTxt is the name of my dynamic txt field in Flash

AdamGundry
01-14-2004, 11:58 AM
In place of the line with the green text, you could try this:

<script type="text/javascript">
document.write('<PARAM NAME=movie VALUE="root.swf?codeTxt=' + code + '" >');
</script>
<noscript>
<PARAM NAME=movie VALUE="root.swf?codeTxt=en-US" >
</noscript>

Adam

guitz
01-14-2004, 12:07 PM
I have made the changes... so my code is now like this :

<HTML>
<HEAD>

<TITLE>TEST</TITLE>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
if (navigator.appName == 'Netscape') var language = navigator.language;
else var language = navigator.browserLanguage;
var code = language.substring(0,2);
alert(code);
//-->
</SCRIPT>

</HEAD>

<BODY BGCOLOR="#ffffff">
<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
ID="root" WIDTH="465" HEIGHT="100">

<script type="text/javascript">
document.write('<PARAM NAME=movie VALUE="root.swf?codeTxt=' + code + '" >');
</script>
<noscript>

<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#ffffff>
<EMBED SRC="root.swf" QUALITY=high BGCOLOR=#ffffff WIDTH="465" HEIGHT="100"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>
</BODY>
</HTML>

But now... the page do not load the Flash !!!
Am I missing something ???