[Proto-Scripty] Re: Calling function passed as parameter

2009-02-17 Thread T.J. Crowder
Hi, What's the error? -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Feb 17, 10:53 am, marioosh marioosh@gmail.com wrote: I have a problem with calling function passed as parameter in class definition. I get error when i call

[Proto-Scripty] Re: Calling function passed as parameter

2009-02-17 Thread david
Hi marioosh, I did a test, and there is no error !! just at : --- ! ERROR !! -- david On 17 fév, 12:14, T.J. Crowder t...@crowdersoftware.com wrote: Hi, What's the error? -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services

[Proto-Scripty] Re: Calling function passed as parameter

2009-02-17 Thread marioosh
On 17 Lut, 12:14, T.J. Crowder t...@crowdersoftware.com wrote: Hi, What's the error? -- Error: Cannot convert undefined or null to Object Slider class is a base class and doit() method is redefined in subclasses. I see that calling fun() works, but i get error in redefined method doit().

[Proto-Scripty] Re: Calling function passed as parameter

2009-02-17 Thread david
Hi craig, I've tested the following code, and it works in FF3 !! !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http:// www.w3.org/TR/xhtml1/DTD/... html xmlns=http://www.w3.org/1999/xhtml; head script src=prototype.js type=text/javascript/script script

[Proto-Scripty] Re: Calling function passed as parameter

2009-02-17 Thread T.J. Crowder
Hi, I'll bet this is the problem line: this.minimize(this.doit); You're assuming that 'this' is somehow bound to 'doit' when you pass the reference. It isn't. When you later call fun(), 'this' is not set to what you think it is within the call. JavaScript functions are functions, not

[Proto-Scripty] Re: Calling function passed as parameter

2009-02-17 Thread david
Hi marioosh, TJ is right, when you call the doit function via fun, the 'this' value is equal to Object window. So you need a little more binding to resolve your problem: replace the call to this.minimize(this.doit); by this.minimize (this.doit.bind(this)); -- david On 17 fév, 15:33, T.J.

[Proto-Scripty] Re: Calling function passed as parameter

2009-02-17 Thread marioosh
I see...yes, that works! thanks very much!! :D ps: sorry for my english ;) On 17 Lut, 18:41, david david.brill...@gmail.com wrote: Hi marioosh, TJ is right, when you call the doit function via fun, the 'this' value is equal to Object window. So you need a little more binding to resolve your