boomshanka
05-28-2008, 11:09 PM
Hi,
i'm trying to remove an Event Listener that is inside another function . Is this possible ?
graph1.addEventListener(MouseEvent.MOUSE_DOWN, bar1drag);
graph1.addEventListener(MouseEvent.MOUSE_UP, bar1drop);
function bar1drag(event:MouseEvent):void
{
graph1.addEventListener(Event.ENTER_FRAME, bar1go);
function bar1go(event:Event):void
{
var currentY:Number = mouseY;
event.target.height = (currentY * -1) + 174.5;
}
}
function bar1drop(event:MouseEvent):void
{
graph1.removeEventListener(Event.ENTER_FRAME, bar1go);
// This is where it dies - doesn't recognise 'bar1go'
}
i'm trying to remove an Event Listener that is inside another function . Is this possible ?
graph1.addEventListener(MouseEvent.MOUSE_DOWN, bar1drag);
graph1.addEventListener(MouseEvent.MOUSE_UP, bar1drop);
function bar1drag(event:MouseEvent):void
{
graph1.addEventListener(Event.ENTER_FRAME, bar1go);
function bar1go(event:Event):void
{
var currentY:Number = mouseY;
event.target.height = (currentY * -1) + 174.5;
}
}
function bar1drop(event:MouseEvent):void
{
graph1.removeEventListener(Event.ENTER_FRAME, bar1go);
// This is where it dies - doesn't recognise 'bar1go'
}