Link to home
Start Free TrialLog in
Avatar of cyberspy
cyberspy

asked on

Text file and Flash

Hello everyone,

Here's whay I need to know and if it's possible, for someone to help me set it up.  I need a text files which will serve as a master file for a flash movie.  It needs to be sort of like a database, only that the files are not going to be on the server, they are going to be on a computer harddrive.  What I need to do is to make some text in flash and make them links, but since the links can change I need to create a text file from which the flash will will call upon this text file to pull info from it and place appropriate links in it.  I know how it works when the files are on the server and how to load additional movies into flash and all, but never done this stuff with text and text files.  Is it possible? Please help me out.  Thanks, I really appreciate your help.

--
cyberspy.
Avatar of stef4s
stef4s

so you need to read and/or save to the clients machine?
Which is most definitely NOT going to happen. Flash doesn't have that capability.

If they're on the SERVER, fine. If they're on the CLIENT, forget it.
Avatar of cyberspy

ASKER

stef4s,
I need to create the flash and text file so that the client will use it on his machine to make the changes to the links, that's all.
Thanks.

And then what?
He needs to have a master file in case the links change or somthing, so he can edit them in this text file and not have to go in the flash demo to do it.  He doesn't have flash and doesn't know how to use it, so I was thinking if this can be done with a text file and variables (?).
Should work... you'll have to make sure that everything is in the same folder, but you should be able to do it.

But he'll need all the files, and they'll be on his machine, not on the net for general access. Of course, he could always upload them somewhere...
Could you help me set this up? What should be put in the text file? If  this could be done, I need to know how? Thanks.
Hi Cyberspy,

That's easy!

Create a txtfile that looks like:

&var1=blabla&var2=blablabla&var3=bladiebla

now when you use the following actionsscript:

loadVariablesNum ("myTxtFile.txt", 0);

in your flash there wil be three variables named var1, var2, var3 with the values "blabla", "blablabla",
"bladiebla". Now when you create a dynamic txtfield maned var1, var2 and var3, the text is then in the
textfields.

This is the actionscript for Flash 5

Well, this is it, but when you have further questins, please feel free to ask.

Greetings,

Roy
Hi Roy,
Thanks for your help.  But how do I make this text have links in it so that anyone can edit these links whenever they need to ?
Thanks.

ASKER CERTIFIED SOLUTION
Avatar of RoyKruyshaar
RoyKruyshaar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you wanted to anyone can edit these links
whenever they need to do then,

you have take those links into flash variables.

Pass those variables to either ASP,PHP page or any serverside scripting page.

Then that page either update or save variables to serverside text file.

You can write clientside text file by calling javascript from flash,  but you have to modify some code bellow

<SCRIPT LANGUAGE="JavaScript1.2">

function setFile(str) {
self.blur();
var frame = new java.awt.Frame();
var dlog = new java.awt.FileDialog(frame, "Save As...", java.awt.FileDialog.SAVE);
dlog.show();
var filename = dlog.getDirectory() + dlog.getFile();
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");
var outputStream = new java.io.FileOutputStream(filename);
var writer = new java.io.BufferedWriter(new java.io.OutputStreamWriter(outputStream));
writer.write(str);
writer.flush();
writer.close();
outputStream.close();
dlog.dispose();
netscape.security.PrivilegeManager.disablePrivilege("UniversalFileWrite");
}

</SCRIPT>
Hi Roy,

I have just got to making the text file and it works.  Only thing I need to understand how the url thing works.  I have created a dynamic text field in my flash movie and placed action script to load variables and defined the variables.  Now, if I have a url1 as a variable in my text file how is that going to be done in Flash? If my text field is var1, do I create another text field for url1? or how does this work?  what do I make a button and how the var1 text field and url1 are connected? please explain.  Thanks, I appreciate your help.
Roy,
I'm thinking maybe you didn't understand completely what I needed...What I need is for the actual word to be a link, like for example "Search Engine", it has to be clickable and to be a link itself not have a url next to it to be clickable. Can this be done? Thanks.

I'm gonna give you these points anyway, I basically got how to make this work.  Thanks for your help!