Jump to content

frameId does not exist in the texture cache


EvanTheMan
 Share

Recommended Posts

Below is the code for SpriteSheet.json:

{"frames": {"bunny.png":{	"frame": {"x":208,"y":2,"w":26,"h":37},	"rotated": false,	"trimmed": false,	"spriteSourceSize": {"x":0,"y":0,"w":26,"h":37},	"sourceSize": {"w":26,"h":37},	"pivot": {"x":0.5,"y":0.5}},"walking001.png":{	"frame": {"x":2,"y":2,"w":42,"h":42},	"rotated": false,	"trimmed": false,	"spriteSourceSize": {"x":0,"y":0,"w":42,"h":42},	"sourceSize": {"w":42,"h":42},	"pivot": {"x":0.5,"y":0.5}},"walking002.png":{	"frame": {"x":46,"y":2,"w":42,"h":42},	"rotated": false,	"trimmed": false,	"spriteSourceSize": {"x":0,"y":0,"w":42,"h":42},	"sourceSize": {"w":42,"h":42},	"pivot": {"x":0.5,"y":0.5}},"walking003.png":{	"frame": {"x":134,"y":2,"w":38,"h":42},	"rotated": false,	"trimmed": true,	"spriteSourceSize": {"x":2,"y":0,"w":38,"h":42},	"sourceSize": {"w":42,"h":42},	"pivot": {"x":0.5,"y":0.5}},"walking004.png":{	"frame": {"x":174,"y":2,"w":32,"h":42},	"rotated": false,	"trimmed": true,	"spriteSourceSize": {"x":5,"y":0,"w":32,"h":42},	"sourceSize": {"w":42,"h":42},	"pivot": {"x":0.5,"y":0.5}},"walking005.png":{	"frame": {"x":90,"y":2,"w":42,"h":42},	"rotated": false,	"trimmed": false,	"spriteSourceSize": {"x":0,"y":0,"w":42,"h":42},	"sourceSize": {"w":42,"h":42},	"pivot": {"x":0.5,"y":0.5}}},"meta": {	"app": "http://www.codeandweb.com/texturepacker",	"version": "1.0",	"image": "SpriteSheet.png",	"format": "RGBA8888",	"size": {"w":236,"h":46},	"scale": "1",	"smartupdate": "$TexturePacker:SmartUpdate:395c3df21da85607d6705b30c9e8c168:204ecd49cc53349968e6c2da1202ab95:160eb6758fe4007ba8592b420f92bb0b$"}}

Below is the code for Game.js:

var RENDER_WIDTH = 800;var RENDER_HEIGHT = 600;// create an new instance of a pixi stagevar stage = new PIXI.Stage(0x66FF99);// create a renderer instancevar renderer = PIXI.autoDetectRenderer(RENDER_WIDTH, RENDER_HEIGHT);// add the renderer view element to the DOMdocument.body.appendChild(renderer.view);var assetsToLoader = ["sprites/SpriteSheet.json"];loader = PIXI.AssetLoader(assetsToLoader);loader.onComplete = onLoadedGame();loader.load();function onLoadedGame() {	var ninja = new PIXI.Sprite.fromFrame("walking001.png");	ninja.anchor.x = 0.5;	ninja.anchor.y = 0.5;		ninja.position.x = RENDER_WIDTH / 2;	ninja.position.y = RENDER_HEIGHT / 2;		requestAnimFrame( animate );}function animate() {		// just for fun, lets rotate mr rabbit a little	ninja.rotation += 0.1;		var now = new Date().getTime();	var time = now * 0.002;	ninja.position.x = (Math.sin( time ) * 96 + 128) + RENDER_WIDTH / 4;	ninja.position.y = (Math.cos( time * 0.9 ) * 96 + 128) + RENDER_HEIGHT / 4;		// render the stage   	renderer.render(stage);}

Here is a picture of the error:

238ndVO.png

Here is the text of the error:

Uncaught Error: The frameId "walking001.png" does not exist in the texture cache[object Object] pixi.js:12

 

Does anyone know how I can get this working?  I'm basically trying to use images from a spritesheet made by TexturePacker.

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...