Passing data into a button that is generated on the fly

Hi guys,

I have a function that generates a series of mcs from XML. These mcs contain buttons. I need to pass the ID of the movie that the button is attached to into the button events, but I can’t figure it out. See the code below. How do I pass something into the button event? Or do I need to rethink?


for (var i=0; i <= 15; i++) {
        identID = "ident" + i;
        var tempgrid = grid_mc.attachMovie("ident_proto", identID, grid_mc.getNextHighestDepth());
        
        tempgrid.ident_btn.enabled = false; // disable the button for this ident

        tempgrid.title_txt.text = bbName*;
        
        tempgrid.onRelease = function():Void {


// PASS THE ID OF THE MOVIE TO HERE???

        }
        
        tempgrid.onRollOver = function():Void {

// PASS THE ID OF THE MOVIE TO HERE???

        }
        
        tempgrid.onRollOut = function():Void {

// PASS THE ID OF THE MOVIE TO HERE???

        }
        
      }