View comments | RSS feed

EventDispatcher.removeEventListener()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004 and Flash MX Professional 2004.

Usage

componentInstance.removeEventListener(event, listener)

Parameters

event  A string that is the name of the event.

listener A reference to a listener object or function.

Returns

Nothing.

Description

Method; unregisters a listener object from a component instance that is broadcasting an event.


Flash CS3


Comments


Bryce said on Mar 28, 2008 at 1:09 AM :
If you use mx.utils.Delegate for your listener object/function you need to
store the Delegate in a variable. Then use that variable as the listener/object
called from removeEventListener().

This following copied from:
http://www.mail-
archive.com/flashcoders@chattyfig.figleaf.com/msg01029.html


-----Original Message-----
The trouble is that Delegate.create _creates a new Function object_ - so the
Delegate object in your removeEventListener call is actually a different
object from in your addEventListener call.

To get around this, simply store the delegate - e.g.:

var myDelegate:Function=Delegate.create(this,fontsLoaded);

// ADD
fntController.addEventListener('onFinished',myDelegate);

// REMOVE
fntController.removeEventListener('onFinished',myDelegate);

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002939.html