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.
LVL 1
cyberspyAsked:
Who is Participating?
 
RoyKruyshaarConnect With a Mentor Commented:
Hi Cyberspy,

Suppose that the textfile loks like:

&text1=SearchEngine1&url1=http://www.google.com&
&text2=SearchEngine2&url2=http://www.yahoo.com&

Ehen you load the txt-file, in your flash are the variables text1, url1, text2, url2

Now, when you make a button with the following actionscript:

on (release) {
  getURL (url1, "_blank");
}

Everything has to work.
Dont's forget to check the 'Expression' checkbox.

Greetings,

Roy
0
 
stef4sCommented:
so you need to read and/or save to the clients machine?
0
 
webwomanCommented:
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.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
cyberspyAuthor Commented:
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.

0
 
webwomanCommented:
And then what?
0
 
cyberspyAuthor Commented:
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 (?).
0
 
webwomanCommented:
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...
0
 
cyberspyAuthor Commented:
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.
0
 
RoyKruyshaarCommented:
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
0
 
cyberspyAuthor Commented:
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.

0
 
rootdirCommented:
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>
0
 
cyberspyAuthor Commented:
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.
0
 
cyberspyAuthor Commented:
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.

0
 
cyberspyAuthor Commented:
I'm gonna give you these points anyway, I basically got how to make this work.  Thanks for your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.