0

When I test or publish my project, which is a jigsaw puzzle from this tutorial: https://www.youtube.com/watch?v=uCQuUZs3UGE

Nothing gets drawn except the grey background. No puzzle pices nor any puzzle shape is drawn at all. I also get a warning:

WARNINGS: Frame numbers in EaselJS start at 0 instead of 1. For example, this affects gotoAndStop and gotoAndPlay calls. (17)

But that should just be a warning, not an error. So might there be an error in my javascript code? This is the code, its fairly simple:

//************
// Initialize;

var numPieces = 16;

for (var i = 0; i = < numPieces; i++) 
{
 var pieceName = "p" + (i + 1);
 var piece = this[pieceName];
 if (piece)
  {
  piece.name = pieceName;
  piece.on("mousedown", function(evt) 
   {
    this.scaleX = 1;
    this.scaleY = 1;
    this.shadow = null;
    this.parent.addChild(this);
    this.offset = (x:this.x - evt.stageX, y:this.y - evt.stageY);
   });
  piece.on("pressmove", function (evt) 
   {
    this.x = evt.stageX + this.offset.x;
    this.y = evt.stageY + this.offset.y;
   });
  piece.on("pressup", function(evt) 
   {
   var target = this.parent["t"+this.name.substr(1)];
   if (target && hitTestInRange(target, 30) ) 
    {
    this.x = target.x;
    this.y = target.y;
    }
   });
  }
}

function hitTestInRange( target, range ) 
{
 if (target.x > stage.mouseX - range &&
  target.x < stage.mouseX + range &&
  target.y > stage.mouseY - range &&
  target.y < stage.mouseY + range) 
  {
   return true;
  }
 return false;
}

I also included a screenshot of the project. screenshot

Thanks in advance

GAMIE64
  • 5
  • 2
  • 5
  • Any chance you can post the other code? Typically when you don't see anything on stage from an Animate publish, it is either due to an error (check the console), or a lack of the stage being updated. What is the scope of the code you published above? Is it in a frame script? Does `piece` evaluate to a symbol? A little more context might help. – Lanny Mar 09 '16 at 16:12
  • Note that the warning you posted shows for everyone as a reminder that the frame numbers are different. – Lanny Mar 09 '16 at 16:13

0 Answers0