How change a new sprite frame in native

How change a new sprite frame in native
0.0 0

#1

Hello,

I’m trying to run my js - application as native.
I have a problem with displaying sprites created without a texture at start. (The web version works well)
for example #1:

var sprite = new cc.Sprite(); // empty texture -> 0 arguments
sprite.setSpriteFrame('#image0000')

then I don’t see the frame in native !
but this test-code is working for me #2:

var sprite = new cc.Sprite( fileName_or_frame ); // any existing frame or texture
sprite.setSpriteFrame('#image0000')

How can I use the first option (without texture or frame)?

Thanks


#2

Hei,

I check with 3.14.1 c++:

        SpriteFrameCache::getInstance()->addSpriteFramesWithFile("AllSprites.plist");
        auto spr = Sprite::create();
        spr->setSpriteFrame("AddCoinButton.png");
        addChild(spr);

it works fine.