-
PHP Re-Saving Text w/out reloading SWF
This is what I have but it doesn't work. Loading the text file is easy, that's not included here.
Everything is on main stage of movie on frame 1 (stop()) - I only testing on 1 frame.
On btnSave click...
Code:
on (release) {
loadVariablesNum ("savevar.php", 0, "POST");
}
in php file...
Code:
<?php
//set var
$txt1 = $_POST['mycode'];
$txt2 = $_POST['mytext'];
// set string
$toSave ="mycode=$txt1&mytext=$txt2";
//Open a file in write mode
$fp = fopen("savevar.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=Ok&";
else echo "writing=Error&"
fclose($fp);
?>
It is not saving the file.
Anyone help?
Last edited by FHilton; 11-22-2005 at 02:41 PM.
-
The php and text file are in the same server folder.
Any ideas?
-
Well I figured one problem.
I was using LoadVariableNum to call the PHP file to save the text.
I changed it to getURL....
Now I get and error on this line...
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in ......ourwebzone.com\savevar.php on line 11
which is.... fclose($fp);
So why am I getting this error?
-
Alright... I didn't have to change it to getURL... so I put it back to loadVarNum.
I was missing a ";" at the edn of an echo.
Now my file saves ( ) but when I click an open button it does show the new file. I have to close the browser and try again to get it to load the changes.
I can I get around this?
-
Is anybody out there???
-
Okay.. I got my text to save.
Now I have a new problem...
When I click my open button after saving, it does not show the new file. I have to close the browser and click open again to get it to load the changes.
I can I get around this?
Is there an clear loadvariables command or somthing that resets the loadvariable command?
see it here... http://www.ourwebzone.com/savevar.swf
PLEASE HELP ASAP!!
Last edited by FHilton; 11-22-2005 at 02:51 PM.
-
Flash Gordon
Sounds like a caching problem..
where u load it put like:
"savevar.txt?version="+new Date().getTime()
this new Date().getTime() will put the milliseconds since 1970 which is unlikely to
ever be the same, so your savevar.txt will never get outta cache
-
Didn't work
This is my line to open file....
loadVariablesNum ("savevar.txt?version=\"+new Date().getTime()", 0);
How come flash 5 put the "\" in there?
-
Okay... it works
loadVariablesNum ("savevar.txt?version="+new Date().getTime(), 0);
had to remove \ and a quote at end.
Now another problem... if you check link....
If I specify fon color using ' or " around the hex. It puts slashes in their....
what is the deal with that
Thanks Thanks
-
Flash Gordon
Hups, i deleted the savevar.txt.. damn..
does it put slashes or backslashes? i assume u are talking about backslashes..
ok.. you upload a string, a string is like var x="abc";
if you need quotes in that string u use the backslash to escape it:
var x="abc \" def";
trace(x);// will output: abc " def
got it so far?
Ok for changing a colour you need a Number,
to convert a string to a Number you could use
Number(varName) prior to using it as a Number..
Got it ? My english is so bloody krautish...
-
-
I put new code in text field see link
-
McUsher....
I have on my main page a webblog that loads a text file (not save, I mannually set it up) using html tags. I load it into a dynamic text field with Html on.
This input box is dynamic, but it is not html. So it saves raw text.
Not sure why it is adding the backslashes though.
Thanks for your help... I'll keep doing some research
-
Flash Gordon
this is correct: <font color=\"#AA000\">text</font>
works correctly if assigned directly to the html-TextField..
I suspect your routine that loads and handles the savevar.txt
to do something with the var, that it shouldn't..
As the txt-file doesn't start "&mycode=" but "mycode="
-
-
I added the "&" to the beginning of the line when it save.
No change
-
Flash Gordon
Originally Posted by McUsher
I suspect your routine that loads and handles the savevar.txt
to do something with the var, that it shouldn't..
-
This is my PHP...
Code:
<?php
$MyXCode = $_POST['mycode'];
$toSave ="&mycode=$MyXCode";
$fp = fopen("savevar.txt", "w+");
if(fwrite($fp, $toSave))
echo "writing=Ok&";
else
echo "writing=Error&";
fclose($fp);
?>
My btnSave....
Code:
on (release) {
loadVariablesNum ("savevar.php", 0, "POST");
}
-
Flash Gordon
I give up...
Originally Posted by McUsher
I suspect your routine that loads and handles the savevar.txt
to do something with the var, that it shouldn't..
there where u added the bloody new Date().getTime() thingy i provided ...
-
Bearded (M|G)od
PHP Code:
<?php
$MyXCode = $_POST['mycode'];
$toSave ="&mycode=$MyXCode";
$fp = fopen("savevar.txt", "w+");
if(fwrite($fp, $toSave))
echo "&writing=Ok&";
else
echo "&writing=Error&";
fclose($fp);
?>
you need the '&' in front of what you are echoing back to flash...See if that works for ya!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|