Scale9Sprite from spritesheet

Hi,

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.

Finally got it working with this…
var fg = new cc.Scale9Sprite(‘scale9ui.png’);

Im a bit lost with the use of double quotes, single quote, hash…
Is this explained somewhere else??

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.

thanks @araker! Understood!
Yep, all docs are still a bit messy but the engine is so so promising that I can only be grateful to the team :slight_smile: