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




Converting An Number In A Text File To A Variable



I'm tried this a hundred ways, and can't seem to get it to work. I'm trying to get my flash file to read a number from an external text file (in form: &var0100=4&) and have the flash file go to a specific frame number based on this variable. This code works if I import it into a text file, but I can't get it to take what's in the text file and convert it to a variable. Here's my following code:


totalprojects = new LoadVars();
totalprojects.load("rmptext.txt");
totalprojects.onLoad = function(right) {
if (right) {
trace("done loading");
total.Number = this.var0100
if (Number(total) < 5) {
projectmovie.gotoAndStop(2);
}
else {
projectmovie.gotoAndStop(3);
}
}
else {
trace("not loaded");
}
};
stop();



FlashKit > Flash Help > Flash General Help
Posted on: 08-27-2005, 02:23 PM


View Complete Forum Thread with Replies

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

Plain Text File....no Variable....need To Read The Number In Text File
I have a CGI script that updates a text file.
It's just a numeric value 0,1,2,3, etc.

So there is no variablename in the text file.
It's just the number.

Can I read this number with Flash and return a boolean value?

If the number is 0-150 I want it go to one frame.
If the number is above 150 I want it to go to another frame.

Thanks in advance for the help.

Converting A Variable To A Number Value
I have loaded a variable from a text file into flash:

&opValue=24


In Flash I can't seem to use the value to change the opacity of a movie clip.

