Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Recognizing Valid Text File Variables



what i'm trying to do is be able to allow a user to specify a text file containing variables through an input box, and flash be able to default to variables if the text file is not found. for instance, if a user input "file.txt", and there was no such file, then flash could display a 'file not found' or whatever. what i currently have on a button
is similar to this:

on(release){
filename = inputBox;
input = (inputBox + ".txt");
if(input == ".txt"){
var1 = x;
var2 = x2;
var3 = x3;
gotoAndPlay("wherever");
}else{
_root.loadVariables(input, _root);

gotoAndPlay("wherever");
}
}

i basically need a: if (file != true) kinda thing.

thanks in advance



FlashKit > Flash Help > Flash ActionScript
Posted on: 03-12-2002, 07:22 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Recognizing Valid Text File Variables
what i'm trying to do is be able to allow a user to specify a text file containing variables through an input box, and flash be able to default to variables if the text file is not found. for instance, if a user input "file.txt", and there was no such file, then flash could display a 'file not found' or whatever. what i currently have on a button
is similar to this:

on(release){
    filename = inputBox;
    input = (inputBox + ".txt");
    if(input == ".txt"){
        var1 = x;
        var2 = x2;
        var3 = x3;
        gotoAndPlay("wherever");
    }else{
        _root.loadVariables(input, _root);

        gotoAndPlay("wherever");
    }
}

i basically need a:   if (file != true)    kinda thing.

thanks in advance

Recognizing Variables
I've been trying to get a conditional script to recognize the appropriate variable to follow in the script. Would their be an error in the syntax or in setting the variable vaolues that would prevent the script from being understood.

The script seems to be skipping the first questions variable altogether. Please help straighten me out.

Recognizing Variables
When I load variables from a text file into my Flash movie, it works properly. But when I try to set up "If" conditions based upon the variables, it fails to read them correctly and I have to manually type the variables in.
Is there any way to fix this? All help is much appreciated.

Recognizing Imported Variables
Hi all,
I've got a list of links that are imported from a text file via php.
The text file is formatted like this / &_level0.text1=Flashkit&_level0.link1=www.flashkit .com& /

It loads into the flash movie just fine and I can see that it is loaded because the dynamic text fields "text1" and "link1" display the proper text.

I use this code to import the names and urls of the links.

