1
У меня есть графика в анимации, играющей в movieclip Что я хочу сделать, это получить положение x и y графика внутри этого мувиклипа при его оживлении.createjs Y позиция внутри movieclip
, но я нахожу, что х у не обновлять, даже если в данный момент, я проверяю в функции клеща, я использую 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