Reading And Writing 2 Text Files In Flash
my problem goes like this i need to know how to read in a text file and then out put it
kind of like this
infile.open my_file.txt
infile >> name // name is a variable
and then later
outfile.open my_file.txt outfile >> name
so basicly i need basic text input output
any ideas sug.
email twistis1@optonline.net
im wendys freak --- aol
thanks
Ultrashock Forums > Flash > ActionScript
Posted on: 2002-07-17
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Writing And Reading Text Files
hi all,
Im roshan, a very fond enthusiast of flash and flashkit, I have a problem.I will start with an example,. I have a fill in text boxes. I want data from these text boxes to be written to a file, any text file. and I want my program to fetch these data and display them accordingly. I can retrieve them through XML. But how is the writing process done? How do i write to XML? Please help me out. Basicly Im doing a saving and retrieving flash program. Like a mini personal account database.
regards,
roshan
Reading And Writing To Text Files...
Hi,
I'm looking for a really good loadVars tutorial with examples of where and how I can load text files into input text fields, any ideas?
I can't seem to get data out of the file and onto the stage using the new method?!?!?!
Reading From Files, Manipulating Strings, Writing To Files....
Thanks for your time, if you know anything please help me with the following:
1) I have my movie www.web.com/web.swf that reads the contents of the file www.web.com/news.txt. The file is supposed to contain different notes referring to updates of a site (just an example)
2) Flash loads the text in a variable, right? How can i split it, considering i use as a splitting string something like "|splithere|"
3) How can i hold each update-note in a variable, like when i`m duplicating movie clipes, for example update1 should be held in u1, update 2 in u2 and so on... (or as visual basic used - i`m and ex vb'er - u(1) u(2) and so on)
Reading/Writing Files In AS?
I'm using Flash MX 2004....I just need to know how to read and write to files. Are there functions that can do this?
Writing And Reading XML Files
I know that I can read data from a XML but I want to know if I can write in the XML file using only Flash not a 3th party program.And also if the files can pe stored on a local hard drive.If this is possible please give and address to a tutorial where I can used it.
Thanks a lot.
Reading And Writing To Files
i am trying to read and write to a file and would like some help please.
i have created a game and would like to store the high scores in a text file on the local computer.
i have an input text field where the player can enter the name, i would like to send this to a text file.
i also need to be able to read from this text file to compare the scores
and need to create the text file if there isn't one on the computer.
this is what i have typed so far:
var my_lv:LoadVars = new LoadVars();
my_lv.playerName = playerName.text;
my_lv.playerScore = Score;
my_lv.load("setscore.cfm", "_self", "POST");
i don't know if this is right, i have not had to do this kind of thing before and would really appreciate any help.
thank you in advance!
Actionscript Reading/Writing Files
I am creating an application which depending on a text file goes to a different frame. I need it to poll a text file every 20 secs (got a timer function wroking fine). I know how to read from a file as long as it is written a certain way, I just need to make this file empty once I have read the contents (i.e write over the file). Does anyone have any ideas on if this is possible just using flash and a text file,
Thanks,
Laura
Reading And Writing On-line Files.
Is there any way in action script to read or write a file on the internet. Like the game reads a txt file on the internet that says:
_root.fred = 1
_root.guy._y = _root.grey
And then have those changes take place in the game your playing?
Or writing a file on the internet.
And how do I protect my swf files on the internet? Sometimes when I download something it won't let me import it to flash player because it says its protected.
Problem Writing And Reading A Text File From Flash
In my Flash game, I am trying to make a high score table. I am doing this by reading from a text file to get current high scores and then writing to a text file with new high scores. My code seems to be all fine because when I test from withing Flash it all works fine. It also works in Internet Explorer. I have tried it in Firefox and Netscape but it will not work. It seems that a connection just can never be made to change the text file I have stored on my web site. The status text at the bottom of the browser just displays "connecting to <mysite.net>" at the bottom. This is the basic outline of my code:
This is the code for reading in variables. This part reads in name0 and score0 from a text file.
Code:
myData = new LoadVars();
myData.load("http://www.mysite.net/scores/high_scores.txt");
myData.onLoad = function(succes){
if(succes){
var num:Number=parseInt(this.score0, 10);
var nam:String=this.name0;
This is the code for writing out new high score variables to a text file. This part writes name0 and score0 to the text file.
Code:
myData2 = new LoadVars();
myData2.name0="Brett";
myData.score0=100;
myData2.sendAndLoad("http://www.mysite.net/scores/save.php", myData2, "POST");
This is the save.php code.
Code:
<?php
//Capture data from $_POST array
$Name0 = $_POST['name0'];
$Score0 = $_POST['score0'];
//Make one big string in a format Flash understand
$toSave="name0=$Name0&score0=$Score0";
//Open a file in write mode
$fp = fopen("high_scores.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=Ok&";
else echo "writing=Error&";
fclose($fp);
?>
Do you guys see anything that seems like it would work in Internet Explorer but not other browsers? Thanks for your help in advance.
I have also just realized another problem. When outside of flash, it updates the text file and continues to update it as I add new scores. In Internet Explorer, it updates the scores when I tell it to and it even changes the text file like it should but then if I enter another score, it acts as if the file content was how it was before the previous score was added. I hope that's not too confusing. Basically If I add one score, it works. If I add another, the text file pretty much goes back to its original state and then the new score is added. It keeps happening over and over again but only in a web browser.
Reading And Writing To A Text File
is it possible to write to a text file in flash?! one that is kept on the server?
I can do the whole read from part but really wanna be able to write to.
Writing Text Files From Flash
Is it possible to write a text file locally from Flash MX (which is running locally?) without using any server-side script; can MX write our text files independently?
Reading Text Files From Flash
hello
i'd like to know how to read text files into flash and view them
(i'm trying to build a site with updatable data)
Text Files Reading Funny In Flash
heya
just a quicky.
When i type things like % and & in the text file it doesnt appear properly in the dynamic text box in flash, is there someway i can fix this?
Thanking ya in advance
Tez
Reading And Writing From Flash?
Is there any other ways of reading out of and reading into Flash other that using cookies?
What i have is a series of pages in a page-turner type tuturial and on one of those pages is a Flash piece that the learner does a small drag and drop activity. What I need is for the piece to remember where the learner dragged the items. Even when they continue on and the the Flash piece is unloaded because the tutorial has backwards navigation.
Cookies are an obvious one but not all comps use cookies and I need a more secure solution. Is it possible to use Javascript within Flash to write out the variables to the Javascrpt shell that runs the tutorial? Can Flash read and write from LMS's? (I highly doubt is but ya never know) Any help would greatly appreciated!
Reading/writing A Cookie In Flash
I want to have my flash movie make a cookie on users' computers that logs when they last visited. I have news loaded from an external file (complete with variables for date and time). Basically, I want flash to read the cookie and compare the time the user last visited with the time of the last news posted. If news has been posted since a person's last visit, movie clip A plays. Otherwise, clip B plays.
Anyone know a good tutorial for how to do this?
[F8] Writing And Reading Data Between Flash And PHP
I'm making a game and the game tracks scores. At the end of the game I'd like to be able to record high scores to a mySQL db and then display the Top 10. Is that only possible with flash communication server? I know you can post data to php but from what I understand that requires a submit action that will refresh the whole page, which obviously isn't what I want.
Any ideas?
Reading/writing A Cookie In Flash
I want to have my flash movie make a cookie on users' computers that logs when they last visited. I have news loaded from an external file (complete with variables for date and time). Basically, I want flash to read the cookie and compare the time the user last visited with the time of the last news posted. If news has been posted since a person's last visit, movie clip A plays. Otherwise, clip B plays.
Anyone know a good tutorial for how to do this?
Writing And Reading Cookies From Flash Movies
I am trying to create a movie that has only two frames and 3 layers.
layer 1- labels and actions
layer 2- buttons
layer 3 sound
frame 1/layer 1 - Stop() and label no_sound
Frame 2 layer 1 - label bg_sound
I have two buttons:
Off - action on (press) {
stopAllSounds();
}
On - action on (press) {
gotoAndPlay("bg_sound");
}
On my html page I have the following JS:
<script language="javascript">
/////////////////////////////////////////////////////////////////////////////////
// makeCookie is called when the page loads and only sets the cookie
// if the user does not have one.
// we can communicate with the swf by naming it in the <object> and <embed> tags
// in the <object> tag you will see id=movie and
// in the <embed> tag i put name=movie swLiveConnect=True
// a list of javascript methods for flash are available at www.macromedia.com/support/flash
// and type javascript methods into the search box
/////////////////////////////////////////////////////////////////////////////////
function makeCookie(){
var movie = window.document.movie;
movie.StopPlay();
// only makes the cookie if don't have one
if(document.cookie == "") {
// play the intro
movie.TGotoLabel("bg_sound");
// the cookie expires on this date
var date = new Date();
date.setDate(date.getDate() + 30);
// make the cookie date readable by the browser
var da_date = date.toGMTString();
var da_cookie = "visited:True" + ";expires=" + da_date;
document.cookie = da_cookie;
//uncomment the alert below to see the cookies value
alert(da_cookie)
}
else
// if they have the cookie - fire the readIt function
readIt()
}
/////////////////////////////////////////////////////////////////////////////////
function readIt(){
var movie = window.document.movie;
// this tells the .swf which frame to go to
// it could send any number of commands to the .swf
// send the movie to frame 3
movie.TGotoLabel("no_sound");
}
/////////////////////////////////////////////////////////////////////////////////
</script>
And I have added name="movie" and swLiveConnect="true" to the embed tag as well as the id="movie" to the object tag.
I also added the onLoad="makeCookie()" to the body tag.
Still this communication won't work and the cookie doesn't even show under the cookies manager....
What the heck am I missing here?
Forever thankful for any help,
FayeC
Writing To Text Files And PPC
hello all,
i need to know if u can write to text files i.e save a text field to file...is the a command like load variables?
I need this to work in flash 4 as i am working in the pocket pc flash environment....
Also anyone doing dev on the pocket pc flash? interested to know u...
maybe we can exchange stories...
Alvin.
FMX Writing Text Files?
I was just getting ready to buy flash jesters jsave and netcheck, when I saw the flashmx announcement. WIll MX proivide the facilities to do these things from a flash projector?
1. check for internet connection.
2. write a text file.
I am building a desktop app that will load data from our live site and display it, but I need to be able to write to a text file on the hard drive so I can show the latest possible info (written to text file at time of last connection) if they are not currently connected. Hope some one can/will answer this... trying to save $300 (money is short here as everywhere).
Thanks in advance
Felix_Man
Writing Text Files
I'm doing a project where by it would be extremely helpful if options that a person selects in a flash movie file could be saved into a .txt file (...or possibly a cookie if necessary) so that when the movie is closed and then reopened, the previously set options are used to dictate variable settings.
If anyone knows how to write variables to a file, it would be very much appreciated?
Writing To Text Files
hi,
i'm tryin to make a survey and i want to write the collected information into a text file and save the text file. After that i want to load from the text file and display the results in a certain way...
can anyone help me?
Writing Text Files
right i am current a relitive noob to flash, i know motion and shape tweens and not much action script, infact virtually nothing..
i want to place all the info from a text box, then pressing submit place this into a text file. is there a way to do this without using a external script php/asp/cfm/perl
Writing Text Files
right i am current a relitive noob to flash, i know motion and shape tweens and not much action script, infact virtually nothing..
i want to place all the info from a text box, then pressing submit place this into a text file. is there a way to do this without using a external script php/asp/cfm/perl
WRITING External Text Files
There is loads of useful stuff about how to load vars into a Flash movie from an external text file, but I can't seem to find out how to WRITE me a text file in the FIRST place.
grrr..
any help appreciated.
Writing To External Text Files
I have an external file highscores.txt, which my game opens. It finds the 3 variables in it and compares them to the score that the user got and determines if they beat it or not. If they beat the high score, I want it to re-write the variables in the file, which are "name", "seconds", and "minutes". Here is how I open the file and get the data.
Quote:
loadText = new LoadVars();
loadText.load("highscore.txt");
loadText.onLoad = function() {
name.text = this.name;
seconds.text = this.seconds;
minutes.text = this.minutes;
highseconds = this.seconds;
highminutes = this.minutes;
};
Can somebody tell me how I can write in the file using flash? Thanks!
Reading Text Files
Could anyone help me with my a project that i am doing for a masters degree. The project i am making, is an educational program that will be used as a year 6-7 intervention program, to help bring students up to the required level. I need to be able to allow the user to input some text, and then have the program analyse what the text says, picking up spelling errors, grammatical errors, but most importantly to be able to pick up if they have used specific words. If anyone is able to help me, then i would mention your name on the product itself (which i have been told could be sold) and you be mentioned on my website.
Jay
Reading Text Files
Hi, quick question for flash to read a text file. I use the loadVariablesNum command (using MX by the way) to read the text file. What I need to do is have flash read the first line of the file, and assign the information to variables in a movie clip. If there's another line below the first line the movie clip needs to duplicate and assign the information from the second line of text to the newly made movie clip. This will repeat for however many lines there are in the text file. How could I go about doing this? Thanks in advanced.
Reading From Text Files
I have a text file with the paths of several files (1 path per line). Is there a way for me to read these paths and display them 1 by 1 on screen?
Reading From Text Files?
Hi
I m a bit new to actionscript. I have Flash-5. I would like to know how can I read from a text file and then place the contents of the text file and then place them in a dynamic text field.
[CS3] [AS2] Creation, Loading, And Writing Variables To Text Files
I'm designing a Character Generator that needs to be able to retain the data, and notify the administration when a new character file has been created. So far, text seems to be the best way to go. Is it possible for Flash to create a new text file, populate it with variables and then later read from it?
In Need Of Help In Saving And Reading Text Files
I have sat and struggled for days on trying to get a perl script (file is a .pl) to save Flash variables to a text file and then have flash be able to read the file later on. I can't get the perl script to save outside the cgi-bin or the Flash file to read from a text file within the cgi-bin. As you can tell I know little about perl, and I am absolutely out of ideas. If anybody could help me, I would be so gracious. All the script has to do is to take variables from a flash file save it to a txt file, allow for future alteration, and then allow the flash file to read the text file. This has probably already been answered somewhere.
Thanks so much to whoever can help me.
chadz6
Beginner Reading Text Files
Hi all,
I am a novice at flash. I have just started to use flash mx 2004 in the last 2 weeks and have come across a problem.
I have a VB script generating a text file containing over 100 lines of information. Can some one please help me to get Flash to read this text file on the press of a button, and display the contents in a new frame.
Also is it possible to select only certain lines from this text file to display?
Thanks
Umar
Reading In Data From Text Files
Hi, ok I admittedly haven't spent enough time thinking of this (I'm going to do this now) but figured I'd toss it out there while I put in some time.
I have a daily schedule which is different every day. The schedule is known about 2 weeks in advance. Therefore every week or so I have to go in & change the file so I'm always about 1 week ahead.
ok, i'd like to simply edit a text file & upload it to the server.
The problems are I'd like to make this schedule much like the draggle menu tutorial.
I'm going to make the daily schedule 1 big movie clip & mask it so when it loads you're looking @ today schedule & you can dragger a dragger to the right to see the schedule for future days.
Once I convert these to symbols my ability to read in variables will be lost (or @ least I think)
Can anyone give me some pointers to make this a little earier.
Also, is it possible w/ flash alone (no php) to have the movie clip dynamically change its position to the area holding todays date on load.
Thanks in advance.
Tim
Problems With Reading Text Files Into Text Boxes
I have a scrolling text box which is an MC. I place an instance in the root, name it and then use
loadVariables("text.txt","_root.textboxInstance"); which is placed in a frame ie. an actions layer.
I have differently named instances of the textBoxMC in consecutive frames because different text files are readin as you click from one frame to the next.
The first text file reads in okay but then it stops working, I have checked very carefully that all the names are consistent and correct and that the text files are in the same directory as the swf's.
Is there something inherent in the method I'm using that gives inconsistency, and has anybody else had problems reading in text files to dynamic text boxes?
Is it better to have the loadVariables() method assigned to the button that moves the play head to the next frame?
some ideas/help much appreciated
Help Reading Text Files And Dynamic Graphs
I am needing to read info from a text file to create a dynamic graph. For example, reading a list of numbers 0-100 and producing a histogram of that data. The histogram shows HOW MANY of those numbers are between 0-59, 60-69, 70-79, 80-89, 90-100. I'm not the best a scripting and I could use some help knowing how to get Flash to read in my numbers and how to count the "number" of numbers that lie in these ranges. I have a script that produces the histogram, but I can't get it to calculate my values other then putting them in manually. If anyone could help me, I would really appreciate it.
Reading Text Files And Pausing A Script
Hi,
I have, if you don't mind, two questions: Is there a function in actionscript that allow us to make a pause in the script? I want, in a certain part of the code, a pause in the script - not in the movie - of 3 to 5 seconds.
Second: I load several text files ( txt files ) with variables in my flash movie; the problem is that it works in my computer but not in the linux host server. I tryed to chmod the files to 777, but they still don't appear. What can be the reason for this?
Regards,
Kepler
Reading And Writing Cookies : MX
im trying to find some better up to date information on using cookies with Flash MX. I'm finding lots of this article reposted around, http://www.virtual-fx.net/tutorials/html/flookies.html
it seems to be a recreation of something that moock did in 2000 for flash 4
I need to use cookies to save some data and read that data in, as well as let other code use the same data. Since that is the case I dont think shared objects can work can they? arent they only accessible for flash?
can someone let me know if the info in that link above is still pertinent and up to date with the easiest way to read and write to cookies via flashmx? or is there some better easier or more streamlined way to do it via MX?
thanks!
Reading - Writing - Arrays
Here's the issue:
I am building a calculator that when the user enters some information in an input text field, their result looks in an array table, finds the corresponding number in another array table, and stores the result in a dynamic field (this is for calculations that will later be performed)
I have two input text fields that will perform the same function above, but store their result in two separate fields (again this is for the calculations leter performed)
I can easily do this in javascript, however, I must do it in flash (I am using MX)
What I do not know is where the array tables are stored, such as separate layer, movie clip, etc????
I was storing the below within the button function which performs the calculations and other functions (if...else...then) I want the button to trigger ALL functions needed, so this is why I chose to store it here
Code:
calculate_btn.onRelease = function() {
// other functions are performed here.....then we move to the below array..
//I removed the functions so the array info is not confused with any other functionality
var mod = new Array(15)
mod[0] = 'P1'
mod[1] = 'P2'
mod[2] = 'P3'
mod[3] = 'P4'
mod[4] = 'P5'
mod[5] = 'P6'
mod[6] = 'p1'
mod[7] = 'p2'
mod[8] = 'p3'
mod[9] = 'p4'
mod[10] = 'p5'
mod[11] = 'p6'
mod[12] = 99100
mod[13] = 99140
mod[14] = 0
/*mod2 = mod1*/
var mod2 = new Array(15)
mod2[0] = 0
mod2[1] = 0
mod2[2] = 1
mod2[3] = 2
mod2[4] = 3
mod2[5] = 0
mod2[6] = 0
mod2[7] = 0
mod2[8] = 1
mod2[9] = 2
mod2[10] = 3
mod2[11] = 0
mod2[12] = 1
mod2[13] = 2
mod2[14] = 0
function getCodeData2() {
var selectedCode3 = modone.text
for (var i = 0; i < mod2.length; i++) {
if (mod[i] == selectedCode3) {
break
}
}
var msg4 = mod2[i]
modOneuv = msg4
}
};
Can someone tell me where the array info goes?
Do I have this written correctly for actionScript?
the input field is field instance name is modone.
the output field variable name is modOneuv.
Also, can someone direct me to where I can find more information that covers this in-depth? I have only seen a few array tutorials and movies, but nothing on the scale I need.
Thanks
Peace and keep on flashing!
Writing To And Reading From A File.
Howdy all.
I'm fairly new to actionscript and trying to create an application to run on a workstation.
The program will be a form that when filled out, will send an email to someone confirming a ticket purchase/acquisition.
The form includes a text field for the recipients name, email, the date and showtime their ticket is for, and a small message from the concierge dept.
I would like to save commonly used emails in a file, so that when the program is started they will be loaded, and can be chosen from via combo box component.
There would be an "add email" button to save the new email to the file.
It doesn't seem like flash itself can do this.
Could anyone explain the best way to perform file i/o ?
I know a bit of C++, but not how to integrade it into a flash application.
Could someone please give me some pointers?
If there is a specific language or 3rd party application best suited for this please let me know.
Reading And Writing To A Socket
I have a socket set up in AS to connect to my created server and to send and receive data on.
As soon as the application starts up, it needs to send 3 GET requests through the port to my server and read the responses back to show the data on the application.
My question is how do I make sure that my first GET request is completed and the data is sent back before I send my next GET request in AS? Or is this something the AS socket handles itself?
Feel free to point me to documentation on this if you know of any.
Thanks
Writing To And Reading From A File
Is there a way to write to a file in flash? All the sources I found talk about using different languages with flash to do that. We have a game that we would like to store high scores from into a file and load them when the game starts. Can anyone, please, let us know what the best way of doing this is? Thank you!
Reading/writing To Xml File
Hey, I'm looking for some help or a tutorial on reading and writing from a flash file to an xml file. I know how to read the data from an XML file to a flash file, but if a user would enter information into a input field, how would it write it back to an xml file? Any help...awesome..
thanks
Reading/writing To Xml File
Hey, I'm looking for some help or a tutorial on reading and writing from a flash file to an xml file. I know how to read the data from an XML file to a flash file, but if a user would enter information into a input field, how would it write it back to an xml file? Any help...awesome..
thanks
Reading And Writing Cookies
Is there any way i can write and read a cookie to a users pc that contains certain variables used in the movie. I am trying to set up a way to save preferences from my site by using a cookie to store certain variables. Any help would be greatly apreciated even if it has to be through HTML or javascript or something. Thanks.
Everytime I Look At Myself, I Still Can't Believe How Awesome I Am
Reading And Writing Multiple ChildNodes
function setDay(dayNode_xml,day_num,mc){
trace("day: " + day_num);
trace("dayXML: " + dayNode_xml.attributes.value);
if (dayNode_xml.attributes.value==day_num){
//-----------------------------------------------
var itemsNode_xml=dayNode_xml.firstChild;
trace("yes entry for this day");
while (itemsNode_xml!=null){
if (itemsNode_xml.nodeName=="label")
{
trace("yes label: " + itemsNode_xml.nodeValue);
_root[mc].label=itemsNode_xml.firstChild.nodeValue;
THE ABOVE NEEDS TO BE MODIFIED TO ALLOW MULIPLE EVENTS... I'VE BEEN WORKING ON IT FOR DAYS.... CAN ANYONE HELP?
}
else if (itemsNode_xml.nodeName=="description"){
trace("yes description: " + itemsNode_xml.nodeValue);
_root[mc].description=itemsNode_xml.firstChild.nodeValue;
}
else{
trace("error");
}
itemsNode_xml=itemsNode_xml.nextSibling;
}
|