onBtnClose.js 530 B

1234567891011121314151617181920212223242526
  1. var UIHelper = require("UIHelper");
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. },
  6. // use this for initialization
  7. onLoad: function () {
  8. var btn = this.node.getChildByName("btn_close");
  9. cc.addClickEvent(btn,this.node,"onBtnClose","onBtnClicked");
  10. },
  11. onBtnClicked:function(event){
  12. if(event.target.name == "btn_close"){
  13. UIHelper.playButtonEffect("close");
  14. this.node.active = false;
  15. }
  16. }
  17. });