cocos2d / cocos2d-js

cocos2d-x for JS
http://www.cocos2d-x.org
MIT License
1.86k stars 490 forks source link

How to use layer defined by Cocos2d Studio? #1643

Open salipro4ever opened 9 years ago

salipro4ever commented 9 years ago

I have used Cocos2d Studio to create a layer (layer_main.json) and add some button to it. Now, i want load it in main scene and manipulate with buttons.

Can i put code in a separate file (like src/mainLayer.js) that defined by cc.Layer.extend({}). I try use ccs.load, ccs.uiReader. Can anyone help me?

Thanks!

jianglong0156 commented 9 years ago

You can use the codes to load the studio json.

var json = ccs.load(“xxx.json”);
layout = json.node;
this.addChild(layout);