[]给以个对象绑定两个on方法为什么只能执行一次 ?

//这是一个那妞交类的一个动画
var BtnFeed = (function(){
    // params——操作对象-回调
    function BtnFeed(obj,backEdHd){
        this.obj = obj;
        this.backEdHd = backEdHd||void(0);
        this.clickEnd = function(){
            Laya.timer.once(0,this,this.reset);
        };
        this.reset = function(){
            Laya.Tween.to(this.obj,{scaleY:1,scaleX:1},10,Laya.Ease.backIn,Laya.Handler.create(this,this.backEdHd));
        }
        this.init = function(){
            Laya.Tween.to(this.obj,{scaleY:1.05,scaleX:1.05},100,Laya.Ease.backOut,Laya.Handler.create(this,this.clickEnd));
        }
        this.obj.on(Laya.Event.CLICK,this,this.init);
    }
    return BtnFeed;
})();
//实例化上面的类
_proto.getFeedBtn = function(){
        this.feedBtn = [
            this.myHome,//我的家园
            this.famlilyMune.getChildByName("shop"),//我的家园-商店
            this.famlilyMune.getChildByName("entrepot"),//仓库
            this.famlilyMune.getChildByName("exchange"),//兑换中心
            this.famlilyMune.getChildByName("decorate"),//装饰
            this.myOrchard,//我的果园吧
            this.orchardMenu.getChildByName("announce"),//公告
            this.orchardMenu.getChildByName("strategy"),//攻略
            this.orchardMenu.getChildByName("usercenter"),//用户中心
            this.orchardMenu.getChildByName("market"),//行情
            this.header.getChildByName("headerToggle"),//下拉菜单按钮
            this.header.getChildByName("toggleMenu").getChildByName("log"),//日志
            this.header.getChildByName("toggleMenu").getChildByName("rank"),//排名
            this.header.getChildByName("toggleMenu").getChildByName("recharge")//充值
        ]
        for(var i = 0;i<this.feedBtn.length;i++){
                new BtnFeed(this.feedBtn[i]);  
        }
    }
//又给this.myHome对象添加了一个click事件
 this.myHome.on(Laya.Event.CLICK,this,this.showMyfamMenu); 
 _proto.showMyfamMenu = function(){
        console.log(1)
        if(!this.famlilyMune.isActive){
        //     //Laya缓动动画——操作对新-属性列表-执行时间-动画效果-回调
            Laya.Tween.to(this.famlilyMune,{rotation:0},500,Laya.Ease.backOut,null);
        }else{
            Laya.Tween.to(this.famlilyMune,{rotation:-100},500,Laya.Ease.backOut,null);
        }
        //重置状态
        this.famlilyMune.isActive = !this.famlilyMune.isActive;
    }
 
为什么点击这个this.myHome对象时两个事件都只能
执行一次,再点击就没有效果了
已邀请:

cuixueying

赞同来自:

问题描述不明确,请提供你的代码示例!

stopry

赞同来自:

//这是一个那妞交类的一个动画
var BtnFeed = (function(){
    // params——操作对象-回调
    function BtnFeed(obj,backEdHd){
        this.obj = obj;
        this.backEdHd = backEdHd||void(0);
        this.clickEnd = function(){
            Laya.timer.once(0,this,this.reset);
        };
        this.reset = function(){
            Laya.Tween.to(this.obj,{scaleY:1,scaleX:1},10,Laya.Ease.backIn,Laya.Handler.create(this,this.backEdHd));
        }
        this.init = function(){
            Laya.Tween.to(this.obj,{scaleY:1.05,scaleX:1.05},100,Laya.Ease.backOut,Laya.Handler.create(this,this.clickEnd));
        }
        this.obj.on(Laya.Event.CLICK,this,this.init);
    }
    return BtnFeed;
})();
//实例化上面的类
_proto.getFeedBtn = function(){
        this.feedBtn = [
            this.myHome,//我的家园
            this.famlilyMune.getChildByName("shop"),//我的家园-商店
            this.famlilyMune.getChildByName("entrepot"),//仓库
            this.famlilyMune.getChildByName("exchange"),//兑换中心
            this.famlilyMune.getChildByName("decorate"),//装饰
            this.myOrchard,//我的果园吧
            this.orchardMenu.getChildByName("announce"),//公告
            this.orchardMenu.getChildByName("strategy"),//攻略
            this.orchardMenu.getChildByName("usercenter"),//用户中心
            this.orchardMenu.getChildByName("market"),//行情
            this.header.getChildByName("headerToggle"),//下拉菜单按钮
            this.header.getChildByName("toggleMenu").getChildByName("log"),//日志
            this.header.getChildByName("toggleMenu").getChildByName("rank"),//排名
            this.header.getChildByName("toggleMenu").getChildByName("recharge")//充值
        ]
        for(var i = 0;i<this.feedBtn.length;i++){
                new BtnFeed(this.feedBtn[i]);  
        }
    }
//又给this.myHome对象添加了一个click事件
 this.myHome.on(Laya.Event.CLICK,this,this.showMyfamMenu); 
 _proto.showMyfamMenu = function(){
        console.log(1)
        if(!this.famlilyMune.isActive){
        //     //Laya缓动动画——操作对新-属性列表-执行时间-动画效果-回调
            Laya.Tween.to(this.famlilyMune,{rotation:0},500,Laya.Ease.backOut,null);
        }else{
            Laya.Tween.to(this.famlilyMune,{rotation:-100},500,Laya.Ease.backOut,null);
        }
        //重置状态
        this.famlilyMune.isActive = !this.famlilyMune.isActive;
    }
 
为什么点击这个this.myHome对象时两个事件都只能
执行一次,再点击就没有效果了

要回复问题请先

商务合作
商务合作