Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17082

SpriteFrame constructor in CocosCreator 1.1.2

$
0
0

@kaka167 wrote:

Hi all
I use

var spriteFrame = new cc.SpriteFrame( texture );

and got this warning:

It's not recommended to use SpriteFrame constructor (new SpriteFrame) to create SpriteFrame instance since it's memory will be unable to manage. Instead please use cc.loader.loadRes to get SpriteFrame instance from loading, or define a cc.SpriteFrame property in your component and drag the SpriteFrame onto it.
Then i switch to
cc.loader.load(avatarLink, function(err, texture){
// i need spriteFrame, how to get it from texture
self.avatar.getComponent(cc.Sprite).spriteFrame= ?????;
});

My question is how to set sprifreFrame when loader.load load successfull

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17082

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>