loadVariables(pathToLinksData+"?cacheKiller="+getT imer(), this, "POST");
I pass a variable at the end of the text file like this > /:Status="Done" < and in the fla there is a Dynamic text field called /:Status with the instance name StatusInstance.text (that's the only way so far that I can get flash to recognize that there is something in it).

My problem is counting them. If I manually enter the text in the fla it works fine, but If I import the values, flash thinks the value of "_level0.link1" is null or empty.

Here is the count code. It's a function.

if (StatusInstance.text == "Done") {
linkcount = 1;
countLinks();
}
function countLinks() {
while (linkcount>0) {
templink = eval ("_level0.link"+linkcount);
if (templink==null) {
/:total = linkcount-1;
break;
}
linkcount++;
}
}

Again, this works great if the variable values are not imported. I need it to work with variables and values dynamically loaded but flash can't see that "_level0.link1" is NOT empty.

whew. I dunno.

Loading And Recognizing Variables
Something is wrong here. But I don't know what.

I'm loading a text file like this

this.loadVariables("vis.txt");

the contents of the file will ultimately be many variables that will change but for now it is:

&Vis=1

I have a movie on the main timeline with Instance name: Vvisible1

then the code on frame 12 is:

if (Vis = 1) {
with (Vvisible1) {
gotoAndStop("on");
}
} else {
with (Vvisible1) {
gotoAndStop("off");
}
}

I change the variable in the text file and it doesn't change the frame to off. It's always on.

Please help.

Page 2 - Recognizing Variables
i hate to ask, but do you think you could zip your 'bare bones' .fla and .txt files and upload it? it's prolly easier to understand what's going on (for me)... and btw:

in your text file it should be :

&boo=carnival

that should work.. but like i said. upload if you could

thanks,

bret

Setting And Recognizing Variables Internally
I hope I explain this coherently... a little new to Flash.

I have a movie, within that movie I have a frame action that says

if(var=="1"){
gotoNextFrame();
}

in another movie that is a child of that movie, I set var="1" based on a rollOver. Problem is that it doesn't seem that var is getting picked up back in the parent movie. I tried _root.var="1" and _parent.var="1" to no avail.

are variables scoped to the movie that sets them? Is there a way to make a variable global?

I think there is something pretty basic here that I am missing.

any advice is appreciated.

Not Recognizing XML File
I have a page that rotates through a series of static graphics with an animated sequence between each static image. I did not design this and am now having to make a duplicate copy of this with new colors in the animation and a different XML file to draw the images and titles from. You can see the working version here:

Working Version

I have gone into the action script where the XML file name is specified. I have changed the name to the new XML file name. I re-export the swf file and despite the XML file being in the same location as the original XML file, this simple change seems to break the animation and it freezes just before putting up the first information from the new XML file.

Non-Working Version

Actionscript is not my strong suit. I have gone through and compared the code and I can't find anything that would explain this problem. If anyone has any pointers on what might be causing this, I would be extremely greatful to hear from you.

Regards,
Andy

Recognizing An Updated Flash File?
I'm having a problem. Everytime I update my .swf file and upload it to my server (overriding the previous .swf file) when I go back to the web page, it doesn't recognize that an updated .swf file (with the same name) is there. It will instead show the outdated version one till I delete my history and cookies, etc. Is there a way to do this so that when people load the site, they see the latest version? I use a preloader as well.

Any help would be great, thanks!

Importing Png, But Not Recognizing File Name And Edit In Fireworks
Has anyone had trouble importing png's into library. Sometimes when I do, they just get listed as "bitmap 2" instead of the file name. When it does this, I can't click and "edit in fireworks."

Am I doing something wrong?

thx.

Load Variables From Text Then Loading Image File With The Filename Given In Text File
The problem is, that i need flash to load variable from text file, eg: info.txt, with image=gt.jpg in it.
Then I want flash movie to load a gt.jpg into a blank movie.
The point is that after i change filename in txt file, i want movie to load that img.

I wrote AS:
loadVariablesNum("info.txt", 0);
loadMovieNum(image, 0);

but it's not working
After i traced variable image, debugger showed that this variable undefined, but if i put textbox with image as variable, it shows "gt.jpg".

Please help

Recognizing Input Text
i have a game that ive made...... and there are multiples levels.
on the bigging screen i have an input text box with a button beside it . i want it so that when you put in the right password and click the button beside it.. it will go to a certain level(scene).
anyone know what i could do?

thanks
-striker

Loading Variables From Text File. ( Not Fixed Variables )
i would like to know how to make my Flash werbby load variables like this automatically everytime i load my flash webby

(this is contained inside a text file) example:

&news[15462]=hello&
&news[14890]=uuuuuuuuuuuh :P&

but i won't be using fixed numbers. these numbers will be randonmize. but how do i tell my textfield to load allll variables that contain the word "news" and a value (number) ? or is there any other ways of doing this?
[Edited by xanbarian on 07-08-2002 at 12:56 AM]

Assigning Dynamic Text File Variables To Variables
Ok so I know exactly how to load variables from a text file and catching these variables in a dynamic textbox to show there string content. But I wanted to work with the string in the passed variable (ie from txt file) BEFORE I display the text in the dymnic text box. I seem to be having trouble assigning the passed .txt file variable to a newly created variable in my movie, it keeps saying "Undefined" when I run a trace().

<code>
//The contents of the text file looks like this
&textxxx=This is the text withing the text variabale

//1st frame, layer 2 in main
loadVariables("text.txt", _root)

//1st frame, layer 1 (below layer 2)
_root.strText = _root.textxxx

</code>

->So why does it say strText "Undefined" !? Does flash not allow variables to be assigned to variables?

If you help that would be fantastic

Comparing Variables To Variables In A Text File
I am trying to make a login in flash and I would like to have a txt file with user names and one with passwords or have one file with both. When they click submit it will see if the user name and password they entered are in the text file if they are it will do one thing and if they are not it does another.

Mult Text Variables From One Text File?
i'm making a calendar that - at this time - loads 30 text files to fill in each day's information.

i'd like each of these text variables (days) to load text all from one .txt file.

is that possible?

Loading Text Variables From A Text File
Well Im quite new to Loading text variables and creating a way for our clients to easily add news and update a "news" textfield, and I would appreciate it if someone could provide some samples or sample ActionScripting coding & a brief description of how-to do it, thnx its greatly appreciated.

Links to a good Flash MX tutorial on this would be also great.

Variables From Text File
Hello, can somebody help me please,
I've a problem with importing variables frome a text file.
without using scripts like PHP,ASP,.. because i've no webserver, just using FLASH 5, dreamweaver
i've a text file called : variablelist.txt, where i've stored some variables for a password and loginID, so i can give access to the site for some people
in the txtfile :
clientID-001=AAAAA
&clientID-002=BBBBB
&clientID-003=CCCCC
&password-001=11111
&password-002=22222
&password-003=33333

in the movi :
at the frame where the user can put his loginID and password in the dynamic input field with variables : user2 and pass2 i've put the action :

loadVariables ("http://www.iddea.com/05_txt/variablelist.txt", "");


at the enter button in the same frame i've

on (release) {
if (user2 add pass2 eq clientID-001 add password-001) {
aanspreking = "goodmorning naam1";
gotoAndPlay (50);
} else if (user2 add pass2 eq clientID-002 add password-002) {
aanspreking = "goodmorning naam2";
gotoAndPlay (50);
} else if (user2 add pass2 eq clientID-003 add password-003) {
aanspreking = "goodmorning naam3";
gotoAndPlay (50);
} } else {
gotoAndPlay (27);
}
}

