Ver Mensaje Individual
  #11 (permalink)  
Antiguo 29/01/2010, 22:37
Avatar de ClubIce
ClubIce
 
Fecha de Ingreso: diciembre-2008
Mensajes: 216
Antigüedad: 15 años, 4 meses
Puntos: 2
Respuesta: Pausar Ejecucion de JS

Hola, aqui estoy de nuevo, ya estoy arreglando el anterior script y se me presenta un error:

Código Javascript:
Ver original
  1. Animation=function(spr,spd) {
  2.  this.initialize({
  3.   sprite:spr,
  4.   speed:spd,
  5.   frames:[]
  6.  });
  7. }
  8. Animation.prototype={
  9.  addFrame: function (id) {
  10.   spr=this
  11.   this.frames[frames.length]={
  12.    id:id,
  13.    sprite:"url('"+spr.sprite.image.src+"') "+spr.sprite.frames[id].x+"px "+spr.sprite.frames[id].y+"px;"
  14.   }
  15.  },
  16.  drawAnimation:function (container, id) {
  17.   image=document.createElement('img')
  18.   image.setAttribute('src','empy.gif')
  19.   image.setAttribute('style',"background:"+this.frames[0].sprite)
  20.   image.setAttribute('class','animation')
  21.   image.setAttribute('width',this.sprite.width)
  22.   image.setAttribute('height,this.sprite.height')
  23.   image.setAttribute('id',id)
  24.   container.appendChild(image)
  25.   this.id=id
  26.   this.Play();
  27.  }
  28. }
  29. avatar=new Sprite('sprites/avatars/ash_walking.gif',28,38,0,0,0,2,3,4);
  30. aniAvatar=new Animation(avatar,5);
  31. aniAvatar.addFrame(0);

al ejecutarlo me muestra el siguiente error:
Error: spr.sprite.image is undefined
Archivo de origen: http://localhost/icepokemon/index.htm
Línea: 35

en realidad es que no se como acceder a this.sprite.image.src dentro de otra la inicializacion de otro???