2

I'm trying to load a json file exported from cocosstudio v2.3.2

var myScene = ccs.sceneReader.createNodeWithSceneFile('res/Scene.json');

I got this code from sample-cocos2d-js-scene-gui-master
The problem is, i get this error: Can't find the parser : undefined

How do i fix this issue?
I'm very new to using javascript and I hope someone can help me with this. Thank you.

cessmestreet
  • 2,298
  • 3
  • 22
  • 42

1 Answers1

4

try to use ccs.load("") It's new api. This function returns table {node, action} node it's your scene "node" and "action" it's a time line action it's optional.

Your code would look like this:

var sceneRes = ccs.load("res/Scene.json");
this.addChild(sceneRes.node);

And if you want use the action, just run it for node.

sceneRes.node.runAction(sceneRes.action);
sceneRes.action.gotoFrameAndPlay(0, true);

Hope this help, and sorry for my english

Dazlonar
  • 96
  • 3