but it seems that when i enter the password and userID that it won't work, can someone help me please

Variables In Text File Q's
I am having some trouble finding out how to put variables in a text file, take them from it, and how to set up the text file.

I do not know if there is any special way to set up a text file to put variables in it.

I basically know that you have to get the variables using the load variables action and put the name of the file in there(something.txt)

Can anyone explain this?

Text File Variables
Hi,

I have a flash movie with several dynamic text fields and would like to be able to load text from an external textfile with multible variables, so I don't have to have a text file for every text field in my movie but gather the whole load in one file.....is this possible and how?

Thanks for any help on this

Getting Variables From A Text File.
Friends,

A quick question that hopefully will only require a quick response.

1. I'm trying to load variables from a folder that is located on the same level as my Flash file. Example: "myFlaFile.swf" needs variables that are in the text file "Variable1.txt" within the folder "VariablesFolder" Both are on the same directory. How should the loadVar command read?

2. How can I put a whole bunch of variables, that'll be called at various times throughout a timeline, in one text file.

As always, thanks.

Layne Smith

How Using Variables From Text File
Hi,

i know how to read from a textfile, but it doensn't seem to work.
i want to load a picture in a mc, this works when i use loadmovie en give the path with the filename.
Now i want to keep the path, but want to use the filename as a variable. So all my pics are listed in a txt file. Can somebody please help me??
this is for my trainnee post and is due friday. I must make pictures scroll from left to right, with some text beside it, and when clicked on the little image, up comes a new browser window. And they want to easily add pictures and and text to it, so i want to use that textfile, but it isn't working.

pllleeeaaassssseeee help, I really underestamated it (sorry if my english doesn't do well)

thnx
bye

Variables From Text File
This is in the actions layer....

loadVariablesNum("copy.txt",0);

trace(cnum);


This is the copy.txt

opening=Watch here for instructions&
cname=Enter the client name here&
cnum=Enter the client number here&
fname=Enter your first name here&
lname=Enter you last name here

This is what i see "Undefined", why????

Getting The Variables From A Ext. Text File
I have never needed to do this, but the necessities keep comin up, so I think it's time to learn.

In my case(s), I need to be able to define a few variables in the text file, and have Flash extract them, and display only what the var's equal. For example, I have this:

Code:
&image1=something1&image2=something2&image3=something3

And I need Flash to extract the "something"'s from the variable (for ease sake we'll have Flash trace the values).