ActionScript Code:
opValue= this.opValue;
trace(opValue);
go._alpha=opValue;[


The problem is the trace value shows 24, just like in the loaded text file

but
go._alpha=opValue;
does not work. The alpha stays at 100

If I manually Change
go._alpha=24;
The Alpha Changes as it should.

Why won't
go.alpha=opValue;
change the alpha of the targeted movie clip with the variable number?

Is It Possible To Use A Number From A Variable In A Text File?
Hey guys I've got a question over something that should be simple but it's doin my head in cause It doesnt work!

I got a "for in" loop loading variables from a textfile, I want to get from it the number of items to display.

in the text file the variable "sectionitems" corresponds to a string, "8".

--> &sectionitems=2

but this doesnt work:

for(i=0;i<=sectionitems;i++) {

If I do that doesnt work as well, it makes as infinite loop

Number(sectionitems);


Code:
loadItems = new LoadVars();
loadItems.load("test.txt");
loadItems.onLoad = function() {
nitems = this.sectionitems;
test_tf.text = nitems;
trace("nitems = " + nitems);
for(i=0;i<=nitems;i++) {
trace(i);
}
}
this still makes an infinite loop !

how is it possible to use a number from a variable in a text file ?

Getting Number Variable From Txt File
I'm using the following chunk of code to read a txt file and try to get a number out of it.

loadVariablesNum ("tt_distance.txt", 0);

the .txt file contains one line - &distanceran=99

It reads in the number as an "undefined" data type I stuffed into the variable "distanceran".

Problem is, I cannot seem to set it to an integer or number type. I can see the variable fine (it's text, of course), display it, etc, but I just can't use it for any type of math function (attempts to convert it end up as NaN using parseFloat). It's driving me nuts.

Any help out there?

Getting A Number Variable From External File
I have an external text file with a variable called total and it equals 5
total=5

what i want it to do is limit the random number by that variable, but it keeps giving me an undefined. Any suggestions?


ActionScript Code:
cardLoad = new LoadVars();
cardLoad.onLoad = function(success) {
    if (success) {
        _global.cardTotal = this.total;
        randNum = Math.ceil(Math.random()*cardTotal);
        info = this["card"+randNum];
        textBody.text = info;
    }
};
cardLoad.load("cardInfo.txt");
stop();

Load A Variable:Number From A Php File?
i have been searching for hours, but nobody is doing anything as simple as me, and i can't seem to apply what i have learned to my own (stupid simple) situation...

i just want to define a variable in flash as a number collected from a php file. here's what i mean:

my flash movie needs to know how many files are in a folder:


Code:

var loadTotalTracks:LoadVars = new LoadVars();
loadTotalTracks.load("songCount.php",loadTotalTracks,"GET");
var totalTracks:Number = loadTotalTracks.songs;
// trace to see if i got it to work yet... NO!!!!
trace(totalTracks);



and i have a php file which is counting them:


PHP Code:





<?php
$files = @scandir('MP3S');
$songs = count($files) - 2;
echo $songs;
?>







at this point i have added a couple of things out of desperation that i don't think are supposed to be there, like "GET" - it's not a form - but i am lost. I have never done this before, and it stopped making sense about an hour ago.

help? i just need the damn number... that's all...

Trying To Use A Number Variable Captured From A Txt File Of Variables
Im trying to use a variable from a txt file to perform a simple for function, but i think it wont acknowledge it as an integer value


Code:
system.useCodePage = true;
var artistas:Array = new Array();
var nimages:Array = new Array();
tvfVars = new LoadVars();
tvfVars.load("http://www.caiaffa.com/Showcase/Galeria/galeria.tvf");
tvfVars.onLoad = function(success){
if(success){
_root.maxCount = this.at;
for(i=1; i<=this.at; i++){
artistas[i] = this["a" + i];
nimages[i] = this["nI" + i];
};
var atotal:Array = new Array();
trace(nimages[3]);'i need to use this integer value in the "for" function below'
for (var z:Number=1; z<nimages[3]; z++) {'but it wont accept it as a number'
atotal[z - 1] = z;
};
trace(atotal);
};};´

Txt File Variable To Affect Movie-clip Frame Number
Confusing title, but hopefully a simple question. I have a text file called data.txt that holds an variable/integer on the first line. Currently all that's in the file is x=0

I'd like a flash movie clip called graph to follow the variable in the text file, so when the text file says x=1 the clip shows frame 1. When the txt shows x=2 the movie clip goes to frame 2 and so on.

The text file is written to by a separate asp page. All the files will be in the same directory. So I'm looking for the actionscript for this movie. Any help will be greatly appreciated!

Text Variable = Number, Changes To Frame?
Hey guys,

On the main movie timeline I've got two dynamic text boxes that show a numeric value that increases by +1 if a state is greater than another state (all works fine, no problem there). This is within a movieclip:

if (state > state2) {
/:value1 = /:value1 + 1;

My question is simply how do I make a gotoAndStop action if value1 is greater than or equal to say, 10?

eg if (value1 > 10) {
gotoAndStop(2);

I placed another movieclip on the main timeline with the following without success:

onClipEvent(load) {
if (_root.value1 == 7) {
gotoAndStop ("right");
} else if (_root.value2 == 7) {
gotoAndStop ("wrong");
}
}


Can't make it work.

Cheers.
[Edited by gatorage on 07-03-2002 at 01:36 AM]

Number Variable In Text Field
I am making a game in Flash and I'm trying to increment the score for each alien that's killed in the game. There is a score variable that's created on the main timeline:


Code:
var score:int;
score = 0;
Then, inside the alien movie clip, I want to record the score and give it a value each time the user hits the alien and then show the score in a dynamic text field called score_txt. So in the function that tracks the death of an alien, here's what I have:


Code:
root.score_txt.text = root.score
I keep getting error messages. Any clues?

Limiting Number Of Lines Of Text In A Variable
Hi,

I have a scrolling chat field that I want to keep the last 50 lines of text in. What is the *most efficient* way to strip off the older data? New text is being appended to the end of the scrolling list, so the latest info is at the bottom, and the stuff I want to get rid of is at the top.

Thanks,
-Chilton

Compairing Text Input To A Number Variable
i am tring to compair a number variable (Card_Channel) to a number entered in an input text box. I have tried using a varable for the text box and addressing the instiance of the text box and cant seem to get either to work. I have also tried using parseInt() but it always returns NaN

Please Help!

the code i am using is: (Channel is the variable for the text box)

if(Card_Channel == Channel) {
gotoAndStop(20);
}

else{
gotoAndStop(10);
}

~Patrick

Importing Strings Into A Text File And Converting Them In The Movie For Use.
I have a text file, in that text file there are several strings that look like this.

&&S1=[room,250,1]&&
&&S2=[room,252,1]&&
&&totalRooms =2&&

Any they go on like that. Now what I am wanting to do is to load this text file and convert the strings into items that can be used in the movie.

The code I have tried using for this is

code:
function buildInfo() {
for (i=1; i<=totalrooms; ++i) {
foo = "T"+i;
foo2 = "S" + i;
foo = foo2.split(",");
trace("foo:"+foo[0]);
}
}


Now I was expecting this to make the S1 into T1 with the information from text file. This is not working, when I run the movie the trace("foo:"+foo[0]); returns the actual name of the S1 file and that is it. I am just not sure what I am doing wrong. Thank you for any help. I f I have not made myself clear enough, please let me know.

Getting A Number From A Text Field And Assigning The Numeric Value To A Variable
I want to "grab" a number from a text field and asign it to a variable as a numeric value, to then add it to another variable.

but so far I get errors. how do I do this ? any advice would be appreciatted

Converting Number To HEX
ok i have this code

Tcolor = txtformat.color;

and when i trace Tcolor it gives me like 65280 when the color is 0x00FF00(pure green) , so obviously it convers the color to decimal numbers..
but now i want it in the HEX form 0x?????? ... is there a function that can easily do this ?

Converting To Number
I'm trying to make a little typing app, which loads the exercises externally from text files.
Here's what's in my text file:

===================
ex1.text
===================

&words=12
&word0=jjj
&word1=jjj
&word2=jjj
&word3=jjj
&word4=jjj
&word5=jjj
&word6=jjj
&word7=jjj
&word8=jjj
&word9=jjj
&word10=jjj
&word11=jjj

words being the amount of words in the exercise (12), and the rest being the words which should be typed.

===================
The Flash File (frame 1)
===================

var exerciseArray:Array = new Array();
var exLoadVars = new LoadVars();
exLoadVars.onLoad = startExercise;
exLoadVars.load("ex1.txt");
function startExercise(success) {
if (success) {
// load exercise
var numberOfWords:Number = Number(exLoadVars.words);
trace(numberOfWords);
for (i=0; i<numberOfWords; i++) {
trace("test");
}
} else {
trace("loading failed");
}
}

This should load my text file, and when I trace exLoadVars.words, it outputs '12' just like it's supposed to.
However, if I convert this string to a number using var numberOfWords:Number = Number(exLoadVars.words);
and then trace(numberOfWords); it outputs isNaN.
(obviously, the trace("test") does not fire at all because numberOfWords is not a number)

Why doesn't this work ??

Retriveing Date Variables From Text File/ Converting Strings To Dates
Hi,

I'm trying to read date variables from an external text file. I'm using the LoadVars method and it is working fine for regular string variables. I'm running into trouble trying to convert some of those strings into date variables so I can compare the current date to the targetDateX variable from the text file. I'm working on a countdown timer for a list of different times/dates. It will display the time left until the first event, then after that event the time left until the second event. I'm running the code in a for loop and everything is working except being able to convert the string with format (yyyy,mm,dd,hh,mm) into a date variable- I've attached a sample of where I'm having trouble.

Thanks in advance for any help! :)







Attach Code

var targetDateX:String = "targetDate" + i;
//sets a variable targetDateX equal to the variable targetDate(i) so that you can read it from the text file
var targetDateA:Date = new Date (this[targetDateX]);
//attempting to set it into a date format
trace (this[targetDateX]);
//returns the variable stored with the name targetDate(i) in the text file
trace (targetDateA);
// returns 'Invalid Date'

























Edited: 11/09/2008 at 12:45:04 PM by wyattr1

Converting A PDF To A Flash FLA File Without Converting To An Image First?
Basically, I'm building a digital catalogue that runs off a CD and uses a Flash 'page turning component' to display the pages. Certain pages will have links that use Flash's Fscommand call to open Word and Excel documents.

Has anyone got any bright ideas of how to Convert a PDF to a Flash FLA file without converting to an image first?

I know I can open a PDF in Photoshop, save as a PNG or JPG and then import this into Flash, however the quality isn't brilliant. If you use a hi-res image, then you get a hi-res file size...

Currently, the best way I have found, is to open the PDF in Illustrator, then export it as a SWF. Illustrator converts all text to shapes and you end up with a small SWF, yet great quality when displayed in larger sizes. As I'm currently using a page turning flash component that loads SWF files, I need the quality to be good for the 'Zoom' function.

I've found an Illustrator script that will do the hard work via a 'batch' process, so I can take a 100 page PDF and convert the whole lot to 100 SWF files while I drink tea and 'look busy' and read a magazine, but the problem I have is that I need to add a layer of buttons to several of the SWF files to add a little functionality....

I do have a SWF to FLA decompiler which does a good job, however because Illustrator turns everything into shapes, the decompiler does the same and you end up with thousands of files in the library.... Plus there are a lot of error messages when the file is first loaded...

Many layers are masked, (for some reason without a fill), so if you publish the decompiled file straight away, you just get a blank file. Once you go through and fill the masks needed, it shows when you publish, but this really is a lot of work and I've had a few pages that show when you open the SWF file, but don't show when the SWF is called into the page turning file.... Hmmm....

So in short, I'd like to take a PDF and convert it to a FLA file, add a layer of buttons and publish as a SWF file....

Anyone got any 'Pearls of Wisdom'?

Clere
Clere Print

Getting A Number Out Of A Text File
Been driving myself crazy trying to get a text number out of a text file.
I've been using:

textdisplay = new LoadVars();
textdisplay.load("podcastinfo.txt");
textdisplay.onLoad = function (success) {
if (success) {

to load variables from a text file. One of them is a number, which I would like to process as a number, for example by adding to it. However if I try:

newvariable = this.textfilenumbervariable + 5
trace (newvariable)

I get:

textfilenumbervariable

5

Which I presume means that the number variable from the text file is being treated as a string. How can I convert it to the kind of variable I can process as a number? Thanks for your time,

jim

Converting A String To A Hex Number...
I am currently storing a serious of details as hex numbers and then converting them back to strings to work with them as scores.

Once I have checked against the 'highest' score I need to update these strings back into hex.

How can I detect they are above 9 and convet to appropriate hex values... Is there a reverse of the ParseInt command I can use ??? Helpme please - confused maths dropout!!!

burt

Converting A String To A Number?
I need to turn a string into a number that you can do math with!

My example:

thestring = "h5";
splicedsuit = thestring.charAt(0);
splicednumber = thestring.charAt(1);

(splicedsuit = "h"; splicednumber = "8")<not displayed

Then I need to do Math like

whatIneed = 9274 + splicednumber


If I check the variables durning the movie it says

whatIneed = 92748

but I need it to say 9282 and acually add them together not combine them.

Thanks In Advance!
Chris

Converting A Number To A String AS 2
Hi:
I've been trying to convert a number into a string (It's easy in other langauges) but its got me baffled in AS 2.0. I'm still very much a n00b at Flash. MX 2004 is my first and only version.

In a class (theScore) I increment a number n_numberRight. Return that to the main part of the code theScore.numberRight
I've tried the code below:
code:
public function get numberRight () : String
{
var s_ScoreRight : String;
var n : Number = new Number (n_ScoreRight);
s_ScoreRight = n.toString ();
trace ("Number = " + n_ScoreRight + " String = " + s_ScoreRight);
//the trace shows correct values.
return s_ScoreRight; // return this should be string??
>> this works if the return type is Number but I still want a string//return n_ScoreRight;
}

The return value is correct in a trace, but if add
code:
var sOut:String;
sOut = theScore.numberRight();
trace(sOut); // undefined ??

I want to pass that string then to a textfield
textfield.text = sOut;
Help, please, and thank you.

Converting A Sting To A Number
hey ppl, I have a var that contains a string and i need to convert it into a number but I dont know how example:

a = "5"

how do i make it a=5

I know how to convert a number into a string but how do i go the other way?
pls help

thx

Converting A Number To A String
Hi,

How do I convert a number to a string? I'm using Flash 8 actionscript 2. Thanks in advance.

Converting A String Value To A Number
I am working on a project that requires the input of several values in to text inputs, which are then in turn put into variables. 3 of the 4 are string values, of which I have no problem, the fourth however is intended to be a number, but flash treats it as a string. So my question is, how do I convert the string value into a number one?

Here's the code:

update_btn.onRelease = function()
{
category = name_txt.text; //(string)
question = question_txt.text; //(string)
answer = answer_txt.text; //(string)
points = points_txt.text // This one I want to be a number value
}

Converting String To Number
I'm an Actionscript newbie and hope that somebody can point out where I'm going wrong. I'm designing a Flash website that imports external data from a .TXT file... the text file contains assorted fields, mostly financial data (prices). The data imports perfectly, and I can replace variables set up with the new information. The problem is, no matter how hard I try, I cannot convert any text field loaded into a real number... so if the text field is &page=1234, for example, the data 1234 loads fine as the page variable, but it's a string, not a number. Using Number(text) doesn't work, all I get is NaN. It displays on screen perfectly, but I can find no way to convert the apparent number into a real number (to add various different results together).

Am I missing something obvious?

I'm compiling in Flash 6 with Actionscript 2.0. Any advice or solution would be greatly appreciated!!

Converting From String To Number
I have a variable that comes from one of those SWFtoEXE creation programs. It sends it into flash as a string, but I want it to be an integer. How can I convert the data type in Flash?

Here's the code I'm using:


ActionScript Code:
//curPos = 153
var gotoPos = curPos + 1000;
other_txt.text = gotoPos;
//other_txt.text output is 1531000...added it like a string

Help: Converting NameX, X To Number?
Hi, I have a favor to ask.
If I have a name such as "steven4" or "melisa56", ho can I get only the number and convert it to an integer??

How Can I Load A Number From A Text File?
Help please!!!

I'm trying to load a variable in my movie but it's interpreted as a string!?

in the output windows it returns a number value but it's not working as a number. Is there a special character to put in my text file?

thanks

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.

Text File, String To Number
I'm having a terrible time trying to figure out how to get a number from a text file and turn it into a number in flash. The textfile says the $StartDate is 76 and it brings it into flash ok, but when I try to change it to a number, it seems to return 0. Can someone help?


ActionScript Code:
loadVariablesNum("textfile14.txt", 0);
$RealNumber = Number($StartDate);
$addTest = $RealNumber + 3;

Thanks

Getting Number From External Text File
I am trying to read a number from an external text file that will control how many seconds before a slide fades into another slide. So the setInterval duration will be from the external file. See the last couple lines of the code. I figgered that Flash must be assuming the number coming in from the external file is a string, so I tried converting it to no avail. I keep getting NaN when I trace the variable. Any help is deeply appreciated. Thanks.









Attach Code

// First off, we need to initialize all the variables we'll be using
var title1;
var title2;
var title3;
var title4;
var title5;
var link1;
var link2;
var link3;
var link4;
var link5;
var interval = 4;
var myInterval = 4;

// Create a new Load Variables object first
var myLV:LoadVars = new LoadVars();

// When the text file loads, either do the function called "makeThingsHappen()" or write an error.
myLV.onLoad = function (success) {
if (success) {
makeThingsHappen();
// trace ("text is loaded, sir!");
} else {
theTitle = "Error loading external text file.";
}
}



// Load the file called "titles.txt"
myLV.load("titles.txt");


// This function takes the variables from the text file and loads
// them into the Flash variables
function makeThingsHappen(){
// First, load the interval all the titles
interval = (myLV.interval)
theTitle = (myLV.title1);
title1 = (myLV.title1);
title2 = (myLV.title2);
title3 = (myLV.title3);
title4 = (myLV.title4);
title5 = (myLV.title5);
// Then, load all the links
link1 = (myLV.link1);
link2 = (myLV.link2);
link3 = (myLV.link3);
link4 = (myLV.link4);
link5 = (myLV.link5);
myInterval = Number(interval) * 1000;
//myInterval = parseInt(interval) * 1000;
trace(myInterval);

}

Converting A Number In String To An Integer...
I'm reading in values from an external text file but they are being seen as strings rather than numbers so I can't do any calculations with - which I need to do!

How do I convert from a string to a usable number?

m.

Converting A Number From Decimal To Hexidecimal
Does anyone know if there is a command or function to do this?

Thanks
Mark

Converting Negative To Positive Number?
I can't seem to find an actionscript function to convert a negative number to a positive one. Anyone know how to do this in actionscript?

Thanks,


UPDATE.........................

Answer is: Math.abs(number)

Converting External Variables To Number
I don't know why the Number() function isn't working for my externally loaded variables.

I load my text file containing the variables onto the main timeline:
loadVariablesNum ("loadextdata_currencydata.txt", 0);

I run a check to see that it's loaded.

In the text file is the first variable:
usdFromAustralianDollars=0.507331;

on my button:
on (release) {
trace(usdFromAustralianDollars); //returns the string value of 0.507331
australianRate = Number(usdFromAustralianDollars);
trace("$" + (australianRate + 100)); //returns NaN
}

If the variable is not external, the Number() function works fine. What else do I need to be doing?

Thanks!

Converting A String To Number Array
basicaly if you can read the code then you understand what i am doing sorry i cant realy explain what it is doing but if you can read action script then you can under stand what i am doing
if you run this script it output this


Quote:





1
0
1000
100
10
final =undefined10100010010





everything is working unil the code reaches to finaly
what i am trying to do is add them all like a math equation
but what the script is doing is joining the script like a string
does any body know how i can convert this string into a number
so the script will at final add and not join together like a string
not php actionscript

PHP Code:




var my_str:String = new String("10444");
var my_array:Array = my_str.split("");
var length:Number=my_array.length;
var whilenum:Number = 1;
for (var i = 0; i<my_array.length; i++) {
    if(my_array[i]== 4)
    {
        var digit:Number;
        var full:Number =10;
        
        digit = my_array.length - i;
        digit = digit -1;
        for(var b =0; b < digit; b++)
        {
        full =10 * full;
        }
            
        my_array[i] = full;
          full = 10;
          
        }

    trace(my_array[i]);

}
var final:Number;
for( var c = 0; c < my_array.length; c++)
{
    final = final + my_array[c];
    }
    trace("final ="+ final);






i am sorry i cant realy explain what i am doing but if you have a question or need information i would be happily to answer it as the best i can
thank you in advance

Converting String To Number Using ParseInt
hello,
All I want to do is convert a string into a number, I thought it would be easy:


Code:
var stringNum:String="00000000537112"
var num:Number= parseInt(stringNum);
trace(num);
//Result: 179786
I have tried using Number(stringNum) aswell which does not work, all I want it to do i convert "00000000537112" into 537112.
I have tried it by removing the 0s at the beginning of the string which works. Is there any way of solving this or will I have to build a function to shave off the preceding 0s?

Loading A Var And Converting It To A Number Problem...PLEASE HELP
I can load a variable into Flash from a .asp page fine. However, when I try and convert it to a number flash gets mad and displays NAN. Any ideas? I have seriously spent hours trying to figure this out!!!! I'm so frustrated because my actionscript skills are terrible!

--------------------------------------------
gettime.asp code:

<%
dim unixtime
unixtime=1000
%>

&mytime=<%response.write(unixtime)%>

--------------------------------------------

Actionscript code:

var mytime;

myData = new LoadVars();
myData.load("gettime.asp");

myData.onLoad = function(){

//this displays 1000 which is fine
mytime = this.mytime;

//This causes it to freak out and show NAN
//mytime = Number(this.mytime)
//Below is what i ultimately want to use
//mytime = Number(this.mytime)*1000-getTimer();

//this is a dynamic text box so i can see the value
MyDynamicTextBox.text=helpme;

};

Importing Number Variables From Text File
I have a slight problem that I cant figure out for you Flash Guru's out there. Here is the code.

for (i=1; i<=NoPlans; i++) {
setProperty ("_root.Menu.DropMenu.ClipButton" add i, _visible, true);
}

The "NoPlans" variable is loaded from a text file with a whole number value, but doesnt seem to work. If I were to place a text field in the movie with the name "NoPlans", the variable displays in the text field!! But why does it not work in the for statement??!! Me no understand.

Any help would be greatly appreciated.

Counting Number Of Variables From A Text File
Friends,
I am having a problem. I want to count the number of variables from a text file in flash. how do I do that?

I am using flash5.

rahul

Implementing A Counter Up To A Number In A Text File
Hello,

Can somebody point me in the right direction to start developing a counter that counts up to a number specified in a text file.

thanks in advance

Transform Text Read From File Into Number.
Hello,

I am using Flash 8 Proffessional, and I am trying to read some text from a text file, increment this text with 1 and rewrite it back on the file. My text file looks like this:

Name: ffile.txt
Content: &counter=0&

What i want is to increment the counter everytime i press a button, and write it back to file.

I am readimg from file like this:

on (release)
{

var lv:LoadVars = new LoadVars();
lv.onData = function(thetext:String)
{
unu.text = (thetext);
}
lv.load("ffile.txt");
}

unu.text is a dynamic text field which shows me the value of counter.

I test the movie, i press the button, and yes the dynamic text field shows up the value read from text file: 0, 2, 8, or whatever I set it earlier. But I want to use this value to add 1.
I have tried:
trace(Number(unu.text)+1) - nothing,
tried trace(Number(counter)+1) - nothing,
trace(parseInt(unu.text)+1) - nothing,
trace(parseInt(Number(counter))+1 - nothing.
I just can't find a way to convert this text from file into number.
Do you guys know a way to do this? An example perhaps. Anything.
I am trying to make a visitor counter, and my host does not permit PHP scripts or any of this kind, so I have to read text files and increment the visits myself.

Thank you.

Counting The Number Of Variables Stored In A Text File
okay, I've spent all day searching the forums and tutorials... I've found some things that I should be able to combine to do this, but I've had no luck.

All I want to do is count an unknown number of name=value pairs in a text file.

For example, the file could contain:
name1=Ted&name2=Bill&EOF=TRUE

or it could contain:
name1=Ted&name2=Bill&name3=Death&EOF=TRUE

the name of the text file is always the same, the naming convention of the variables is always the same (name#). Basically I want to count the number of variables, create and populate the textfields dynamically, and add a (duplicated) alternate color movie clip behind each odd (or every other) row. I can do that stuff, just not with an indeterminate amount of variables. I'm not even concerned with the alternating color thing now, all i want is to create the textfields (and I just can't bring myself to do a "for (i=1;i<1000;i++" and hope that I never have 1000 variables in the source file.

things I've tried so far include loading the variables into an array, and then trying to get the .length of the array (but that always returns "0").

am I off base?

Recognition Of Line Number Of An External Text File
Hi!

Can I define various variables in an external text file and then flash recognitize them by line number and How?

Reading A Number From A Text File To Use In Action Script
Ok, so i'm kinda new to this but it's been 5 hrs already and I haven't got nothing.

Reading text to use in text fields worked ok, now I need to read a number.
I want to make a fully dummyproof photo gallery to use for a presentation cd.
So I was thinking of generating the photos, thumbnails and text files using some Delphi program or something (I'm not on a server, I think php won't do...)

The text file:

Code:
nr=10&EOF=true&
Ok, now to the action script.
I have this:

ActionScript Code:
loadVariables("Variable.txt","loader");
stop();

Ok, and a loader to verify the variables:


ActionScript Code:
onClipEvent(data) {
    trace('data received')
    if (EOF == "true") {
        _root.gotoAndStop(2)
    }
}

Ok, the movie clip named loader works fine, receives the data.
Now, how do I pass the data to the root or level0 of my movie?
Or, how do I use the data in the file?


After jumping to frame 2, flash states NaN or 0 istead of the number, I have tried many different ways.

PS: I am using action script 1.1 and I need a flash 6 compatible movie.

Random Number Variable That's Different From Previous Number
I have this line of code in my game that works great. However it would work even better if when it the code was executed the next random number was not the same as the one before it. For example if "speech" is on frame 6 when the code is executed I would like the random number to be between 2 and 12 but not 6. (I don't want the same frame to come up as it confuses the kindergarteners and preschoolers using the program.) Here's the code that's working for me now.


ActionScript Code:
speech.gotoAndStop(Math.floor(Math.random()*11)+2);

Load Text File Data (No Variable In Text File )
Hi everyone,
In Flash Mx,

How can i load data from the text file ??
I know its easy using variables but..

There is only text, no varibales like -- Name=bla bla
in the text file

So, how can i load all the data from the text file in a varibale(I am not getting any variable from the text file, getting only data) ??

Thanx in advance,
$hailesh Mewada

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