|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
loading text from a .txt file
I would like my flash movie to load text from a .txt file so that when I want to add more text all I have to do is update the .txt file and can leave the flash movie alone. If anyone can walk me through this or direct me to a specific tutorial (not a website with tutorials) that covers this issue, please reply to this or email me. Thank you.
Eric |
|
#2
|
|||
|
|||
|
you can use getNetText and netResult (look in the flash manual, there are examples.) if you load it from a server.
if it is local, sorry, i donīt know. |
|
#3
|
|||
|
|||
|
sorry but I think you missunderstood what I was trying to explain. I know how to work and edit the text file. I'm just not familiar with how to have the flash movie load text. I dont have a flash manual because I'm one of the millions out there that didn't get mine in a box
I know this can be done, I just dont know how to do it. |
|
#4
|
||||
|
||||
|
Quote:
with notepad or from flash? i didn think you were talking about EDITING a text file. just loading and make something like dynamic or localized menus. from your first post: Quote:
exactly this can be done using the functions i told you. if you donīt have the manual, just reply, i will try and find a sample for you... |
|
#5
|
|||
|
|||
|
Sorry that I missunderstood what you said. And reading back over my post, it may have come off as rude. I appologize if it did. But anywho.
Yeah, no manual. I'm a cheapo. A sample would be great. Thanks for your help. |
|
#6
|
|||
|
|||
|
nothing found i consider rude...
anyway, i try to make it up from my head since i only use flash at work: netID=getNetText("http://www.myhost.com/myscript.php"); while (!netDone(netID)) { (stay in this frame) } myText=netTextResult(netID); _root.myTextObject.text=myText sorry, this is not correct, i know. but from the html-help you should be able to make it work. if not, reply, i am sure someone is online that can do this. its an easy task after you made it work once... ![]() |
|
#7
|
|||
|
|||
|
Do you still need help with this?
|
|
#8
|
|||
|
|||
|
nah, I got it figured out. Thanks
|
|
#9
|
|||
|
|||
|
Hi Eric,
You will need ASP Hosting for this solution URL > have free hosting I work on ecomerce/Database Driven Sites site done in Flash without using Macromedia Generator or other similar tools it is all done by hand in actionscript I Currently only know ASP (Active Server Pages) and this is how to solve your problem Firstly Copy the code below all code below between and including the "<%" + "%>" save this file as "WriteTextFile.asp" Then edit it in notepad and change the following lines VariableContents = Request("FlashVariableContents") The text between the quotes is name of the flash variable which is going to be sent ( This page excepts both GET and POST to send Variables) The other line is as follows TextFileName= "FlashVariables.txt" The text between the quotes is name of text file and it relitive position from the flash movie at the moment it is in the same palace as the flash move The Final line that needs to be changed is as follows TextToWrite = "&VariableName=" & VariableContents The text between the quotes is name of the variable in flash, The "&" Sign must be before the variableName then Follow Directly by the "=" Sign as shown below DO NOT Change any else on this line! "&VariableName=" Contents of "WriteTextFile.asp" <% Const fsoForAppend = 8 Dim FileSystemObject Dim FileSystemObject Dim VariableContents Dim TextToWrite Dim TextFileName Dim PathOfTextFile TextFileName= "FlashVariables.txt" PathOfTextFile = Server.MapPath(TextFileName") VariableContents = Request("FlashVariableContents") TextToWrite = "&VariableName=" & VariableContents Set FileSystemObject = Server.CreateObject("Scripting.FileSystemObject") Set objTextStream = FileSystemObject.OpenTextFile(, fsoForAppend) objTextStream.Write TextToWrite objTextStream.Close Set objTextStream = Nothing Set FileSystemObject = Nothing %> This will write the following to the text file &VariableName=Testing123 If you have any problems Email Me StuffBoy |
|
#10
|
|||
|
|||
|
External text file
I know you figured this out already but I thought I would add a solution that doesn't require any server side scripting. You can just edit the text file by hand, upload it to the server and flash reads it in...
In Flash: - create a text field and name it 'stuff' - create a button and add this script on (press) { loadVariablesNum ("textfile.txt", o); } In the textfile.txt, write: stuff=This+is+the+text+you+want+displayed&otherVar=this+is+another+variable+named+otherVar+that+will+load+too There are no quotes around any text. The end of a variable (and beginning of the next) is indicated by the '&' character. Spaces are not used. In a text string, a '+' character is used in place of a space. NOTE: If you use special characters they will also be transferred. For example, if you use a return (character) in the file it will be transferred as part of the variable. |
|
#11
|
|||
|
|||
|
adding on to this question.
okay so I got this stuff working a good time ago, but on a related note, does anyone know how to make it so that I can edit the text from the flash movie so that it saves it to the text file. That way the news or whatever can be updated from the movie itself.
any ideas? |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > loading text from a .txt file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|