EaselJS CreateJS'pressmove','pressup'无效

时间:2013-12-13 16:11:07

标签: mousemove easeljs createjs

我已将.fla文件转换为.js文件,我在该文件中的多个元素上添加了几个侦听器。其中'click','mousedown'& 'mouseover'工作得很好,但'pressmove'& 'pressup'事件没有响应,它们甚至没有产生任何错误。这是我的代码片段:

/****this snippet is from converted .js file *********/

(lib.knob_rot_but = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // Layer 2
    this.shape = new cjs.Shape();
    this.shape.graphics.f().s("#999999").ss(0.5,1,1).p("ABlhlQArArAAA6QAAA7grAqQgqArg7AAQg6AAgrgrQgqgqAAg7QAAg6AqgrQArgqA6AAQA7AAAqAqg");
    this.shape.setTransform(26.4,0);

    this.shape_1 = new cjs.Shape();
    this.shape_1.graphics.rf(["#FFFFFF","#CCCCCC","#999999","#666666"],[0.239,0.8,0.941,1],-0.2,0.2,0,-0.2,0.2,14.8).s().p("AhlBlQgqgqAAg7QAAg6AqgqQArgqA6gBQA7ABAqAqQAqAqAAA6QAAA7gqAqQgqAqg7AAQg6AAgrgqg");
    this.shape_1.setTransform(26.4,0);

    this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_1},{t:this.shape}]}).wait(4));

}).prototype = p = new cjs.MovieClip();

/******* My Listeners ******/
var helpButtonDown = DeviceService.getHelpButtonDown();
helpButtonDown.addEventListener("click", function(){alert("helpButtonDown button clicked")});  //works fine

var powerButtonUp = DeviceService.getPowerButtonUp();
powerButtonUp.addEventListener("click", function(){alert("powerButtonUp clicked")});//works fine


/*** Knob Listener***/
var knob = DeviceService.getKnob();
knob.addEventListener("mousedown", function(){console.log("mousedown on knob")}); //woks fine
knob.addEventListener("pressmove", function(evt){console.log("proess move on knob evt :" + evt)}); // doesn't work :(

2 个答案:

答案 0 :(得分:5)

触摸按下移动按下等事件要求您启用触摸类,请参阅下面的示例和文档。

var stage = new createjs.Stage("canvasId");
createjs.Touch.enable(stage);

http://www.createjs.com/Docs/EaselJS/classes/Touch.html

答案 1 :(得分:2)

在版本v0.7.0中引入了 pressmove pressup 事件,而CreateJS发布者则发布到v0.6.0。尝试在标记中更改为v0.7.0版。