Flasher Archive

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


Subject: Re: FLASH: Eval or not to Eval
From: John Dowdell
Date: Mon, 7 Aug 2000 22:58:36 +0100

At 6:40 AM 8/7/0, Stuart Mayhew (Garanti Teknoloji) wrote:
> 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.

It's similar to the "eval" function in JavaScript...? ;-)

Seriously, this is always a tricky thing to describe with words... the
shortest explanation I've seen is that it's a way to "de-string-ify"
variables, a way to turn strings into commands.

For instance, compare these two phrases:
"You're feeling very sleepy... your eyes are getting heavy."
"It's possible to remember a feeling of great ease, and comfort... you
might even notice a warmth, and heaviness, as you go deeper, and deeper."

The first is a command, while the second... hey, hold it, where did that
example come from, it's too oblique, let me try again... "the map is not
the territory"? no, get it into computery terms.... ;-)


Suppose you've named a variable customer23, then you wish to loop through a
series of related customer names like this (pseudo-script):

with i = 1 to numCustomers
thisCustomer = "customer" & i
CalculateBill( thisCustomer )
end loop

The "thisCustomer" reference would actually be a changing *string* here,
not a changing variable name. You'd want to de-string-ify that name to get
an actual object reference, and this is where functions like "eval" or
"value" can help. (Some languages also have a "do" or "execute" command,
which interprets a string as a literal command.)


I'm sorry that this description seems self-referential... part of the
problem is that eval's functionality is itself abstract, turning an
indirect reference to a direct reference. Does the above help at all...?

jd









John Dowdell, Macromedia Tech Support, San Francisco CA US
Search technotes: http://www.macromedia.com/support/search/
Offlist email risks capture by the spam filters. I may not see your
email if it's not on the list. Private one-on-one email options are
available via Priority Access: http://www.macromedia.com/support/



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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


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