3

I am trying to adjust the Spritesheet exported JSON file so I can import the sprites with their position at their registration point.

In Flash I just add the offset which is frame.offsetInSource to the position but that doesn't works... This is how I export it now:

function frameExport(frame)
{

var s;
if (hitFrame)
    s = "\n,{\n";
else
    s = "\n{\n";
s += AddKeyRect("frame", frame.frame);
s+= ",\n";
var spriteSourceSize = new Object();
spriteSourceSize.x = frame.offsetInSource.x;
spriteSourceSize.y = frame.offsetInSource.y;
spriteSourceSize.w = frame.sourceSize.w;
spriteSourceSize.h = frame.sourceSize.h;
s += AddKeyRect("offset", spriteSourceSize);
s += "}";

hitFrame = true;

return s;
 }

How can I export this the good way, so their relative position is also exported as an offset variable? And are there also other variables you can use for this? I know you can use these variables:

frame.frame.x
frame.frame.y
frame.frame.w
frame.frame.h
frame.offsetInSource.x
frame.offsetInSource.y
frame.sourceSize.w
frame.sourceSize.h

Thanks in advance!

tversteeg
  • 4,717
  • 10
  • 42
  • 77

1 Answers1

3

I also tried to use Sprite Sheet Exporter to export the relative position of each frame. But I found, that in the metadata, the value of "frame.offsetInSource.x" is always zero. I guess that would be what I want, and what you want.

I tried to edit the JSON.plugin.jsfl, uncomment the traces. And sadly it's still zero.

Till now, I haven't figured it out why.

all4future
  • 51
  • 3