It doesn't matter, because it is the EventListener object that is validated
when it is added. It tests for whether, or not, the eventlistener is
already attached to the layer and doesn't do anything with the listener's
methods.
Along the same thought process, is it worth puttting a set of default
methods in the EventListener prototype and remove the test for an events
existance?
Doug Melvin wrote:
> Also, isn't it faster, or more efficient to declare the functions of an
> event object before adding it?
> i.e;
>
> declare: var el = new EventListener(DynAPI.document);
>
> define: el.onmouseup=function(evt){ alert('up it!') }
>
> add : DynAPI.document.addEventListener(el);
>
> ----- Original Message -----
> From: "martin str�m" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, October 23, 2001 4:07 AM
> Subject: RE: [Dynapi-Help] catching "onClick"-events
>
> > onclick have to be lower-case:
> >
> > imageListener.onclick=function(e) {objLarge()}
> >
> > /martin
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]] On Behalf Of Kasper
> > Schnell
> > Sent: den 23 oktober 2001 08:51
> > To: [EMAIL PROTECTED]
> > Subject: [Dynapi-Help] catching "onClick"-events
> >
> >
> > Hello everybody.
> >
> > I have problems making a DynLayer (or DynImage) catching the
> > onClick-event.
> > It's tested in IE5, NS4.75 and NS6 (my OS is WIN2000), but it doesn't
> > work in any of them
> > Why is that?
> >
> > Here is a code snippet:
> >
> > DynAPI.onLoad=function() {
> > backClick = DynImage.getImage('../billeder/hjemmelavet/back_cl.gif');
> > myLayer = new DynLayer(null,300,300,50,50,"red")
> > myImage = new DynImage()
> > myImage.moveTo(100,100)
> > myImage.setSize(70,70)
> > myImage.setImage(backClick)
> > DynAPI.document.addChild(myImage);
> > DynAPI.document.addChild(myLayer);
> >
> > imageListener=new EventListener(myImage)
> > myImage.addEventListener(imageListener)
> > imageListener.onClick=function(e) {objLarge()}
> > imageListener.onmouseover=function(e){objGrow() }
> > imageListener.onmouseout=function(e) {objShrink()}
> >
> > myListener=new EventListener(myLayer)
> > myLayer.addEventListener(myListener)
> > myListener.onClick=function(e) {layerLarge()}
> > }
> >
> >
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/dynapi-help
> >
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help
--
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help