hi all,

i'm buliding an image slider object with the following code:

  1. function imageGalery(index, width){
  2. ...
  3. this.isScrolling = false;
  4. ...
  5. this.startScroll = function(){
  6. if(this.isScrolling == false){
  7. this.isScrolling = setInterval('galery'+index+'.scroll();',30);
  8. }
  9. }
  10. this.stopScroll = function(){
  11. clearInterval(this.isScrolling);
  12. this.isScrolling = false;
  13. }
  14. ...
  15. img = document.createElement('img');
  16. img.onmouseover = this.startScroll;
  17. img.onmouseout = this.stopScroll;
  18. ...
  19. }


the thing is that it start scrolling only on the second time i hover the img...

i'm guessing it's because the stopScroll method was already launched but i don't understand why declaring the property isn't enough.

i have also manged to bypass it by writing "eval('galery'+index)" (the object's name) instead of "this" on line 6. can someone explain?