Try this:
var dcb:Function = Delegate.create(controller,
controller.correctButton_OnRelease);
correctButton.addEventListener("onRelease", dcb);
...
correctButton.removeEventListener("onRelease", dcb);
[EMAIL PROTECTED] escribió:
The problem is this :
...
correctButton.addEventListener("onRelease", Delegate.create(controller,
controller.correctButton_OnRelease));
solutionButton.addEventListener("onRelease", Delegate.create(controller,
controller.solutionButton_OnRelease));
nextButton.addEventListener("onRelease", Delegate.create(controller,
controller.nextButton_OnRelease));
...
later on, I need to remove the listeners and for that it seems I need an
instance of each Delegate I created.
correctButton.removeEventListener("onRelease", controller) won't work.
I've been trying to change the EventDispatcher class and add
a function removeAllEventListeners, but I can't seem to make it work.
What I would want is to say :
correctButton.removeAllListeners --> removes all listeners from
correctButton for all events
ArpForm :
class org.osflash.arp.ArpForm extends MovieClip
{
//
// Properties
//
private static var eventDispatcherInitialized =
EventDispatcher.initialize(ArpForm.prototype);
////////////////////////////////////////////////////////////////////////
////
// Constructor
////////////////////////////////////////////////////////////////////////
////
public function ArpForm()
{
}
...
function addEventListener()
{
// Used by EventDispather mixin
}
function removeEventListener()
{
// Used by EventDispather mixin
}
function dispatchEvent()
{
// Used by EventDispather mixin
}
function dispatchQueue()
{
// Used by EventDispather mixin
}
function removeAllListeners()
{
}
EventDispatcher :
...
static function initialize(object:Object):Void
{
if (_fEventDispatcher == undefined)
{
_fEventDispatcher = new EventDispatcher();
}
object.addEventListener =
_fEventDispatcher.addEventListener;
object.removeEventListener =
_fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
object.removeAllListeners =
_fEventDispatcher.removeAllListeners;
}
...
function removeAllListeners():Void{
for(var i in this){
trace("i : " + i);
this[i] = new Array();
}
}
Met vriendelijke groeten,
Lieven Cardoen
MULTIMEDIALOFT | POINT X
Engelse Wandeling 2 K18v | 8500 Kortrijk | T +32 (0)56/36.11.97
// communicatie bij voorkeur op [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com