The desired output being:

Code:
something1
something2
something3


I hope I was coherent.

-Steve

Variables In Text File
i am loading variables from a text file. instead of having a new txt file for each one how can i have multiple ones in the same txt file?

i tried it like this:

var1=name; var2=address; etc but that sets var1 to name; var2=address; etc.....instead of having seperate variables.

does this make sense? how can i make it so that var1=name and var2=address etc....in the same txt file?

thanks,
gary

Variables From Text File
I know this is possible since I did it about 3 years ago, but being a High School student I did not think about saving files for the future. I can not remember how I did it.

I had a text file that had something like the following:

&name=John Doe &kind=Memory
&name=Jane Doe &kind=Honor


It went on and on for hundreds of names.

What I need to do is to be able to show a single line of the text and have a button to go to the next set of variables.

It would be something like this:

John Doe - Memory

Then click the "Next" button and it shows:

Jane Doe - Honor


Any ideas or suggestions?
Thanks in advance for the help.

Variables From Text File
I have a Flash movie that loads several variables from a text file and populates dynamic text boxes on the stage. When you click the Next button, the next round of variables from the text file populate the text boxes on the stage. This all works fine, the problem I'm having is when the variables from the text file run out, the user can keep clicking next and there's no text in the dynamic text boxes. What I want to happen is have the main timeline got to a label when the text runs out.

I tried having an empty MovieClip on stage with a clip event that detects when the first text box is empty, go to a certain, but this is not working :

onClipEvent (enterFrame) {
if (_root.firstname_1="") {
this.gotoAndPlay("start");
}
}

Any idea how to determine when the text variables run out?

Text File Variables
I'm probably being really stupid here but,
I need to access a variable brought in via a text file using LoadVariables
("MyText.txt",_root);

The variable name in my txt is key

I can output the contents of key to a textbox no problem.

But what I really want is to be able to put those contents into another variable. I've tried newKey = key; but I only seem to get undefined errors..

Any ideas!!!

Text File Variables
Hi
I have a variable which I am trying to load from a text file (which will become many). At the moment the text file reads &wa=5 which is fine.
I need this value '5' to cause the flash movie to gotoAndStop(5);
Through reading around on the internet I now have this a part which accesses the variable using

myLoadVars = new LoadVars();
myLoadVars.onLoad = function(success)

etc and then in the next frame on the movie i have

x = myLoadVars.wa;
trace(x);

which prints '5' to the output file. However, I can't seem to use either 'x' (or _root.x) or myLoadVars.wa for the 'if' statement that controls the movie clip.

Basically, what do I do to actually use this variable? I am quite new to this so it's is likely I'll get confused!!

Thanks

Saving Variables To A Text File
Is it possible to load a variable from a text file (know that part), change it inside movie (know that part too) and than save the changed variable to same file it is loaded from (this part is troubling me).
(Everything on local computer)

Save Variables To Text File
I have a presentation done in Flash. The user can go into a control panel like section in the presentation and can edit a lot of the various name values for the presentation so that the presentation can be customized. I want the variables that the user enters to be saved to a text file so that they can be loaded later. Does anyone have any ideas how to do this?

Get Variables From A Text/xml File On A Server
how do I pull variables from a text file residing on a seperate server/location into flash. I know how to do it if both files are in the same directory or computer, but how to do via URL?

Saving Variables To A Text File...
I have created a game, which loads the highscore FROM a text file, now I need to save them BACK TO THE FILE - how is this done?

Help me please...?

Saving Variables To A Text File
Hi!
Is there any way that you can save user input variables to a text file on your hard drive in flash 5?

Loading Variables From Text File
I am wanting Flash to pull a variable from a Text file. I know how to bring a string into a dynamic text file, but I then want to set a condition within flash depending on what information has been pulled into the field.

