Thanks Thomas, i have done this with a HashMap, it works . I've think it gose without a reference holder.
-----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 4. Januar 2006 14:53 An: [email protected] Betreff: Re: remove onClickListener Hi Tilo, "Tilo Behrmann" <[EMAIL PROTECTED]> wrote on 01/04/2006 08:14:57 AM: > can anybode tell me how i can remove a onClickListener from a circle > element? The listener passed to removeEventListener must be the actual listener that was passed to addEventListener, not simply one that is similar: > t.removeEventListener("click", > new OnClickLocationAction(e.getLocation(). > getDistrict().getName(), e.getLocationOldName(), disTree), > false); You will likely need to build a hash table with circle elements as keys and the registered listener as values. You might consider using a weak hash table if the circle elements are likely to be added and removed 'on the fly'. Also your code is very inefficient. So a few pointers, first, the DOMEvent passed to your 'OnClickLocationAction' includes the circle that was clicked so you shouldn't have to check every circle in the document. Second, I've told you before that you should only call getElementsByTagNameNS _once_, your code continues to call this for every iteration of the loop. > int length = > this.doc.getDocumentElement().getElementsByTagNameNS(this. > svgNS, "circle").getLength(); > for (int i = 0; i < length; i++) { > Element elm2 = (Element)this.doc.getDocumentElement(). > getElementsByTagNameNS(this. > svgNS, "circle").item(i); I'm only bringing this up again because I don't want others to think that this is "the right way" to do things. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
