# Defining a function dynamically... from a different MC

**URL:** <https://forum.kirupa.com/t/defining-a-function-dynamically-from-a-different-mc/129180>\
**Category:** Uncategorized\
**Created:** [November 20, 2004, 3:12pm UTC](https://forum.kirupa.com/t/defining-a-function-dynamically-from-a-different-mc/129180 "2004-11-20T15:12:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveistheword](https://avatars.discourse-cdn.com/v4/letter/d/b3f665/32.png) [@daveistheword](https://forum.kirupa.com/u/daveistheword)\
**Post date:** [November 20, 2004, 3:12pm UTC](https://forum.kirupa.com/t/defining-a-function-dynamically-from-a-different-mc/129180/1 "2004-11-20T15:12:14Z")

</div>

Hi. I’m building a script that adds a textfield to a movieclip. I need to add an onkillfocus event to that textfield that will make it call a certain function, which is located in the movieclip where the textfield will reside. The trouble is that I’m creating the textbox in a script in a completely different movieclip, and I’m having trouble getting the event to find the function.

\_root[“item”+x][“labelText”+y].onKillFocus = function() { labelEmpty(this.\_name) };

The absolute path to this function is \_root[“item”+x].labelEmpty

How do I get this event to call the labelEmpty function? Thanks a lot for helping me out.
