# Passing data into a button that is generated on the fly

**URL:** <https://forum.kirupa.com/t/passing-data-into-a-button-that-is-generated-on-the-fly/225161>\
**Category:** flash\
**Created:** [May 9, 2007, 9:22am UTC](https://forum.kirupa.com/t/passing-data-into-a-button-that-is-generated-on-the-fly/225161 "2007-05-09T09:22:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shellbryson](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shellbryson](https://forum.kirupa.com/u/shellbryson)\
**Post date:** [May 9, 2007, 9:22am UTC](https://forum.kirupa.com/t/passing-data-into-a-button-that-is-generated-on-the-fly/225161/1 "2007-05-09T09:22:42Z")

</div>

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?

```auto

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???

        }
        
      } 

```
