how to remove event listener
stop();
stage.addEventListener(Event.ENTER_FRAME,EntFrame);
function EntFrame(e:Event):void
{
//puzzle1
puzzle1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_5);
function fl_ClickToDrag_5(event:MouseEvent):void
{
puzzle1.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_5);
function fl_ReleaseToDrop_5(event:MouseEvent):void
{
puzzle1.stopDrag();
}
if (target1_mc.hitTestObject(puzzle1.tar1_mc))
{
puzzle1.x = 302.95;
puzzle1.y = 221.85;
}
//puzzle2
puzzle2.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_6);
function fl_ClickToDrag_6(event:MouseEvent):void
{
puzzle2.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_6);
function fl_ReleaseToDrop_6(event:MouseEvent):void
{
puzzle2.stopDrag();
}
if (target2_mc.hitTestObject(puzzle2.tar2_mc))
{
puzzle2.x = 447.65;
puzzle2.y = 219.15;
}
//puzzle3
puzzle3.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_7);
function fl_ClickToDrag_7(event:MouseEvent):void
{
puzzle3.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_7);
function fl_ReleaseToDrop_7(event:MouseEvent):void
{
puzzle3.stopDrag();
}
if (target3_mc.hitTestObject(puzzle3.tar3_mc))
{
puzzle3.x = 314.25;
puzzle3.y = 298;
}
//puzzle4
puzzle4.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_8);
function fl_ClickToDrag_8(event:MouseEvent):void
{
puzzle4.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_8);
function fl_ReleaseToDrop_8(event:MouseEvent):void
{
puzzle4.stopDrag();
}
if (target4_mc.hitTestObject(puzzle4.tar4_mc))
{
puzzle4.x = 460.8;
puzzle4.y = 297.9;
}
}
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/
movieClip_3.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(2);
}
****** I Had 5 type of puzzle and each puzzle is located in among 5 frame . When i play the swf , the error #1009 occur. I realize that i needed to remove the event listener .
****** For my next frame
stage.addEventListener(Event.ENTER_FRAME,EntFrame);
function EntFrame(e:Event):void
if i put the same code it will become duplicate .
should i just put like this ?
stage.addEventListener(Event.ENTER_FRAME,EntFrame2);
function EntFrame2(e:Event):void
