# How do I access functions in Main Time line

**URL:** <https://forum.kirupa.com/t/how-do-i-access-functions-in-main-time-line/292499>\
**Category:** Uncategorized\
**Created:** [July 14, 2009, 11:36pm UTC](https://forum.kirupa.com/t/how-do-i-access-functions-in-main-time-line/292499 "2009-07-14T23:36:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wraj](https://avatars.discourse-cdn.com/v4/letter/w/41988e/32.png) [@wraj](https://forum.kirupa.com/u/wraj)\
**Post date:** [July 14, 2009, 11:36pm UTC](https://forum.kirupa.com/t/how-do-i-access-functions-in-main-time-line/292499/1 "2009-07-14T23:36:32Z")

</div>

Hey I’m fairly new to AS3. Here’s my issue.

lets say for example, on the main time line i have a function

[COLOR=RoyalBlue]function myFunction(num:Number)  
{  
trace(num);  
}

[COLOR=Black]and I add a movie clip btnSm to the stage like this.

[COLOR=RoyalBlue]var btnSm:MovieClip = new BtnSmall();  
stage.addChild(btnSm);  
[/COLOR][/COLOR][/COLOR]  
and lets say inside btnSm’s timeline has an event that calls myFunction on mouse click, for example

[COLOR=RoyalBlue]var btnNumber;

this.addEventListener(MouseEvent.CLICK, gotoLink);

function gotoLink(event:MouseEvent)  
{  
trace(btnNumber);  
stage.[/COLOR][COLOR=RoyalBlue]myFunction(btnNumber);  
}  
[/COLOR]  
and This wont work for me. I tried root.myFunction(btnNumber)  
I tried MovieClip(root).myFunction(btnNumber), none would work.

[COLOR=Red]So, How can I access a function on the main timeline in AS3? [/COLOR] In AS2.0 you can do this by \_root.myFunction();

appreciate your help  
thank you
