Dynamiclly created buttons and script

how can i add my button scripts (rollover, click etc) to a dynamically created movieclip. the dynamic movie then has a library based movie attached to it

ie
createEmptyMovieClip(“BUTTON”+i, getNextHighestDepth());
where = 100 + (i * 100);
attachMovie(“NAV_BUTTON”, “BUTTON”+i , getNextHighestDepth(), {name:elename,_x:where, _y:100});

thanks for any direction