aurelplouf
November 11th, 2008, 03:52 AM
I know this has been asked and I read a lot of articles and forum threads and I am still really confused.
Currently I am building a website with a couple of menu buttons which load external SWF.
Every time i click on another button, i remove the SWF child. But I quickly realized that in AS3 it does not completely remove the swf.
Therefore I want to remove the listeners from these external SWF when I click on another menu buttons.
I also wish to remove all the Display Objects from the SWF.
in my AS I have the following:
My mainStage.as
public function inViewBtnClick(event:MouseEvent):void {
removeChildAt(2);
innerRingBtn.buttonMode=true;
outRingBtn.buttonMode=false;
var planeTestA:URLRequest=new URLRequest("planeTestA.swf");
var planeTestALoader:Loader=new Loader;
planeTestALoader.load(planeTestA);
addChildAt(planeTestALoader,2);
removeChildAt(3);
addChildAt(outRingBtn,3);
outRingBtn.x=22;
outRingBtn.y=710;
outRingBtn.buttonMode=true;
outRingBtn.mouseChildren=false;
}
public function outViewBtnClick(event:MouseEvent):void {
removeChildAt(2);
outRingBtn.buttonMode=true;
innerRingBtn.buttonMode=false;
var planeTestB:URLRequest=new URLRequest("planeTestB.swf");
var planeTestBLoader:Loader=new Loader;
planeTestBLoader.load(planeTestB);
addChildAt(planeTestBLoader,2);
removeChildAt(3);
addChildAt(innerRingBtn,3);
innerRingBtn.x=22;
innerRingBtn.y=710;
innerRingBtn.buttonMode=true;
innerRingBtn.mouseChildren=false;
}
and in one of my external SWF I have this from the AS file (planeTestA.as)
private function initListeners():void {
//setting up listeners
addEventListener(Event.ENTER_FRAME, render);
planeA.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickA);
planeA.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverA);
planeA.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutA);
planeB.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickB);
planeB.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverB);
planeB.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutB);
planeC.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickC);
planeC.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverC);
planeC.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutC);
planeD.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickD);
planeD.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverD);
planeD.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutD);
planeE.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickE);
planeE.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverE);
planeE.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutE);
}
So the big question is How do I remove the eventListener ENTER_FRAME in my planeTestA.swf from my mainStage.as
Side notes: I currently use Flash Player 9. I heard some nasty stuff from this page
http://www.gskinner.com/blog/archives/2008/04/failure_to_unlo.html
Thank you in advance for the help ;)
Best
Aurel
Currently I am building a website with a couple of menu buttons which load external SWF.
Every time i click on another button, i remove the SWF child. But I quickly realized that in AS3 it does not completely remove the swf.
Therefore I want to remove the listeners from these external SWF when I click on another menu buttons.
I also wish to remove all the Display Objects from the SWF.
in my AS I have the following:
My mainStage.as
public function inViewBtnClick(event:MouseEvent):void {
removeChildAt(2);
innerRingBtn.buttonMode=true;
outRingBtn.buttonMode=false;
var planeTestA:URLRequest=new URLRequest("planeTestA.swf");
var planeTestALoader:Loader=new Loader;
planeTestALoader.load(planeTestA);
addChildAt(planeTestALoader,2);
removeChildAt(3);
addChildAt(outRingBtn,3);
outRingBtn.x=22;
outRingBtn.y=710;
outRingBtn.buttonMode=true;
outRingBtn.mouseChildren=false;
}
public function outViewBtnClick(event:MouseEvent):void {
removeChildAt(2);
outRingBtn.buttonMode=true;
innerRingBtn.buttonMode=false;
var planeTestB:URLRequest=new URLRequest("planeTestB.swf");
var planeTestBLoader:Loader=new Loader;
planeTestBLoader.load(planeTestB);
addChildAt(planeTestBLoader,2);
removeChildAt(3);
addChildAt(innerRingBtn,3);
innerRingBtn.x=22;
innerRingBtn.y=710;
innerRingBtn.buttonMode=true;
innerRingBtn.mouseChildren=false;
}
and in one of my external SWF I have this from the AS file (planeTestA.as)
private function initListeners():void {
//setting up listeners
addEventListener(Event.ENTER_FRAME, render);
planeA.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickA);
planeA.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverA);
planeA.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutA);
planeB.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickB);
planeB.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverB);
planeB.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutB);
planeC.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickC);
planeC.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverC);
planeC.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutC);
planeD.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickD);
planeD.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverD);
planeD.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutD);
planeE.addEventListener(InteractiveScene3DEvent.OB JECT_CLICK, onShowcaseClickE);
planeE.addEventListener(InteractiveScene3DEvent.OB JECT_OVER, onShowcaseOverE);
planeE.addEventListener(InteractiveScene3DEvent.OB JECT_OUT, onShowcaseOutE);
}
So the big question is How do I remove the eventListener ENTER_FRAME in my planeTestA.swf from my mainStage.as
Side notes: I currently use Flash Player 9. I heard some nasty stuff from this page
http://www.gskinner.com/blog/archives/2008/04/failure_to_unlo.html
Thank you in advance for the help ;)
Best
Aurel