# Preloader and function to a child

**URL:** <https://forum.kirupa.com/t/preloader-and-function-to-a-child/310421>\
**Category:** Uncategorized\
**Created:** [June 9, 2010, 5:47pm UTC](https://forum.kirupa.com/t/preloader-and-function-to-a-child/310421 "2010-06-09T17:47:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvinatea](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@dvinatea](https://forum.kirupa.com/u/dvinatea)\
**Post date:** [June 9, 2010, 5:47pm UTC](https://forum.kirupa.com/t/preloader-and-function-to-a-child/310421/1 "2010-06-09T17:47:23Z")

</div>

I have a main.swf which loads 4 external swf’s and added preoladers to each that is a swf.  
I need to comunicate one of my external swf (m3.swf) with the main.swf.  
m3.swf has buttons and my purpose is that when you click a button, the menu of the main.swf disappears.  
First I tried without a m3.swf preloader and it works.  
**the code of the main class:**  
public function menuEstInv(eventObject:MouseEvent) {  
containerMenu.visible=false; }  
public function menuInv() {  
addEventListener(MouseEvent.CLICK, menuEstInv);  
}

\*\*and the m3.swf: \*\*  
function active(e:MouseEvent):void {  
var parentObjInv:Object = this.parent.parent as Object;  
parentObjInv.menuInv();  
}

**preloader\_m3.swf:**  
var l:Loader = new Loader();  
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);  
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);  
l.load(new URLRequest(“m3.swf”));  
function loop(e:ProgressEvent):void  
{  
var perc:Number = e.bytesLoaded / e.bytesTotal;  
percent.text = Math.ceil(perc\*100).toString()+"%";  
maskFondo.scaleX=perc;  
}  
function done(e:Event):void  
{  
removeChildAt(0);  
percent.visible=false;  
maskFondo.visible=false;  
addChild(l);  
}

The problem comes when I add a preloader to m3.swf (preloader\_m3.swf). The error is: TypeError: Error #1006: menuInv is not a function.  
at m3\_fla::MainTimeline/active()

I think “m3.swf” is a child of “preloader\_m3.swf” but when I put “var parentObjInv:Object = this.parent.parent.parent as Object;” and the error is: ReferenceError: Error #1069: Property menuInv not found on flash.display.Loader and there is no default value.  
I don’t know what else to do.  
Thank you
