Hi, I agree, I think it's much clearer now.
The unofficial wiki is going to be folded into prototypejs.org content eventually, once A) It's dead easy to post prototypejs.org content (something that Tobie's been working on; he may be done now, I haven't checked lately), and B) I have a bit of time to transfer it over. :-) -- T.J. On Jul 21, 11:29 am, Guillaume Lepicard <[email protected]> wrote: > Hi TJ, > Thanks for pointing this ! > When I first read the API doc (in the "old" format), explanations were not > that clear or i misunderstoos them ; but then looking in the new API doc, > it's much more clear ; and thanks for the > proto-scripty.wikidot.com<http://proto-scripty.wikidot.com/prototype:tip-you-probably-don-t-nee...> > i > wasn't aware of ! > > On Wed, Jul 21, 2010 at 12:05 PM, T.J. Crowder > <[email protected]>wrote: > > > > > Hi Guillaume, > > > Just #bind is sufficient. You almost never need #bindAsEventListener: > > >http://proto-scripty.wikidot.com/prototype:tip-you-probably-don-t-nee... > > > -- T.J. :-) > > > On Jul 21, 10:18 am, Guillaume Lepicard <[email protected]> > > wrote: > > > Hi, you need to bind the listener function to your object: > > > $('box').addEventListener("click",this.takeAction.bindAsEventListener(this) > > ,false); > > > > more details: > >http://api.prototypejs.org/language/function/prototype/bindaseventlis... > > > > On Tue, Jul 20, 2010 at 7:13 PM, Doc Torbin <[email protected]> wrote: > > > > I have the following snippet of code which illustrates a problem that > > > > I'm having. I have an event listener within a class that I'd like to > > > > have be "self aware". I'd like it to be able to call another function > > > > within the Class but I haven't found the right method to have it do > > > > so. Please advise: > > > > > <!DOCTYPE html> > > > > <html> > > > > <head> > > > > <script type="text/javascript" > > > > src="../prototype.js"></script> > > > > <style type="text/css"> > > > > #box{position:fixed;width:100px;border:3px solid > > > > #000;background- > > > > color:#00ff00;font-size:14pt;font-weight:bold;text- > > > > align:center;padding:50px 25px;cursor:pointer;} > > > > </style> > > > > <script type="text/javascript"> > > > > var MyOBJ = new Class.create(); > > > > MyOBJ.prototype = { > > > > initialize: function(){ > > > > try{ > > > > > $('box').addEventListener("click",this.takeAction,false); > > > > } > > > > catch(error){alert(error);} > > > > }, > > > > takeAction: function(event){ > > > > alert("I got to this function > > > > without issue."); > > > > this.anotherAction(); > > > > }, > > > > anotherAction: function(){ > > > > alert("I won't get here."); > > > > } > > > > } > > > > > document.observe("dom:loaded", function(){ > > > > var spriteOBJ = new MyOBJ(); > > > > }); > > > > </script> > > > > </head> > > > > <body> > > > > <div id="box">BOX</div> > > > > </body> > > > > </html> > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "Prototype & script.aculo.us" group. > > > > To post to this group, send email to > > > > [email protected]. > > > > To unsubscribe from this group, send email to > > > > [email protected]<prototype-scriptaculou > > > > s%[email protected]><prototype-scriptaculou > > s%[email protected] <s%[email protected]>> > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/prototype-scriptaculous?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Prototype & script.aculo.us" group. > > To post to this group, send email to > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<prototype-scriptaculou > > s%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
