Patches item #411879, was updated on 2001-03-28 04:45
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305757&aid=411879&group_id=5757

Category: None
Group: None
Status: Open
Priority: 5
Submitted By: Christof Pohl (chripo)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug in PathAnimation.prototype.run()

Initial Comment:
The following "if" statement decides what to do at the end of an animation (loop, 
reset or simply stop):

  if (anim.frame>=anim.length/2+1) {
    if (anim.loops) {
      anim.frame = 0;
    }
    else if (anim.resets) {
      anim.frame = 0;
      if (this.dlyr!=null) this.dlyr.moveTo(anim[0],anim[1]);
      this.stopAnimation();
      return;
    }
    else {
      anim.frame = 0;
      this.stopAnimation();
      return;
    }
  }



Unfortunately, the first "if" statement

  if (anim.frame>=anim.length/2+1)

is wrong: it must be

  if (anim.frame>=anim.length/2)

or there will be one more call of PathAnimation.run(), which will try to do the 
following:

  this.newX = anim[anim.frame*2];
  this.newY = anim[anim.frame*2+1];

  if (this.dlyr!=null) {
    this.dlyr.invokeEvent("pathrun");
    this.dlyr.moveTo(this.newX,this.newY);
  }



Let's say anim.length=10 (anim[0] ... anim[9] do exist) and anim.frame=5. Then 
(5>=10/2+1) => 
(5>=6) will return false. But anim[5*2] and anim[5*2+1] (as used in the moveTo() 
command) are 
undefined.



Luckily, this will not produce an error in IE 5.5 (no other IE versions tested), but 
in NS4:

  DynAPI reported an error

  Error in file "[...]/api/dynlayer.js".
  Line Number: 187.

  Message: Can't convert this.x to an integer

The value of "this.x" is "undefined" at the time this error message appears (as 
expected, because 
moveTo(undefined,undefined) was called by PathAnimation.run()).

Please update "pathanim.js" (line 71 in CVS version from 28/03/2001).



Best regards,

Christof

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305757&aid=411879&group_id=5757

_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev

Reply via email to