我想将影片剪辑的拖动限制在名为 themapmask 的蒙版上。可拖动 mc 的名称是 mapcontainer.themap。它的父级 mapcontainer 与舞台成比例地缩放。如何将拖动的 mc 约束到蒙版?下面的代码在加载时有效,但在舞台缩放时无效。
function constrainMap():void {
leftedge = themapmask.x+mapcontainer.themap.width/2-mapcontainer.x;
rightedge= themapmask.x+themapmask.width-mapcontainer.width/2-mapcontainer.x;
topedge = themapmask.y+mapcontainer.themap.height/2-mapcontainer.y;
bottomedge = themapmask.y+themapmask.height-mapcontainer.height/2-mapcontainer.y;
if (mapcontainer.themap.x>leftedge) mapcontainer.themap.x=leftedge;
if (mapcontainer.themap.y>topedge) mapcontainer.themap.y=topedge;
if (mapcontainer.themap.x<rightedge) mapcontainer.themap.x=rightedge;
if (mapcontainer.themap.y<bottomedge) mapcontainer.themap.y=bottomedge;
}