You could not run code with eval(), for sure in AS2.  I can't say for
sure in AS1, as I never used that.

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Thursday, June 19, 2008 7:58 PM
To: [email protected]
Subject: Re: [flexcoders] Re: string to actual actionscript code?

 

I'm fairly certain that while you could run code with eval() it wouldn't
have any side effects. It was some sort of temporary scope that was
thrown out after execution or something, or you could only get side
effects by calling a function. But, last time I wrote AS2 code, it was
on Flash MX so my memory is hazy ;-)

While I'm also from a graphic design background, I'm a pretty
experienced Java etc programmer so I came to Flex from that perspective.
I might not always be the best person to understand your point of view
when you're asking questions, but I'm willing to give it a shot :)

Also when you're asking a question like the original, we're better able
to help if you provide some context as to what you're trying to achieve,
as well as the technical quesion you're asking.

What I mean is, the technical question is "how do I emulate
eval('movie_' + number)", but the context is "I'm trying to create a
scrollable list of 6 text boxes". That way we know whether answering
your question is enough, or if we should give you a nudge to a more
"flex-like" solution, such as "here's how you do that, but you probably
want a List component"

-Josh

On Fri, Jun 20, 2008 at 6:22 AM, Joseph Balderson <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

The array accessor [] does not quite duplicate what eval() used to. From
my recollection you could actually run code with eval, which of course
is impossible to do with []. I know there's a way to do code injection
in AS3, but I don't remember the tecnique offhand.

The interesting thing about [] of course is that AS3 can do
two-dimensional "arrays," and you can "chain" two array accessors
together to make both the object and its property dynamic, like so:

this.someInstance.someProperty
==
this["myObject"]["daProp"]

Which makes things very interesting. Of course this only works if the
property exists or the class is dynamic.

A for loop and the [] syntax is much lower level and much more efficient
than a repeater, but of course a repeater is bindable and has other
useful stuff.




-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  

 

Reply via email to