getAnchorPointInPoints not works

Hi all,
I have a code like this:

@
var sprite = cc.Sprite.create(“sprite.png”);
sprite.setAnchorPoint(cc.p(0.5, 0.5));
console.log(sprite.getAnchorPointInPoints()); // x: 0, y: 0
@

The sprite has a content size of (42, 42), so the getAnchorPointInPoints must return (21, 21) ?
However, it always returns (0, 0) , and when I rotate the sprite, it will rotate around its (0, 0) position.
How can I solve this?

Do you preload this resource?

Because browser load resource is Asynchronous, so you need preload resource before create sprite.

In HelloHTML5World testcase, we define list of preload resources in src/resource.js。

dingping lv wrote:

Do you preload this resource?
>
Because browser load resource is Asynchronous, so you need preload resource before create sprite.
>
In HelloHTML5World testcase, we define list of preload resources in src/resource.js。

Yes, I preloaded images before using them. Furthermore, logging the sprite.getContentSize() after defining sprite, gets the correct size of image.

I think this is a bug?!

Fixed!
For others that have a same problem:
move the following code to the last of “init” and “initWithTexture” functions in CCSprite.js file:
// default transform anchor: center this.setAnchorPoint(cc.p(0.5, 0.5));

The fixed CCSprite.js has been attached.