Hi -

I'm trying to improve my ActionScript skills and have run into
difficulty. I'm trying to create a flexible and dynamic system that
loads an XML file which defines what the content should be and where
to get it from.

I'm trying to be efficient and keep all my code in the first frame (or
as few frames as needed), and I'd like to create all the objects
dynamically at runtime.

I'm trying to use CreateEmptyMovieClip to create a dynamic menu screen
with various numbers of buttons. I load info from the XML file, which
works fine. When the XML is fully loaded I run a function which
displays a background and creates menu choices:

this.createEmptyMovieClip("mcMenuBackground", 0);
mcMenuBackground.loadMovie(MenuBackground);

Where the link to "MenuBackground" has been loaded from the XML.

Next I try to create menu choices. I have a FOR loop which tries to
create a movieClip for each menu choice defined in the XML like this:

for(var i = 0; i < ButtonImageList.length; i++)


this.mcMenuBackground.createEmptyMovieClip("Button Image"+i,i+10);
Eval("ButtonImage"+i).LoadMovie(ButtonImageList[i]);
Eval("ButtonImage"+i)._x = 100+(i*280)
Eval("ButtonImage"+i)._y = 100
Eval("ButtonImage"+i).visible = TRUE;
Eval("ButtonImage"+i).UseHandCursor;
Eval("ButtonImage"+i).onRollover = ButtonRollover();
Eval("ButtonImage"+i).onRollout = ButtonRollout();

}
}

When I test it the menu choices are not displayed. When I debug and
use Ctrl-L in the trace window I see that the ButtonImage objects are
created:

Movie Clip: Frame=0 Target="_level0.mcMenuBackground"
Movie Clip: Frame=0 Target="_level0.mcMenuBackground.ButtonImage0"
Movie Clip: Frame=0 Target="_level0.mcMenuBackground.ButtonImage1"
Movie Clip: Frame=0 Target="_level0.mcMenuBackground.ButtonImage2"

But when I continue in debug the ButtonImage objects disappear and of
course aren't displayed on screen. The only AS I have after the
function that tries to build the menu are the onRollover and onRollout
functions.

I'm not sure if I'm using CreateEmptyMovieClip incorrectly, or if I am
not thinking of layers properly or if my ActionScript is in the wrong
place or what.

Any thoughts are greatly appreciated. TIA!

George