This content has been marked as final. Show 14 replies
The FileIO Xtra is not Shockwave-safe, so no, you won't be able to use it.
Take a look at the Director help, searching for the setPref and getPref commands.
Or you could use a Flash Shared Object to save name/value pairs on the local machine, via the Flash Asset Xtra. Check out this article here: http://director-online.com/buildArticle.php?id=1082
pete.h posted in macromedia.director.lingo:
> The FileIO Xtra is not Shockwave-safe, so no, you won't be able to use it.
> You could use a Flash Shared Object to save name/value pairs on the local
> machine, via the Flash Asset Xtra. Check out this article here:
Also for saving to the local system, there is setPref/getPref
(If you have a Mac, you might want to follow up on bmashford's setpref
question in this group on July 26)
Mark A. Boyd
If you need (in a web page) to save/load a file from a specific place (not default, not cookies, not setpref, not shared object, not sessions) in the local machine the user must be prompted to save/load that file. Threre is no other way.
I found a way to achieve that by using lingo+flash+server scripting. Basically I have a swf in the same page of the dcr, then I create a localconnection between dcr and swf, so I can use the fileReference Object inside flash.
In this case I used PHP to code a download/upload file script. The basic algorith is:
1.-Store the variables in a string then send those vars to flash (via localcon).
2.-in flash use a filereference object to prompt for a save location.
3.-using the same object send the vars to save.php scritp using POST or GET.
4.-in php create the file (on the fly) give it to flash.
1.-send the instruction to flash to load a file (again, using localconnection)
2.-inside flash, use file reference to select the file to load.
3.-send the file to load to load.php
4.-in php, read the file and return the contents as a text response,
5.-In flash receive this response and forward to showckwave (using local, connection)
Is that what you want to do?.
OK. If you don´t need to store the file the client computer you can call the save/load scripts from director.
The save script must receive the data using GET or POST methods. Then store it in a file. A basic approach would be:
//open the file at the end.
$myFile = fopen("/data.txt", "a+");
//write the post var called "datos"
//close the file
the problem is that you cant access from two places simultaneusly because you will get a file access error.
In director, when you want so save a data just call
on saveData me
--the data that I want to save.
tData = ["datos":"asdfasdf!"]
--call PHP script.
This is the most elemental piece of code.
For loading is a similar, try to google it, go to php.net an search for fread, fwrite, fopen, fclose to understand file handling methods.
thank you so muchhhh..... "ensamblador "
you helped me so much......
thank you for the .php code:D really perfect...
how can I use a .cgi file instead of .php file?
whats the script of .cgi file?
Of course, you can use any server scripting, the basic idea is the same.
The source code is not a problem just sear for http://www.google.cl/search?q=cgi+file+handling&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL _esCL276CL277
you'll find a lot of step by step-detailed tutorials.
Everytime you want to know how to code a specific action in a specific language just sear for "language action" in google. Google knows where´s everything. Use it wisely.
I did exacty what you said to do with the .php file
and uploaded both .dcr and .php file
but it does not work:(
this is theexacty what is in save.php file:
$myFile = fopen("data.txt", "a+");
and I wrote this scrip on an sprite:
on mouseUp me
tData = ["datos":"asdfasdf!"]
I'v uploaded .dcr and .php and data.txt on my website in the same directory
but when I click on that sprite nothing happens!!
maybe thats because save.php file does not have the permission to open data.txt file
help me please!
help me pleaseeeeee
Lets try to track the error.
Lets see if you can call your php file, if you're running in a server you can call http://testserver/save.php directly from your browser.
When you access to this page, are you prompted to save to disk the file "save.php"?, if yes, there is a problem with the server.
If no, do you get a 404 error?, this means that the page doesn't exists.
if everything is ok, change the line
and call directly from your browser:
if all with the server is OK, you will se a file created called data.txt containing "testingdata" in the same folder of php.
Although it won't write your server-side scripts for you, you might find this
site helps you understand the processes involved.
There is example code in several languages there.
Mark A. Boyd
thank you for your great help
that was the error :D https://
helped so much