COCOS-JS Load Cocos Studio file Get button implementation

Add buttons in Cocos Studio

var HelloWorldLayer = cc.Layer.extend({ sprite: null, ctor: function () {///////////////////////////// // 1 . super init first this._s uper(); ///////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program // you may modify it. // ask the window size < span style="color:#cc7832;font-weight:bold;">var size = cc.winSize; // Load Cocos Studio resources var mainscene = ccs.load(res.MainScene_json); this.addChild span>(mainscene.node); var startButton = ccui.helper .seekWidgetByName(mainscene.node , "Button_1"); startButton.addTouchEventListener(this.onClick, this); return true ; }, onClick: function (sender, type) {switch (type) {case ccui.Widget. TOUCH_BEGAN: break; case ccui.Widget .TOUCH_MOVED: break; case ccui.Widget.TOUCH_ENDED: console.log("startButtonOnClick"); cc.director .runScene(new GameScene);

  break;

case ccui. Widget. < span style="color:#9876aa;">TOUCH_CANCELED: break ; } }}) ; var HelloWorldScene = cc. Scene. extend({ onEnter: function () {this. _super() ; var layer = new HelloWorldLayer() ; this. addChild(layer) ; }}) ;

p>

Add buttons in Cocos Studio

var HelloWorldLayer = cc.Layer.extend({ sprite: null, ctor: function () {////////////// //////////////// // 1. super init first this._super (); //////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program // you may modify it. // ask the window size var size = cc.winSize ; // Load Cocos Studio resources var mainscene = ccs.load(res.MainScene_json); this.addChild(mainscene.node); var startButton = ccui.helper.seekWidgetByName(mainscene. node, "Button_1"< /span>); startButton.addTouchEventListener(this.onClick, this); return true; }, onClick: function (sender, type) {switch (type) {case ccui.Widget.TOUCH_BEGAN: break; case ccui.Widget.< span style="color:#9876aa;">TOUCH_MOVED: break; case ccui.Widget.TOUCH_ENDED: console.log< /span>("startButtonOnClick"); cc.director.runScene(new GameScene);

 break span>;

case ccui. Widget. TOUCH_CANCELED: break ; } }}) ; var HelloWorldScene = cc. Scene< /span>. extend({ onEnter: function () {this. _super () ; var layer = new HelloWorldLayer() ; this. addChild(layer) ; }}) ;

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3644 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.