`import { Canvas } from “…/creator”;
// Learn cc.Class:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
one: false,
two: false,
three: false,
four: false,
five: false,
six: false,
seven: false,
eight: false,
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
onLoad: function(){
var self =this;
// if(self.one){
// cc.find('Canvas/one').on('roateevent',self.listen,self);
// }
// if(self.two){
// cc.find('Canvas/two').on('roateevent',self.listen,self);
// }
// if(self.three){
// cc.find('Canvas/three').on('roateevent',self.listen,self);
// }
// if(self.four){
// cc.find('Canvas/four').on('roateevent',self.listen,self);
// }
// if(self.five){
// cc.find('Canvas/five').on('roateevent',self.listen,self);
// }
// if(self.six){
// cc.find('Canvas/six').on('roateevent',self.listen,self);
// }
// if(self.seven){
// cc.find('Canvas/seven').on('roateevent',self.listen,self);
// }
// if(self.eight){
// cc.find('Canvas/eight').on('roateevent',self.listen,self);
// }
self.node.on('mouseup',function(){
self.node.emit('roateevent');
});
},
listen:function(){
this.node.runAction(cc.rotateBy(0.5,360));
},
start () {
},
// update (dt) {},
});
`
根据目前信息,我只能判断出cc.find的结果为空。
