Hi! I’m new to the forums.
I’m trying to save text from 2 different text fields with JavaScript cookies. This is a project I’m doing for PSP (PlayStation Portable), the device has flash player 7 and no shared object support, I tried to save the text with shared objects but didn’t work. I was able to save the text only from 1 text field so far using JavaScript and it worked nice but when I wanted to save the second one, it didn’t work; I tried everything I can think of to fix it but no luck.There is an html file that contains the javascript codes which loads the flash file.
So I have 2 text fields:
First Text field has the instance name of text1 and var text1.
Second Text field has the instance name of text and var text.
Then I have 2 buttons “Save” and “Load”.
In frame 1 I have this code:
function save(Text1) {
getURL("FSCommand:writeToDisk", Text1);
}// End of the function
_root.textBox.text1 = "";
_root.Text1 = "";
function save(Text) {
getURL("FSCommand:writeToDisk", Text);
}// End of the function
_root.textBox.text = "";
_root.text = "";
In the save button I have:
on (release) {
_root.Text1 = _root.text1;
getURL("FSCommand:writeToDisk", _root.Text1);
_root.Text = _root.text;
getURL("FSCommand:writeToDisk", _root.Text);
}
[FONT="]In the load button I have:[/FONT]
on (release) {
_root.Text1 = _level0.text1;
_root.text1 = _root.Text1;
_root.Text = _level0.text2r;
_root.text = _root.Text;
}
Here is the html file that loads the flash file :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>Title</TITLE>
<SCRIPT LANGUAGE=JScript>
<!--
function writeToDisk(writeString) {
document.save.text1.value = writeString
document.save.text2.value = writeString
document.save.submit();
}
//-->
</SCRIPT>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:0;
top:0;
width:480;
height:272;
z-index:1;
visibility: hidden;
}
#Layer2 {
position:absolute;
left:0;
top:0;
width:480;
height:272;
z-index:2;
}
-->
</style>
</HEAD>
<BODY bgcolor="#000000">
<div id="Layer1">
<Form name='save' method='post'>
<input name='text1' size='1'>
<input name='text2' size='1'>
</form>
<script language=javascript>
textToLoad = document.save.text1.value
textToLoad = document.save.text2.value
</script>
</div>
<div id="Layer2">
<a name=flash>
</a>
<script LANGUAGE=JavaScript>
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"480\" height=\"272\" id=\"flashfile\" align=\"middle\"\> <param name=\"allowScriptAccess\" value=\"sameDomain\" /\>")
if(textToLoad==""){
document.write("<param name=\"FlashVars\" value=\"text1=notYetDefined\" />")
}else{
document.write("<param name=\"FlashVars\" value=\"text1=" + document.save.text1.value + "\" />")
}
if(textToLoad==""){
document.write("<param name=\"FlashVars\" value=\"text2=notYetDefined\" />")
}else{
document.write("<param name=\"FlashVars\" value=\"text2=" + document.save.text2.value + "\" />")
}
var FlashVars={
FlashVars.text1= " + document.save.text1.value + ";
FlashVars.text2= " + document.save.text2.value + ";
};
document.write("<param name=\"movie\" value=\"flashfile.swf\" /\><param name=\"quality\" value=\"high\" /\><param name=\"bgcolor\" value=\"#006699\" /\><embed src=\"flashfile.swf\" FlashVars quality=\"high\" bgcolor=\"#000000\" width=\"480\" height=\"272\" name=\"Movie1\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /\></object\>")
document.location.replace('index.html#flash')
</script>
</div>
<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function Movie1_DoFSCommand(command, args) {
if ( command == "writeToDisk" ){
writeToDisk(args);
}else{
document.writeln("Failed");
}
}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write('<SCRIPT LANGUAGE=VBScript\>
');
document.write('on error resume next
');
document.write('Sub window2_FSCommand(ByVal command, ByVal args)
');
document.write(' call window2_DoFSCommand(command, args)
');
document.write('end sub
');
document.write('</SCRIPT\>
');
}
-->
</SCRIPT>
</BODY>
</HTML>
Can somebody help me please? Tanks!