|
|||
|
Hello,
Sorry for my english ... (i am french) I want to save and read Variables in a external text files ... I see this code in an other topic : var f = new FileStream(getAppDir() + "output.txt", "w"); f.write("var1=" + FlashPlayer.getVariable("var1") + "&var2=" + FlashPlayer.getVariable("var2")); f.close(); ...but i don't know where i put it in flash ? or in swfkit ? ... and the file "output.exe" must be in the same folder than the exe? (i make a standalone player) .. or the "output" can be inside the .exe ? Thanks by advance ![]() |
|
|||
|
Since it is ffish script code, you will have to put it in a script in swfkit, say "writefile". In action script you can call it by using the following code
Code:
fscommand("ffish_run", "writefile");
|
|
|||
|
Thanks ... many ... many ... it's works, i can write in the exe file create with swfkit ... but there's another probleme : when I re-open the .exe, the variables var1 and var2 are "blank" and i want that the var show what i write before in the output.txt.
In the first frame in flash, i put this action image code Code:
this.loadVariables("output.txt");
Thanks for your help ! |
|
|||
|
It's not work ... I can write variables but I can't read it.
I make a "test.fla" with only one image with 2 variables (var1 and var2) and a button. On the first image I put this action : Code:
import SWFKit.*; this.loadVariables(global.getAppDir() + "output.txt"); Code:
on (release) {
fscommand("ffish_run", "writefile");
}
Code:
//writefile
var f = new FileStream(getAppDir() + "output.txt", "w");
f.write("var1=" + FlashPlayer.getVariable("var1") + "&var2=" + FlashPlayer.getVariable("var2"));
f.close();
![]() Have you an idea .... and thanks for your help ! ![]() |
|
|||
|
You can use the as object to loas variables from an external text file. And please use "Global.getAppDir()" method in as to get the proper path name of the text file.
|
|
|||
|
Ok ... but "this.loadVariables("output.txt");" don't work in as (the swf work but not the .exe create with swfkit) .... and "this.loadVariables(global.getAppDir() + "output.txt");" don't work too in as.
What is wrong in these codes ? I have only one script in swfkit named "writefile" .. perhaps I must put a second script in swfkit ? Thanks for your help ... ![]() |
|
|||
|
Sorry for my english ... but I think you don't understand me ....
The loadVars method in actionscript works well with the swf or .exe created by flashcs3 ... but don't works in the standalone created with sfwkit : the variables are "blank" when i launch the .exe ! ??? !!! I want to make only one file (a standalone created with swfkit for example) ... and I want the users can change some text variables in the exe and I want these changes enregistred in the .exe. It's not possible with actionscript only ... and I want to know if it is possible with swfkit ... for example, write and load variables in a .txt file attached with the .swf ... and put the two files (.swf and .txt) in a standalone .exe created with swfkit ? Is it possible ? if it is yes ... how ? Many many many thanks for your help and patience ... ![]() |
|
|||
|
Very sorry you cannot do that, because the files packed in the output exe files are read-only. You can only write a new file in the same folder as the exe file.
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|