Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

Cocos-js 触摸事件问题,求解答!

$
0
0

@TJTian 写道:

his.touchListener = cc.EventListener.create({

            event: cc.EventListener.TOUCH_ONE_BY_ONE,
            swallowTouches: true,
            onTouchBegan: function (touch, event) {
                return true;
            },
            onTouchMoved : function(touch,event){

            },
            onTouchEnded : function(touch,event){
                var pos = touch.getLocation();
                var target = event.getCurrentTarget();
                target.BtnMove();
            }
        });
        cc.eventManager.addListener(this.touchListener,this._CombatBtn);
    },

添加到了button上面,点击界面任何地方事件都会响应, 报错target.BtnMove() not a function
求大神解答!

BtnTouch : function(sender,type){
switch (type){
case ccui.Widget.TOUCH_MOVED:

        case ccui.Widget.TOUCH_ENDED:
            this.BtnMove();
    }
}

buttons事件这种写法获取target 和 getlocation() 报错 not a function

帖子: 1

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>