Reading Data From A Text File
Hey All. I'm a newbie to Actionscript but have a fair amount of experience with OO programming and server-side scripting. A project I'm working on is a Flash quiz that gathers it's questions and answers from a text file. I've written a class to get the qusetions but am unsure how to get it to read more than one question and its answers. My code is below.
Any help would be great.
John
P.S. I wouldn't mind using seperate text files for each question but others may want to use a single text file.
Class Code -------------
Code: package { /********************************************************** * This class is used for loading and displaying questions * * in the Flash language project. * * * * Authors: Roisin Bradley and John McLernon * **********************************************************/ import flash.display.MovieClip; import flash.net.URLLoader; import flash.net.URLRequest;
public class Questions extends MovieClip { // Declare question and answer variables private var question:String= null; private var answer_one:String = null; private var answer_two:String = null; private var answer_three:String = null; private var answer_four:String = null; private var correct_answer:String= null; private var question_clue:String= null;
// Contructor class to set the intitial properties of the class public function Questions(question_file:String) { // Get information from file var questions:URLLoader = new URLLoader(); questions.dataFormat = URLLoaderDataFormat.VARIABLES; questions.load(new URLRequest(question_file));
// Set variable values question= questions.data.txtQuestion; answer_one= questions.data.txtAnswer_one; answer_two= questions.data.txtAnswer_two; answer_three= questions.data.txtAnswer_three; answer_four= questions.data.txtAnswer_four; correct_answer= questions.data.txtCorrect_answer; question_clue= questions.data.clue; } } }
Calling Class Code ------------------
Code: // This actionscript uses the Questions class import Questions;
// Declare a new instance of the class var question_one = new Questions("question_1.txt");
// Add question and answers to the Flash Project addChild(question_one);
FlashKit > Flash Help > Actionscript 3.0
Posted on: 06-09-2008, 08:56 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Reading Data From Text File
Hey All. I'm a newbie to Actionscript but have a fair amount of experience with OO programming and server-side scripting. A project I'm working on is a Flash quiz that gathers it's questions and answers from a text file. I've written a class to get the qusetions but am unsure how to get it to read more than one question and its answers. My code is below.
Any help would be great.
John
P.S. I wouldn't mind using seperate text files for each question but others may want to use a single text file.
Class Code
-------------
Code:
package
{
/**********************************************************
* This class is used for loading and displaying questions *
* in the Flash language project. *
* *
* Authors: Roisin Bradley and John McLernon *
**********************************************************/
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class Questions extends MovieClip
{
// Declare question and answer variables
private var question:String= null;
private var answer_one:String = null;
private var answer_two:String = null;
private var answer_three:String = null;
private var answer_four:String = null;
private var correct_answer:String= null;
private var question_clue:String= null;
// Contructor class to set the intitial properties of the class
public function Questions(question_file:String) {
// Get information from file
var questions:URLLoader = new URLLoader();
questions.dataFormat = URLLoaderDataFormat.VARIABLES;
questions.load(new URLRequest(question_file));
// Set variable values
question= questions.data.txtQuestion;
answer_one= questions.data.txtAnswer_one;
answer_two= questions.data.txtAnswer_two;
answer_three= questions.data.txtAnswer_three;
answer_four= questions.data.txtAnswer_four;
correct_answer= questions.data.txtCorrect_answer;
question_clue= questions.data.clue;
}
}
}
Calling Class Code
------------------
Code:
// This actionscript uses the Questions class
import Questions;
// Declare a new instance of the class
var question_one = new Questions("question_1.txt");
// Add question and answers to the Flash Project
addChild(question_one);
Flash Reading Data From Text File How To
Hi im totally new to flash im wondering if is there a way flash can read thru the data inside a text file and store those data in its local memory for later use? any help ,advice tutorials on how to do this would surely help.
im trying to make my C# program to communicate with flash thru the text file. thank you
Reading Data From Text File Line By Line
I want to read some data from a text file into arrays.
In the text file, I have:
data = 1234567890
This works ok, but I want the text format in the text file to be:
data =
12345
67890
So after reading 'data', i will have 2 arrays.
[1,2,3,4,5] and [6,7,8,9,0]
Any idea how to go about doing this?
It will be even better if I dont need to use any variable.
Like this:
12345
67890
The main thing is just to read the text line by line and get them into arrays.
Thanks.
File Reading, Data, And Other Assorted Stuffs
***DISCLAIMER
Okay, before any of you rag on me if this is a stupid question, please remember the following equation.
ME = NEWBIE.
Thank you
***
I'm a programmer in other languages, and I'm wondering if Flash is what I should be looking at for the following functions. I'm looking forward to learning another language again, but I'd also be appreciative if anyones able to give me a sample code or walkthrough for the following.
I'd like to be able to have Flash read a simple text file of data, and, based on that data, place graphics at different places on the screen.
For example, to have Flash create a background picture in the middle of the screen, a file is opened, a statement along the lines of X = 23, Y= 14 is read, and Flash places a graphic (Symbol, I believe it's called in Flash?) in the appropriate position on the background.
Until I'm proficient enough to create an entire environment out of Flash, I'd be using this to accent a PERL-scripted CGI environment. In other words, people would be using regular HTML menus for making selections, the PERL processes the information and writes it to file, and the Flash reads it and displays what's appropriate. (No objection, at least for the moment, for the flash having to reload on each page.)
Am I being clear enough? I've been told sometimes I'm not the most comprehensible person around, and that sure sounds like a lot to handle, at least to me
Thanks in advance to anyone who replies with information here, and even an opinion on whether or not Flash is ideal for this situation.
Tips On Reading Data Into Flash From An Xml File Please?
hi guys
I'm reading in nodes from an xml file into flash.
A node can consist of html code and various subnodes
here is an example
<fulltext>
<p>once upon a time there was a
<b>bear</b></p><smallimage>bear.jpg</smallimage>
<p>this bear was <i>huge</i></p>
</fulltext>
I need to read this data into flash and then make it editable, in a visible format.
Can anyone give me a few tips on how to read in this data into textfields.
Particular problems i'm having include once i've read in the node above for example, how do i display the text in a textarea with the html code working e.g. showing bold, and how do i extract out the <smallimage> node and run a loadMovie command to display the .jpeg.
Any suggestions, tips and ideas would be really appreciated :-)
Many thanks for any responses.
Tips On Reading Data Into Flash From An Xml File Please?
hi guys
I'm reading in nodes from an xml file into flash.
A node can consist of html code and various subnodes
here is an example
<fulltext>
<p>once upon a time there was a
<b>bear</b></p><smallimage>bear.jpg</smallimage>
<p>this bear was <i>huge</i></p>
</fulltext>
I need to read this data into flash and then make it editable, in a visible format.
Can anyone give me a few tips on how to read in this data into textfields.
Particular problems i'm having include once i've read in the node above for example, how do i display the text in a textarea with the html code working e.g. showing bold, and how do i extract out the <smallimage> node and run a loadMovie command to display the .jpeg.
Any suggestions, tips and ideas would be really appreciated :-)
Many thanks for any responses.
Reading Data From An ASP File Into Flash On Startup
Hi.
I am currently trying to create a Flash program which displays the status of various systems connected to my main server. The status is kept in a database which I update manually, when required. Now, I have created an ASP file which queries the database for the most recent entry of each system and returns a set of variables in the GET request back to Flash. I know that the ASP file works however, since when I output the data to the resulting HTML, all the information is there and the query was successful. The problem I am having is that the Flash file which uses the following code does not load the variables from the ASP file.
CODE//recive the variables from the ASP file using the GET method.
this.loadVariables("sCData.asp","", vars=GET);
system1Status = "";
system2Status = "";
// etc...
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
Reading XML Data Into Dynamic Text Object
XML ... <Quesiton>This is a long line of text coming in from the XML file.</Question>
I have a XML file that I read in a long line of text. I have tried to format the information string with a line break. Have tried using <br /> and setting the text as htmlText and that does work except there is a blank line between the sentances. Tried using the
and setting the text object to just text but that brings in the
into the string of text.
Any suggestions how to make the text coming in have a line break?
Reading External Text File Into Movie Text Boxes
So I'm trying to read a simple text file into an array and then putting that text into the dynamic text boxes of 6 movie clips
the MC are instances of 'CategoryBox'. Each instance is name cat1, cat 2, so on.
In the parent movie file the dynamic text box instance is called 'catText' and variable 'catText'.
Code:
// load the text file for Titles Questions
this.loadVariables("title.txt");
//Lets get the game going
this.onEnterFrame = function(){
//Titles loads? FIRE!
if(titles!=null &&titleArray==null){
titleArray = titles.split(";"); //makes new_ARRAY into an array having values of strings separated by a semicolon
trace (titleArray);
//title generations
for (z = 0; z < titleArray.length; z++) {
this.cat[z].catText = titleArray[z];
}
}
}
now trace shows the titleArray is getting it's goods, but the text in the clips is "_level0.cat2.catText"
text files reads as such:
titles=blah;blah; so on
Reading Text File
I am able to read a text file using actionscripting in a Flash 5 movie. I am looping the movie so it will continuously check the text file to see if it has been updated. This file will actually be updated about 10 to 15 times an hour and I need to be able to display the updates to people who keep the browser window open. Netscape loads the new text file everytime it loops, meaning that the browser displays the updated text file info when the file is changed. Internet Explorer - on the other hand - never shows the updated text file.
Any ideas how to get IE5 to check for the updated text file in a Flash movie and automatically display the changes?
Thanks a million for any ideas you may have!
Reading A Text File
In order to keep my swf files down as low as possible (for low bandwidth users), is it possible to load or "read" text or html files into a swf?
Thanks.
Reading From A Text File
i have the file tickerheads.txt placed in the C:
It reads as follows
-----
item1=This is the first item of news 2002
item2=This is the second item of news 2002
item3=This is the third item of news 2002
item4=This is the fourth item of news 2002
item5=This is the fifth item of news 2002
-----
When I run my movie with the following actions attached to it and all the relevant dynamic text boxes with their variables named as above with the following line-
loadVariablesNum("C:\tickerheads.txt", 0);
---
The movie runs and yet the text doesnt load into the boxes! Anyone any ideas?
Thanks
Reading From Text File
Dear Friends
I want flash to read from a text file, so i did it, and it read from the text file, but when i published the movie, i found that flash had taken the text from the text file and included it in flash, i need flash to always read from that text file, so that when i change the text file, the new information automatically comes to flash. How to do that?
Thanks
Help With Reading Through Text File
I have a MC called BioInfo and my text files are in side it. What I'm trying to do is read through the txt file and display the variables accordingly. For example,
name1=Jim&title1=Suprv&text1=blablablah...name2=Ri ck&title2=Manaager&text2=blablablah...name3=Bob&ti tle3=Flunky&text3=blablablah...
now I have some code I found that I want to use on a button, but I'm sure I am missing some and would really like to get it working. I would appreciate any help.
Code:
on(release){
BioInfo.name.text = eval("name"+i);
BioInfo.title.text = eval("title"+i);
BioInfo.city.text = eval("city"+i);
BioInfo.state.text = eval("state" +i);
BioInfo.scroller.text = eval("text"+i);
BioInfo.BioPic.Image = eval("BioPic + i")
i++
}
Reading Text From A File
Hrm, since nobody seems to be able to tell me how to make a dynamic panel...
Is there a way for Actionscript to parse text from a file? =D
Thanks!
Reading From A Text File
Hi,
I've got a movieclip called : nmc, nmc is in another movie clip called wwptcmc. wwptcmc is on the main stage with an instance name of wwptc.
In the movie clip nmc there is a dynamic text box, where shoud I put the code to read the text file : loadVariablesNum("users.txt", 0);
Should it be on the main stage or should it be in nmc. the dynamic textbox has the var set to userlist.
The text file is in the following format :
userlist=jht sam master
Thank you
Reading Text From A .txt File
I want to use a .txt or .htm file to hold text for a flash project. Does anyone know how to set up a text box to grab the text from a file and insert it into the text box?
Reading In Text From File Into Swf
Hello first time poster here,
I just started working with flash about a month ago and i'm creating the flash for a webpage at this internship im working at. One of the sections i have to make is a "Whats New" a section that gets frequently updated, but once I am gone, the other workers are going to have to update this themselves and don't want to mess w/ the flash.
i figured the easiest way for them to update is to edit a simple text file w/ html. so basically the question is how do i read text from an external file into the swf? I know there is a way to do this (i've seen other flash pages w/ calendars etc ) but i have no idea where to start with this implementation, can someone help me out? thanks in advance!
Reading From A Text File
Hi all,
As you can see I am new to this forum. I have recently been getting into Flash, and would class myself as an beginner/intermediate.
I need to create a presentation that runs at the reception area of my workplace (fair enough). However, one of the requirements is that the receptionist can enter weather details into a text file which my flash presentation will read, and output things based on this text file.
For example, she would put in the next 5 days weather like
monday, 24C, Sunny
tuesday, 17C, Cloudy
etc
Then my presentation would read this file and display the day, temperature and a picture of a Sun or a Cloud etc. And if she forgot to put anything in the text file it wouldnt mess anything up, it just wouldnt display anything.
I have searched a few sites, and scanned through all the tutorials on this site, but i cant find anything that could help me to learn how to do this..
Any ideas or pointers?
Reading Text From A File
Hi,
I am going through the tutorial found in here
The spinning text effect draws the string from the variable inputString
code: inputString = "some text to be animated";
I want to load the string from a text file instead, how do I do that?
I tried loading my text file by adding the code below:
code: loadVariablesNum("data.txt", 0);
where data.txt is the text file containing the string I want to animate,
but the movie just came up with a blank screen.
Please help. Thanks.
Melissa
Reading From A Text File
Hi,
I've used the shared concept to read and write to files, but I really need to know how to read from an ordinary text file.
mySO = SharedObject.getLocal("filedata");
for (a in mySO.data) trace(a+": "+mySO.data[a]+" printing");
This code only recognizes data that's written to the file using sharedObjects.
Anybody, please......is there a way to read pure string or numeric data from a text file (a text file whose path I specify, rather than look it up in some bizzare temporary folder of flash)
Please help me with this.....I need this functionality badly...
Thanks
Help With Reading A Text File
hi there . im quite new to actionscript , and im not really sure where to start on this script.
what i want to do is read a line in a text file and split the varibles and put them in to a grid ( listview ect )
example textfile ::
example artist1|example album1|example details1
example artist2|example album2|example details2
example artist3|example album3|example details3
-----------------------------------------------------
so the string seperator is |
any example scripts to get me started would be great
thanks
luke
Reading A Text File
Hi
I am new to actionscript, but I know C,C++ some Java, Javascript ASP, PHP.
Since I have learned many different programming languages in the past I have not a little list of short programs I want to be able to in any language ( I have discovered these programs are a good basis to start).
List Item Read a text File:
OK I have read the book(s) and I am afraid too late saw your tutorial when I had already got that far with the usual blood and tears.
I can read a a text file and pop one record of 4 field of data onto a Flash form - but my file has more records and I only see the last one reported.
It looks like actionscript does not deal in records as return/enter is just passed as data.
This is my text file:
&Name=Pat Proggie&Email=pat@hotmail.com&Header=About this 'er Flash feedback form&Msg=This Flash feedback form is the bees knees&
&Name=Andy Handy&Email=andyHandy@yahoo.com&Header=Your site stinks&Msg=Your site stinks carry on I like it!&
&Name=Able Cable&Email=able@cabel.net&Header=Great Site&Msg=Tell me more.&
The Code:
//-------------------------------------------------
// I expect to read a text file called
// "feedbackFile.txt" and place data fields into
// the display form "Reporting Text from a File
// this code only displays the last record
// so only 1 record on this file
// would be OK for input variables like rates/discount values
//
feedback_lv = new LoadVars();
feedback_lv.onLoad= onText;
feedback_lv.load("feedbackFile.txt");
var sometext = feedback_lv.toString();
//
function onText()
{
name_txt.text = feedback_lv.Name;
email_txt.text = feedback_lv.Email;
header_txt.text = feedback_lv.Header;
msg_txt.text = feedback_lv.Msg;
}
Code/form view/notepadview in pdf attachment called "The File"
Reading Text File
Please see whats wrong with this code:
Code:
onLoad=function()
{
my_text=new LoadVars()
my_text.load("C:\Documents and Settings\Wrkspace\Desktop\flash_wordlist.txt");
my_wordlist="";
}
my_text.onLoad=function(success)
{
if(success)
{
my_wordlist=(this.var_wordlist).split(" ");
trace(my_wordlist)
}
}
the trace dosent showup at all....by the way, this is in the first frame of the timeline, and i am trying to load a wordlist and then use the words in my program separately.
Is it because flash loads the text file slowly? and what is the solution to what i am trying to do?
PS: I am using flas8, as2
Reading A Url From Text File
Hi
I have a url in a text file which I would like to read as the source file for my flv playback component. I am not sure how this is done, can anyone help?
thanks
Is There Anyway To Read Data In From A Text File And Populate An Array With The Data?
hello,
i'm new to flash, and i'm trying to create a photo gallery. however, the photos may not always be the same, and i need to have a way to easily change the pictures without having to go back into flash to change the code everytime. i thought a good way to do this would be to read the names of the pictures in from a text file and then use those names to populate an array, similar to the tutorial on creating a photo gallery on kirupa.com. the problem is, i have no idea how to do this. anyone have any ideas?
thanks
Is There Anyway To Read Data In From A Text File And Populate An Array With The Data?
hello,
i'm new to flash, and i'm trying to create a photo gallery. however, the photos may not always be the same, and i need to have a way to easily change the pictures without having to go back into flash to change the code everytime. i thought a good way to do this would be to read the names of the pictures in from a text file and then use those names to populate an array, similar to the tutorial on creating a photo gallery on kirupa.com. the problem is, i have no idea how to do this. anyone have any ideas?
thanks
Reading Text From A Text File & Assigning It To A Variable
Plzz tell me how to read text from a text file & assign it to a variable.The actual thing i need to do it is that the text file contains a value & i have to get that value & according to it i have to change the color of the background.for eg if the text file contains a no below 10 then the bg color should be blue & if it is above 10 it shud be some other color( the text file contains only one value).
plz help me in this regard.this is urgent
luv
Andrew
Reading A Text File From Flash 5?
Hi folks.
I'm trying to find a way to read the contents of a text file into Flash. I checked out the LoadVariables(), but that is not quite gonna do it. Here is what I'd like to do:
Create a basic page-turner in Flash that displays each block of text from a "--" delimited text file on page turns.
Here is a sample of the text file:
page 1 text
--
page 2 text
--
page 3 text
I'd like to read in the whole contents of the text file on launch of the Flash file, then use subStr() to strip out and display each pages text as the user clicks the next button (there will be alot of pages...possibly up to 100). I'd like to build a "player engine" that I can reuse as to not rebuild the thing each time I need to create a new one.
Any way to do this? I used to use ReadExtFile() in Authorware and strip out each line using the page # as the parameters to obtain the correct line # from the text files contents...I'm lost on this one...Flash has got to do this, eh?
Thanks in advance for all your help.
.:::::: READING A TEXT FILE PROBLEM ::::::.
Problem!
I want to read in a whole text file but not as name value pairs but as straight text. Any ideas on how this can be done??
http://www.infoco.com.au
Thinking outside the circle
Reading From External Text File
Hello,
I'm having problems with reading from external text files. The text files are in fact help files that a user of my flash movie can read if he/she clicks the 'help'-button in my movie. At home, on my own pc everything works ok but when I saved the files on a server, seems that sometimes some variables are not read.
Here is the code for the help-button
on (release) {
loadVarsText = new loadVars();
loadVarsText.load("Help"+nHelp+".txt");
loadVarsText.onLoad = function (succes){
if (succes) {
setProperty("Help",_visible,true);
Help.Titel.text = unescape(this.Titel);
Help.Info.text = unescape(this.Info);
gotoAndPlay(2); // Play transition effect
}
}
}
nHelp is a global variable that sets de number of the help-file that should be read. f.e. nHelp = 2 ==> read the contents of Help2.txt.
the lay-out of my Help2.txt file is
&Titel=iVal 1.0 - Login
&Info=Om iVal te gebruiken, moet je jezelf aanloggen aan het systeem. De leerling moet een gebruikersnaam en paswoord ingeven. Op onze school gebruiken wij een systeem als volgt:
Gebruiker: 4F01
Paswoord : 4F01
Now if I test this on the internet-server, the title field is not displayed, the Info-field works ok. At home, on my local hard drive, bith title and Info-fields are displayed as it should be.
What am I doing wrong? Kan anyone help me pls.
Thx in advance.
P.S. I noticed a similar problem with the use of a PHP-script on reading from an external text file. Seems not all data is read in time into the flash-file? Can this be the cause of my troubles and how should I work around this problem?
Reading A Text File Problems
Hi,
I am using Flash 5 to read in a text file full of questions for an interactive quiz.
I use a variable at the end of the text file which the Flash movie checks for in a loop on the first 3 frames of the movie. Only when it finds a value for this variable will the Flash movie proceed and display the questions. This works fine most of the time.
However occasionaly it doesnt work and the movie proceeds to a page full of blank questions.
Now Im pretty sure the actionscript in the flash movie is OK. The occurance seems to coincide loosely with the first time the browser accesses the movie, although this is by no means always the case. Hitting F5 will always load the questions if they dont load fisrt time.
My question is has anyone else encountered this problem? ... I cant for the life of me work out why its happening.
Thanks ...
thesquirrel
Reading Content From A Text File?
I was wondering how to read content from a text file? I have some collegues that are very Flash Affraid, but like the Flash designed sites. Does any have a sample site which has the content read from text files?
Thanks,
Reading Javascript From A Text File
Not exactly working with Flash but trying to modify a text file that Flash reads in. Currently reading in HTML embedded in a text file. I tried to insert some simple javascript to create a sized pop-up window from the anchor link that is rendered in a Flash window but it was seemingly unrecognized by Flash. The original anchor tags were OK until I inserted javascript. I've also searched around for a bit for an answer without success. Help??
Cheers!
Problems Reading Text File
So here's the deal. I'm making a chronological timeline with Flash MX which receives info from a text file and moves a movie clip to its position depending on its day, month, and year. On the first frame of the root level I have:
code: function yearPosition(month) {
if (month == "feb") {
addDay = 31;
} else if (month == "mar") {
addDay = 59;
} else if (month == "apr") {
addDay = 90;
} else if (month == "may") {
addDay = 120;
} else if (month == "jun") {
addDay = 151;
} else if (month == "jul") {
addDay = 181;
} else if (month == "aug") {
addDay = 212;
} else if (month == "sep") {
addDay = 243;
} else if (month == "oct") {
addDay = 273;
} else if (month == "nov") {
addDay = 304;
} else if (month == "dec") {
addDay = 334;
} else {
addDay = 0;
}
return addDay;
}
loadVariablesNum("info.txt",0);
When called upon, yearPosition will adjust the movie clip's x-position depending on its month. Each variable in the text file is named &entries, &day1, &day2, &year1, &year2, etc.
In the next frame, on the root level, i have:
code:
for(i=1, i<=entries, i++)
data.duplicateMovieClip("data"+i,i)
This duplicates the movie clip for however many entries there are in the entries variable. One of the problems is that the variable "entries" isn't identified as a number. I tried parseInt(entries) and Number(entries) to try to convert it, but neither of those work either.
The movie clip that gets duplicated is assigned a unique number "i" and looks for its corresponding data from the text file.
code:
onClipEvent(load) {
day = _root["day"+i];
month = _root["month"+i];
year = _root["year"+i];
addDay = _root.yearPosition(month);
day += addDay;
this._x += ((parseInt(year) - 1816)*182.5) + parseInt(day);
this.date = _root["date"+i];
this.event = _root["event"+i];
}
When this movie clip calls on the function yearPosition, it's supposed to input the month that it's assigned to. But for some reason the function doesn't recognize the month that's input. Also, I can't do mathematical operations with the variables from the text file. I tried to convert them to numbers with parseInt() and Number() but they still won't work.
I know this is a lot of problems and a lot to read but I'd greatly appreciate someone's help on this. Thank you.
[F8] Reading String From Text File
I have a string inside my text file.
Code:
var_strng=www.something.search?=query&nav=2
When I try to read the above set of string from my flash file(using LoadVars), the string stored in var_strng is broken into 2 parts and only the first part(ie.,)
Code:
www.something.search?=query
is alone read and the remaining part(that comes after '&' is omitted). How do i read the whole string? i also tried putting the whole set inside " ". Did not work
I thought of using split("&"), but there is a problem. The content inside the text file is subjected to changes. so it can have any number of links appended repeatedly and that means the text that contains var_strng (for now), can also be appended with var_strng1, var_strng2....... etc., each seperated by '&'. So using a split function doesnt help
Number In Text File Not Reading
Hi y'all,
it should work, but it does not.Declare the variables:
Code:
var limit:LoadVars= new LoadVars();
var winnings:Number=0;
And in the body:
Code:
winnings=parseInt(limit);
limit.load("craps_limit.txt", GET);
The text file contains a number and nothing else. The result is NaN.
All searched threads say this should work; I tried nesting the winnings in a function, to wit:
Code:
limit.onLoad=function() {
winnings=parseInt(limit);
} etc
Help is appreciated.
Not Reading A Number In A Text File
Hi everyone,
this should work, so of course it doesn't. Declare the variables:
ActionScript Code:
var limit:LoadVars= new LoadVars();
var winnings:Number=0;
var newlimit:String="";
And then the code
ActionScript Code:
limit.onLoad = function() {
winnings=parseInt(limit.newlimit);
}
limit.load("craps_limit.txt", GET);
It should say 100, but it reads 0. The text file says only:
&newlimit=100
Well, help is appreciated.
Reading A Text File And Modifying It.
Ok I am new to all of this so bare with me.
I have a text file that contains news, it it in the same directory and works great here> http://www.mattladner.com/lbsd/home.php
so the site admin takes it and writes a cgi script to modify it so more news can be added and now nothing is showing up? here> http://www.lbsd.k12.ms.us/~working/
any ideas?
Reading In Text File Question...
I have a bunch of X Y values in a text file. I want to read each one and draw them to a movie. Basically like a line graph. I've been reading about loadVars however it seems that the text file has to be in a special format.
The text file I'm dealing with just looks like.
1 3
2 45
3 42
4 1
5 39
etc etc.
I want to load this in and then loop through it line by line to extract the numbers into X,Y coords and draw connecting lines.
Could someone help me get started with this.
Cheers
Robert
Reading In An Array From A Text File
I'm trying to use a text file to load in some configuratin data (using actionscript 3) I have it working ok for simple stuff like gamename=Chess&gamescore=100 , etc... but some of the data needs to be in an array. Can someone please point me in the right direction to how I can read in an array from a text file?
Thanks!
Reading Link/ URL From Text File
Hi, I am new to flash Action scripts.
Is there way to dynamicaly use the URL reference (File Link path ) from a external text file on any button events, ?
Plz let me know if flash support this dynamic code linking at run time...
Thanks
Saliq
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.
Reading Html From A Text File?
Hi
I've read somewhere that html can be displayed in dynamic text fields in a movie. So I want to ask is how can I read html stored in a text file & display that html as it would appear in any browser.
can any one help??
Reading Variable From Text File
Hello,
I am communicating with a database through flash and an asp page. I query the database and output a variable to a text file. For some reason I CANNOT read the variable from the text file. I've done this before and it has worked fine, but I'm not getting anything now. The text file reads "energy=5000", but the energy variable in flash does not get set to this value.
I am trying to use
loadVariablesNum ("C:energy.txt", 0);
if I use
loadVariablesNum ("energy.txt", 0);
I get
Error opening URL "file:///C|/Inetpub/wwwroot/energy.txt"
Why does it add all that stuff to the path? Which way should the slashes go?
please help!
How do I do this properly? I've made sure that there the text files are there and they are not Read Only.
Thanks,
Emily
Help.. CreateTextField And Reading A Text File
hi,
i have a movieclip and it's action creates a textfield:
onClipEvent(load) {
this.createTextField("words", 1, 0, 0, 400, 300); //words.autosize = "left";
words.type = "dynamic";
words.multiline = true;
words.wordWrap = true;
words.border = true;
words.background = false;
words.html = false;
words.embedFonts = false;
formatStyle = new TextFormat();
formatStyle.color = 0xff0000;
formatStyle.font = "Verdana";
formatStyle.size = 10;
formatStyle.textColor = 0x000000;
//words.text = "This is a test of the emergency broadcasting system."
words.setTextFormat(formatStyle);
}
i want to read a text file in my created text field, words. i am confused as to where to place the loadVariables("words.txt", words);
i tried doing words.text = this.loadVariables("words.txt", words); inside the clip load event.. i tried placing it at the beginning before creating the text field, and after creating the text field.. under formatStyle... those didn't work.
any help would be appreciated. thanks. my text file is in the same directory as the .fla
Reading Passwords From Text File
I am trying to write an Action script that will read a single password from a text file(obviously i want to read more than one later on) it will be made a little simpler because there is no login just a password any help would be greatly appreciated.
|