# Function inside a MC

**URL:** <https://forum.kirupa.com/t/function-inside-a-mc/138394>\
**Category:** Uncategorized\
**Created:** [February 22, 2005, 11:17am UTC](https://forum.kirupa.com/t/function-inside-a-mc/138394 "2005-02-22T11:17:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashishchandras](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@ashishchandras](https://forum.kirupa.com/u/ashishchandras)\
**Post date:** [February 22, 2005, 11:17am UTC](https://forum.kirupa.com/t/function-inside-a-mc/138394/1 "2005-02-22T11:17:34Z")

</div>

Hi,

I have a MC in which there is a function:

//---------------------------------------------

\_global.testing = function(num:Number){  
trace("Display num: " + num);  
}

a.text = num; // one blank dynamic text field named “a”

//---------------------------------------------

On the scene:(main timeline 1st frame) following script is their…

var i=0;  
var x = 35;  
var y = 150;

while(i\<2){  
this.attachMovie(“mc”, “mc”+i, i)  
this[“mc”+i].\_x = x;  
this[“mc”+i].\_y = y  
testing(i); // this is not working  
this[“mc”+i].testing(i) //even this is not working…  
i++;  
x+=300;  
}

//-----------------------------

text field displays bank … and function is also not getting called…

Why I am not able to call a function inspite its being initialized as \_global from the main timeline…

* * *

aShIsH
