Cocos2D-JS无法加载从CocosStudio导出的json文件 [英] Cocos2D-JS can't load json file exported from CocosStudio

查看:197
本文介绍了Cocos2D-JS无法加载从CocosStudio导出的json文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试加载从cocosstudio v2.3.2导出的json文件

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

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



我有这个代码 sample-cocos2d-js-scene-gui- master

问题是,我得到这个错误:找不到解析器:undefined


如何解决这个问题?

我是使用javascript的新手,我希望有人能帮助我。
谢谢。

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.

推荐答案

code>这是新的api。这个函数返回表 {node,action} 节点它是你的场景节点和动作它是一个时间线操作,它是可选的。


你的代码看起来像这样:

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

这篇关于Cocos2D-JS无法加载从CocosStudio导出的json文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