Flasher Archive

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


Subject: Re: FLASH: Eval or not to Eval
From: Gregg Caines
Date: Tue, 8 Aug 2000 00:27:17 +0100

eval takes a string and returns the value of a variable
that has the same name as a string.

If you have a variable called var1 and its value is 123
then saying trace(var1) will give you 123 as output.

If instead you said trace("var1") you will get "var1" as
output.

If your variable name is in string form like the one above
you would have to say trace(eval("var1")) to get the
output 123.

In this context it seems useless, but it's great for faking
arrays (lists of variables) because you can do
eval("array"&x) where x is an integer value which can
change depending on which item in the list you want.
Just by using eval and changing the value of x (like in a
loop) you can automatically fake an array and have
access to an entire list of variables at runtime. If x = 1
then eval("array"&x) will be referring a variable called
array1. Incrementing the value of x is an easy way of
using variables named array2, array3, array4, etc,etc...

It is one of the more confusing concepts but it is really
useful.

---------------------------------------------------
Gregg Caines
n e o m e t r i x systems inc.
http://www.neometrixsystems.com
gcainesatneometrixsystems [dot] com



> Hi Flashers,
>
> I am hoping that somebody in a clear and concise manner can explain the
purpose and function of the Eval function in the action script editor. I
thought I understood the purpose of it and even attempted the flash example
in the manual which was working fine, however it is really a mystery to me
how it actually works, this feature seems especially important and now that
I want to start projects using speed and friction, for example, it is
essential I get it clear how to use it. Please I beg you I have been pacing
around trying to understand its use and application, and the general
descriptions from other sites are not helping, they are just making it more
confusing for me. I really need an idiots guide to its working and why to
use it.
>
> for example what is the difference between using Eval and just using the
variable in a loop????
>
> anyway the carpet is wearing thin look forward to your replys
>
> Stuart
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Full flasher archive now available online at:
> http://www.chinwag.com/flasher/archive.shtml
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> To unsubscribe or change your list settings go to
> http://www.chinwag.com/flasher or email helpatchinwag [dot] com
>
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Full flasher archive now available online at:
http://www.chinwag.com/flasher/archive.shtml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  FLASH: Eval or not to Eval, Stuart Mayhew (Garanti Te

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