On Jan 1, 9:01 am, "Alexandre Plennevaux" <aplennev...@gmail.com>
wrote:
> Hello mates,
>
> i have an object datascape which among other things, contains a
> property storing the mouse position, and a function that uses that
> property. Inside another method i
>
> var datascape = {
> 'mouseX': 0,
> 'myInterval': 0,
> 'create': function(){
> $('#datascape').bind('mousemove', function(e)
> {
> this.mouseX = e.pageX;
> }).bind("mouseover", function()
> {
> this.myInterval = setInterval(this.move, 200);
>
> }).bind("mouseout", function()
> {
> clearInterval(this.myInterval);
> });
> },
>
> 'move': function(){
> $.log('datascape.move : mouseX = ' + this.mouseX);
> }
>
> }
>
> Yet the script does not work:
> firebug console points at the setInterval call, saying:
>
> useless setInterval call (missing quotes around argument?)http://localhost/prototype/_js/frontend/proto.03.js
> Line 172
>
> can someone help me / explain what i'm doing wrong ?
>
> Thank you,
>
> Alexandre
>
> PS: to all jquerians: happy 2009 !!
Thursday, January 1, 2009
[jQuery] Re: setInterval(obj.method,200) problem: scoping?
You should change 'move' to move (remove apostrophes).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment