Hai
,
Right now I want to use the cocos studio I created a new project in cocos studio.
I wanted to know how can i use .csd file created in cocos studio into cocos studio js.
-
In cocos studio, export your .csd file to json : Go to Project / Project Settings, choose JSON. Then press Ctrl+P to Publish
-
Add the JSON file to your project in resource.js :
var res = {
myMenu_json: "res/myMenu.json",
[...]
};
- In your Javascript source do :
var myMenuLayer = cc.Layer.extend({
ctor:function () {
this._super();
var myMenu = ccs.load(res.myMenu_json);
this.addChild(myMenu.node);
return true;
}
var myMenuScene = cc.Scene.extend({
onEnter:function () {
this._super();
layer = new myMenuLayer ();
this.addChild(layer);
}
});
- You also need to have “cocostudio” in the modules list of your project.json file (this makes the ccs object available)
Hope this helps.