Assigning release function to dynamic buttons

Hi all,
Heres ther scenario - im building an xml navigation movie for our site. The xml is read in, and loops through xml creating the top level buttons (there’s 7 in total). Within that loop is another loop which creates the subnavigation options.

Because the navigation is hoziontal and the button lengths vary greatly, the brief is to do everything on the fly - there’s nothing other than the backgrounds and the fonts in the library.

So for example, the first xml node is ‘About’, the script makes the ‘About’ button, positions it on screen, then loops through & creates the sub nav buttons. All good so far. Once the sub nav is complete, I want to assign the top level button an action to show/hide the subnav (it calls a prototype):

//newClip is the top level button
newClip.onRollOver = function ()
{
subClip.moveThisY (22, 3);
};
newClip.onRollOut = function ()
{
subClip.moveThisY (-19,15);
};

This works to a point, but all the buttons show/hide the same subnavigation (the last one created) not their own. i.e. if the first button is ‘About’ and the last is ‘Products’, the ‘About’ button shows & hides ‘Products’ sub nav. any ideas where im going wrong? i’m guessing i need someway of evaluatig/assigning a value to the Rollover function.

Cheers for ya help peeps.

James