1
我在動畫片段中播放動畫中的圖片 我想要的是在動畫片段中獲取該動畫片段內圖片的x和y位置。createjs在動畫片段內的Y位置
,但我發現,在x的y不更新,即使是在那一刻,我剔函數內檢查,我使用globalToLocal
function tickHandler(event) {
//get the x and y of this mc using globalToLocal
console.log(exportRoot.game_anim.meterMC.awd.globalToLocal(exportRoot.game_anim.meterMC.awd.x, exportRoot.game_anim.meterMC.awd.y))
stage.update();
}
exportRoot.gotoAndStop("game")
exportRoot.game_anim.meterMC.arrowYou.addEventListener("mousedown",function (evt) {
var _this = evt.target
var mouseRight = 0;
var mouseLeft = 180;
var offset = {x: _this.x - evt.stageX, y: _this.y - evt.stageY};
evt.addEventListener("mousemove" , function(ev){
//)
var pt = exportRoot.game_anim.meterMC.globalToLocal(stage.mouseX, stage.mouseY)
if (pt.y > mouseLeft){
percent = 100;
} else if (pt.y < mouseRight){
percent = 0;
} else {
percent = Math.round(((pt.y - mouseRight)/(mouseLeft - mouseRight)*100));
_this.y = pt.y;
}
if (pt.y > mouseLeft){
}
;
})
});
感謝您的回答我會試試看 – Roy