AS 1.0 to 2.0

Hi guys!

Love the site, and especially the forum, as always.

I have a small question about a script I was implementing just now.
I’ve read and downloaded the source file from this tutorial: http://www.actionscript.org/tutorials/intermediate/Dynamic_menu_with_submenus/index.shtml and implemented it without any changes into my AS 2.0 Flash 8 file. It’s just recently that I realized why my for loop kept displaying a text with ‘undefined’ in it. It’s because I’m using a code designed for 1.0 in my 2.0 project.

Since I’m not that aware of the large formatting differences between 1.0 and the latest Actionscript, I’m wondering if anyone might know what I need to change in this line of code?


for (i=1; i<=_root.total; ++i) {
        menuMC.duplicateMovieClip("menuMC"+i, i);
        
        //position
        
        this["menuMC"+i]._y = this["menuMC"+(i-1)]._y+this["menuMC"+(i-1)]._height;
        
        //assigning variable
        
        this["menuMC"+i].choice = i;

}

And inside my menuMC movie clip I have this code to define the dynamic textfield with the variable text:


text = eval("_root.text" + choice);

EDIT: I believe it have something to do with the variable ‘choice’ not being defined. Before the loop starts or something. Am I wrong?

I’m really grateful for any help.

Regards,
Mattias