Dynamic Movieclips and Functions

How a function can be attached to a dynamically generated movieclip (ex: using createEmptyMovieClip).
illustration code:

for(i=1 to 5)
{
[indent]createEmptyMovieClip(…)
loadMovie(…)
NewMovieclip.onRollover = function () {trace(“this is NewMovieclip over”)}
[/indent]}

NewMovieclip.onRollover … is this the right way?

thanks in advance.
IseeAC