我试图在动作脚本2上创建缩放和平移选项。我想在舞台上做,而不是在电影剪辑上。我已经做了一个基本的编码,但我想创建拖动和缩放选项。任何帮助都将不胜感激。
这是我的代码。我在舞台上有两个影片剪辑放大和缩小舞台
zoom_mc.onPress = function() {
var zinxpos:Number;
var zinypos:Number;
zinxpos=zoom_mc._x;
zinypos=zoom_mc._y;
zoom_mc.onEnterFrame = function() {
Mouse.hide();
this._x = _root._xmouse;
this._y = _root._ymouse;
}
_root.onMouseDown = function() {
this._xscale+=10;
this._yscale+=10;
}
}
zoomout_mc.onPress = function() {
zoom_mc._x=zinxpos;
zoom_mc._y=zinypos;
zoomout_mc.onEnterFrame = function() {
Mouse.hide();
this._x = _root._xmouse;
this._y = _root._ymouse;
}
_root.onMouseDown = function() {
this._xscale-=10;
this._yscale-=10;
}
}发布于 2017-04-09 04:55:42
这应该可以完成这项工作。
var $stage = this;
var isDragging = false;
var mouseDownX = 0;
var mouseDownY = 0;
$stage.onEnterFrame = function() {
if(isDragging){
$stage._x += $stage._xmouse - mouseDownX;
$stage._y += $stage._ymouse - mouseDownY;
}
}
$stage.onMouseDown = function() {
isDragging = true;
mouseDownX = $stage._xmouse;
mouseDownY = $stage._ymouse;
}
$stage.onMouseUp = function() {
isDragging = false;
}
zoom_mc.onPress = function() {
$stage._xscale += 10;
$stage._yscale += 10;
}
zoomout_mc.onPress = function() {
$stage._xscale -= 10;
$stage._yscale -= 10;
}https://stackoverflow.com/questions/42827176
复制相似问题