Loading Variables From A Text File?
so my text file looks like:

var1=bob
&var2=cindy
&var3=sandy

but Flash can't properly evaluate the expression (var2 eq "cindy)" as true because the line break...

i really don't want to have my text file look like:

var1=bob&var2=cindy&var3=sandy

is there a way around that so I can keep the text file people friendly?


thanks in advance

HOW DO I IMPORT VARIABLES Through A Text File?
Hey folks, i need some help importing variables through a text file. All im trying to do (for test purposes), is to have a flash file, and a text file on my desktop, and get the flash file to load the text file and variables, and simply display them as dynamic text. I plan to later use this text in a pop up window i made in flash. But for now, thats ALL i need it to do(get flash to load the text file from my Desktop)! I tried it on my own..but nothing seems to work. I made a textfile called text.txt. In that file... I had the following variables:

&text = this is the text to display

is that the write syntax to have in a text file first of all?

from there...I made a keyframe in Flash, and added the following script:
loadVariables("text.txt","");

I then made a movie clip with a dynamic text box, and gave it the variable name myText. I made a separate layer for actions in that MC, and did the following:

myText =_root.text();

when i run the movie...all i get is a white screen? why doesnt the text load? what am i doing wrong! can SOMEBODY help me! Id really appreciate it. Im kinda new to actionscript..but if you could REALLY walk me through this id love that! thanks

-kern

Loading Variables From A Text File.
I'm trying to load a group of variables from a text file and then use those variables to set a status. My text file looks similary to this (it does not have any blank lines before the variables begin):

BPMBDailyStatus=2/21/02+5:10PM
&BPMBDailyAudit=2/21/02+5:30
&BPMBDailyComments=This+is+a+test+again.
&FLStatus=Red&ETOLStatus=Yellow&BPMBStatus=Blue
&BPMBDailyAtlas=2/21/02+5:20

However, when I import the variables some will have an "
" attached to the end, but others will not. Any suggestions?

Thanks,
Teancum

Loading Variables From A Text File
I'm wondering if it's possibile to load variables from a text file into an array, so that each variable in the text file is stored in a different array container? The number of variabled in the text file is unknown, but the variables names will be sequential (ie. ball1, ball2, ball3, ball4...). Thanks in advance.

Jim

Is It Possible To SAVE Variables Into A Text File?
Is it possible to SAVE variables into a text file? Rather than using PHP, PERL, ASP etc? It is for a game where i want to save highscores to be used simply on the desktop. Thanks!

James

Loading Variables To A Text File
Hello All,

Can we write variables to a text file from Flash without an HTML page? As we load variables from the text file in flash by

on (press) {
loadVariables("source.txt", "_wherever.text_box");
}


how can we do the opposite?

thanks

nixthinx

Loading Variables From A Text File
i am using flashMX (trying at least) to load name values pairs (such as name=ross) from a text file and for some thick reason it isn't working; well one works but no more do

i am creating dynamic text fields giving them a variable name (name for instance) and then using loadVariablesNum to link to the text file

is it a problem that i am using lots of name/value pairs or am i just doing it stupidly wrong? i am just updating my site using flashMX and need to update from a generator template

could people at least give me some links to decebt tutorials on the subject?

thanks

Counting The Variables In A Text File
Hi All

I am loading a text file in:

LoadVariablesNum ("research.txt",0);

this contains:

&research0txt= Research random text 1
&research1txt= Research random text 2
&research2txt= Research random text 3
&research3txt= Research random text 4

and Im doing the following on an action:

newtext = random(numResearch);
_root.results = eval("research"+newtext+"txt");
stop();

If i swap out numResearch with a number(3) it works but it does not seem to be reading the text file and giving a number back.

Please tell me where i'm going wrong.

Many thanks

Mark

Loading Variables From A Text File
Hi there.
So I am playing around with php, and I got to writing to a text file, and can read it back in to a point, then I get stuck...

This is where I started:

