[thelist] Actionscript: loading content from a CF list

Erik Mattheis gozz at gozz.com
Mon Aug 20 01:07:06 CDT 2001

>What you have suggested works in some parts but not others. For instance it
>doesn't like this:
>duplicateMovieClip (clip, eval("clip" + i), i);
>I still need a way to get the variable from the CFM to the loop where the
>duplicates are created. Any ideas on that?

Saying, for example, that i is 3, what the above would do is look for 
a variable named clip3 and assign the value of that variable as the 
_name property of the duped MC (or. In the ActionScript dictionary 
when the description says something like "_x value of eval target", 
you don't have to use eval() - the eval is done for you. (I believe 
in every case where you can use concatenated strings within the 
parentheses of a predefined Function of Method, the eval is done for 

If you know JavaScript and are familiar with the way you reference 
objects using dot syntax, you can do the same thing with Flash ... 
like if you wanted to duplicate your movie clip and do a few things 
to it, you _could_ say:

duplicateMovieClip (clip, "clip" add i, i);
setProperty("clip" add i, _x ,100)
set("clip" add i add "/:text","Textfeild value")

or (this reads better to me):

clip.duplicateMovieClip('clip' + i, i);
my_clip = eval('clip' + i);
my_clip._x = 100;
my_clip.text = 'Textfeild value';

<tip type="Debugging ActionScript">

I find tracing the typeof to be really useful when debugging 
ActionScript, ie, a simple example:

i = 3;
clip.duplicateMovieClip('clip' + i, i);
my_clip = 'clip' + i;
trace(typeof my_clip);         // trace is "string"
my_clip = eval('clip' + i);
trace(typeof my_clip);         // trace is "movieclip"



- Erik Mattheis

Who reflects too much will accomplish little.

(612) 827 3963

More information about the thelist mailing list