-
how to remove listener
Can anyone tell me how I can remove the listener on this (also I don't know what happened but the text shows up in the dynamic text box as "eo o"):
code:
stop();
outp.text = "Hello World";
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/
q1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
function fl_ClickToDrag(event:MouseEvent):void
{
q1.startDrag();
}
q2.addEventListener(MouseEvent.MOUSE_DOWN, f_ClickToDrag);
function f_ClickToDrag(event:MouseEvent):void
{
q2.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
function fl_ReleaseToDrop(event:MouseEvent):void
{
q1.stopDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, f_ReleaseToDrop);
function f_ReleaseToDrop(event:MouseEvent):void
{
q2.stopDrag();
}
import flash.events.Event;
q1.addEventListener( Event.ENTER_FRAME, handleCollision)
function handleCollision( e:Event ):void
{
if(q1.hitTestObject(ans))
{
outp.text = "Correct";
}else {
if(q2.hitTestObject(ans)) {
outp.text = "Wrong"
gotoAndStop(10);
}
}
}
-
.
Hi,
You must embed the font in the library to make it show correctly, as for removing the listener, try this.
It's shortened down a bit and I'm not sure which listener you wish to remove, but you can see where it is now
PHP Code:
stop();
import flash.events.Event;
outp.text = "Hello World";
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/
stage.addEventListener(MouseEvent.MOUSE_UP, f_ReleaseToDrop);
q1.addEventListener(MouseEvent.MOUSE_DOWN, f_ClickToDrag);
q2.addEventListener(MouseEvent.MOUSE_DOWN, f_ClickToDrag);
function f_ClickToDrag(event:MouseEvent):void
{
event.currentTarget.startDrag();
}
function f_ReleaseToDrop(event:MouseEvent):void
{
stopDrag();
}
q1.addEventListener(Event.ENTER_FRAME, handleCollision);
function handleCollision( e:Event ):void
{
if (q1.hitTestObject(ans))
{
outp.text = "Correct";
q1.removeEventListener(Event.ENTER_FRAME, handleCollision);
}
else
{
if (q2.hitTestObject(ans))
{
outp.text = "Wrong";
gotoAndStop(10);
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|