Text file looks like this:
Count = 5&Hat5=red&Weather5=rain&Shirt5=red
&Hat4=yellow&Weather4=sun&Shirt4=yellow
&Hat3=yellow&Weather3=sun&Shirt3=yellow
&Hat2=green&Weather2=rain&Shirt2=blue
&Hat1=blue&Weather1=rain&Shirt1=green

loadVariables('PhotoBook.txt', 'Photo0');
Q = Number(Count);
L = Q + 1;
labels = new Array();
for (n=0; n<L; n++) {
labels[n] = Photo0.Shirt2;
trace ("Shirt" + n + " = " + labels[n]);
}

it returns:

Shirt0 = blue

Shirt1 = blue

Shirt2 = blue

Shirt3 = blue

Shirt4 = blue

But I really want the values for Shirt1, Shirt 2, etc. So I try:





labels = new Array();
for (n=0; n<5; n++) {
labels[n] = Photo0.Shirt add n;
trace ("Shirt" + n + " = " + labels[n]);
}

This returns:

Shirt0 = _level0.Photo0.Shirt0
Shirt1 = _level0.Photo0.Shirt1
Shirt2 = _level0.Photo0.Shirt2
Shirt3 = _level0.Photo0.Shirt3
Shirt4 = _level0.Photo0.Shirt4


I cant figure out how to get the value of Shirt(n)
Any suggestions???

Thanks,
Patty

How To Load More Than One Variables From One Text File ....
hello again......


well friends i have another prob....


lets c .... i have a text file name myfile.txt and in it the variable mytxt=.... now i want to add more than one variables in that file....

like .... mytxt1=
mytxt2=
mytxt3=
mytxt4= and etc...


so how can i do that..... how can i close a variable and start other.... or how can i difrentiate them.. so that i can load them from different places.... or on diff events...

what if i have a mc of 20 frames... now i want to load the
mytxt1= on frame 5
mytxt2= on frame 10
mytxt3= on frame 15
mytxt4= on frame 20


but the prob is that ... i want to use only one txt file for that... :-


ANY SUGGESTIONS plz !!!

Help Loading Variables From Text File?
OK, I've gone to two sites (this and another) and both have not done CRAP for me. Here's two scripts i've gotten:


Code:
onClipEvent (load) {
this.loadVariables("myText.txt")
}
doesn't work, I receive error messages. then there's this one,


Code:
myNewLoadVars = new LoadVars();
myNewLoadVars.load("myText.txt");
myNewLoadVars.onLoad = function (success) {
if (success) {
myText.text = this.DTBVariable; //or .htmlText
} else {
myText.text = "error";
}
}
I have no damn clue how to set it up, I know this CAN'T be that hard - so can someone give me an IN DEPTH Action Scripting process on how to GET VARIABLES from an external text file?

Let...

MC = homeText
Dynamic Text Box Variable = homeText
Text File = homeText.txt

just to make it easier for me and possibly you.

Escaping Variables From Text File
I have this presentation that has loads of text fields in it. The contents of these text fields i am loading from an external text file, so they are all variables. The problem is some of the text has characters in it that need escaping like '&', '/' and '+'. now i have done a few tests and i can use the escape(variable_name) to fix this if i created the variable from within flash, but it doesn;t seem to work with any variables i bring in from this text file?? i've tried telling flash the variable is a string but that didn't help, I've also tried putting the variables in speach marks in the text files but it just displays these speak marks in the presentaion???


can any one help please?

Multible Variables In A Text File
can we have multiple variables defined in a textfile... i.e. only one text file to be loaded and we can refer to different variables defined in that text file only.

Load Variables From A Text File - Help
Using a text file to load variables into a movie. Loading in OK but can't do maths with them - I assume this is because they are a text string? Tried Number function and parseInt to convert them to numbers but neither seem to work. What am I doing wrong???

Loading variables with:
loadVariablesNum("blueballdata.txt", 0);
in main timeline frame 2

then trying to add positionx and positiony and display answer in text field (also use values to position a movieclip on the stage)

have tried
total = Number(positionx) + Number(positiony)
and the same syntax with parseInt.

Any help appreciated

Copyright © 2005-08 www.BigResource.com, All rights reserved