Im trying to create a scale9sprite from a texture locate inside a spritesheet.
The spritesheet is made with texturepacker with rotation allowed.
Im having an error, load image failed, but all is correct.
This is the code.
var fg = new cc.Scale9Sprite("#scale9ui.png");
fg.setCapInsets(cc.rect(44, 44, 44, 44));
fg.setContentSize(cc.size(310, 470));
fg.setPosition(cc.winSize.width / 2, cc.winSize.height / 2);
this.addChild(fg);
Whats the problem??
Is not possible to load scale9sprites from spritesheets?
There a few more steps to load a sprite from a spritesheet. Look at this tutorial for more information. A step not explicitly mentioned is that you need to preload the spritesheet (plist and png) in the resource.js file.
Hehehe I know I know. I did all the required steps.
I can load a sprite from a sheet without problem. The problem is only with scale9 from a spritesheet.
The cocos team is working hard on improving the documentation, in the mean time the best way to see how a class can be used is to look at the tests. The ‘#’ is used when loading a Sprite to reference a spriteFrame instead of a file name, it seems Scale9Sprite doesn’t use this convention. Using single or double quotes won’t matter for a string.