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