Hi I am trying to use the spriteFrame to achieve a progress bar effect.
Basically I have a sprite in a node. Depending on the percent of progress is how much of that sprite I want ti display.
eg 0% = 0 width, 50% shows 50% of image.
Here is the code which is running in the update.
var sprite = this.singleGreenBarNode.getComponent(cc.Sprite);
var rect = sprite.spriteFrame.getRect();
rect.width = this.greenProgress
sprite.spriteFrame.setRect( rect );
It seems to update once but never again. Whats going wrong?