Friday, December 2, 2022
HomeGame DevelopmentDynamic animation in runtime | Error in getSpriteFrames() methodology - Cocos Creator

Dynamic animation in runtime | Error in getSpriteFrames() methodology – Cocos Creator


Cocos Creator Model – 2.4.7
Intent – To load a spriteAtlas from the server and dynamically animate it utilizing code.
I used cc.assetManager.loadRemote() to get the .plist file and was attempting to get every frames(SpriteFrame) from that .plist file.
However getting error on this methodology – .getSpriteFrames()
The Error – Simulator: ERROR: Uncaught TypeError: sp.getSpriteFrame isn’t a perform, location: dst/belongings/Script/Animation/DynamicAnimation.js:0:0
The Code :-
CreateSprite()
{
let fileFullPath = jsb.fileUtils.getWritablePath() + “sprSht2-Splash-loadingAnim.plist”;
// sprSht2-Splash-loadingAnim.plist – is my file title
cc.assetManager.loadRemote(fileFullPath, cc.SpriteAtlas, perform (err, sp:cc.SpriteAtlas)
{
if(err)

else
{
var fa = sp.getSpriteFrames();
//code getting caught on the above line.
if(!fa)
{
cc.log(“error in fa”);
}
else
{
cc.log(“No error in fa”)
}
return;
}
});
}
Any leads concerning the question is very appreciated.


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments