Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: [flasher] Getting variables from a txt file
From: Muzak
Date: Wed, 28 Mar 2001 02:05:30 -0000

Sorry, that is incorrect. Flash treats variables loaded from a textfile as strings, even if they're numeric values.

So, if you have a1=23&a2=dog&a3=14&a4=cat the the text file loaded into flash:

Flash will return:
a1 + a2 = "23dog";
a1 + a3 = 2314; //and not 37
a2 + a4 = "dogcat";

If you try this:
number(a1) + number(a3)
Flash will indeed return 37

If you'd like to test this - using the variables above in a textfile then do some tracing:

trace ("a1+a2 = "+(a1+a2));
trace ("a1+a3 = "+(a1+a3));
trace ("number(a1)+number(a3) = "+(Number(a1)+Number(a3)));
trace ("a2+a4 = "+(a2+a4));
----------------------------
Returns this in the output window:

a1+a2 = 23dog
a1+a3 = 2314
number(a1)+number(a3) = 37
a2+a4 = dogcat
---------------------------
Also, if you do a 'list variables' in test movie mode you'll get these:
Variable _level0.a1 = "23"
Variable _level0.a2 = "dog"
Variable _level0.a3 = "14"
Variable _level0.a4 = "cat"
--------------------------
Looks like strings to me :-)

hth,
Muzak



----- Original Message -----
From: "Marc Antony Vose" <suzerainatsuzerain [dot] com>

> if you have a1=23&a2=dog&a3=14&a4=cat the the text file loaded into flash:
>
> a1 + a2 = "23dog";
> a1 + a3 = 37;
> a2 + a4 = "dogcat";
>
> how does flash know what's a number and what's not? who cares? it
> does. it's smart enough to know when to treat the contents of a
> variable like a string and when to treat it like a number.






[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]