How to change spriteFrames from local file in cocos creator 2.0

I was using this code in cocos 1.9 version but I does not work new version of cocos creator.

var ballTexture = cc.textureCache.addImage(cc.url.raw(“Texture/balls/ball1.png”));
this.ball.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(ballTexture);

I have seen the update guide but I cannot solve this problem.

I used this code and solved the problem

var self = this;
cc.loader.loadRes(‘balls/ball1.png’, cc.SpriteFrame, function (err, ballSprite) {
self.ball.getComponent(cc.Sprite).spriteFrame = ballSprite;
});