# Dynamic Menu and Loader Settings

**URL:** <https://forum.kirupa.com/t/dynamic-menu-and-loader-settings/257420>\
**Category:** flash\
**Created:** [April 14, 2008, 6:28am UTC](https://forum.kirupa.com/t/dynamic-menu-and-loader-settings/257420 "2008-04-14T06:28:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![silver61](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@silver61](https://forum.kirupa.com/u/silver61)\
**Post date:** [April 14, 2008, 6:28am UTC](https://forum.kirupa.com/t/dynamic-menu-and-loader-settings/257420/1 "2008-04-14T06:28:46Z")

</div>

Hello,

I am sure this has been asked before, but I just couldn’t find a thread that really answers my question.

I am creating a dynamically built menu from an array of image titles and images on the server, by using the attachMovie function and attaching a movieclip. (The whole code is based on a tutorial from this site)

Changing the text of the menu item works fine.

But I cant get the icon next to the text to load the image.

Here is the code:

[FONT=Courier New]GenerateMenu = function(container, name, x, y, depth ) {  
// variable declarations  
var curr\_node;  
var curr\_item;  
var curr\_menu = container.createEmptyMovieClip(name, depth);

```
// for all items or XML nodes (items and menus)
// within this node_xml passed for this menu
for (var i=0; i&lt;title_array.length; i++) {
    // movieclip for each menu item
    curr_item = curr_menu.attachMovie("M_NewsMenuItem","item"+i+"_mc", i);
    curr_item._x = x;
    curr_item._y = y + i*curr_item._height;
    curr_item.trackAsMenu = true;
    
    // item properties assigned from the array
    curr_item.name.text = title_array*;
    curr_item.test.contentPath = "pics/test.jpg";
    curr_item.test.load(); // I switched the component to autoLoad false

} // end for loop

```

};[/FONT]

Thanks for any help!
