# Feeding array data into a function call

**URL:** <https://forum.kirupa.com/t/feeding-array-data-into-a-function-call/291216>\
**Category:** Uncategorized\
**Created:** [June 26, 2009, 11:19am UTC](https://forum.kirupa.com/t/feeding-array-data-into-a-function-call/291216 "2009-06-26T11:19:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [June 26, 2009, 11:19am UTC](https://forum.kirupa.com/t/feeding-array-data-into-a-function-call/291216/1 "2009-06-26T11:19:39Z")

</div>

Hi - if you look at the code:: barn is an instance of an MC on stage.  
I have a few buttons stored in an array which i want to attach scripts with a for loop.  
Why does adding an item from the array not work when placed inside the function call?

```auto

var characters:array = new Array("barn");
function over()
{
    dosomthing();
}
function attachScripts(mc)
{
    mc.onRollOver = over;
    mc.forceSmoothing = true;
}

////////////////method below works/////////////
attachScripts(barn);

////////////method below does not work////////////
for(i=0;i<characters.length;i++)
{
      attachScripts(characters*);
}

```

Thanks!!
