# Calling a Function from Inside a MovieClip

**URL:** https://forum.kirupa.com/t/calling-a-function-from-inside-a-movieclip/264451
**Category:** flash
**Created:** [June 26, 2008, 8:31am UTC](https://forum.kirupa.com/t/calling-a-function-from-inside-a-movieclip/264451 "2008-06-26T08:31:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ChromeDemon](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@ChromeDemon](https://forum.kirupa.com/u/ChromeDemon)
#### Post date: [June 26, 2008, 8:31am UTC](https://forum.kirupa.com/t/calling-a-function-from-inside-a-movieclip/264451/1 "2008-06-26T08:31:29Z")

</div>

Maybe I am dumb, but I cant get this to work …

I have an MC, inside this MC is a Button which calles a function declared in the Main Timeline … I dont get it, i always got errors … Any help much appreciated

cheers

ChromeD

---

<div class="post-metadata">

### Author: ![Lachhh](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@Lachhh](https://forum.kirupa.com/u/Lachhh)
#### Post date: [June 26, 2008, 1:38pm UTC](https://forum.kirupa.com/t/calling-a-function-from-inside-a-movieclip/264451/2 "2008-06-26T13:38:12Z")

</div>

What is your error exactly ?

On a first view, my guess will be that you are trying parent.parent.MyFct(). The problem is that parent is a DisplayObjectContainer and there is no MyFct in that class. So if you want to make an elegant solution you can instanciates your document to a class (In the publish settings) let’s says “Main”. Then you can cast your parent.parent in Main. : Main(parent.parent).MyFct().

But if you don’T want for any reason and your lazy you can make parent.parent"MyFct".

Hope that it help

Lachhh
