flash缩放与移动
本文章主要是讲一下关于flash缩放与移动的代码哦,好了我来开始看看下面的缩放与移动吧。
flash缩放与移动
//剪辑名称为Movie_Clip
stop();
fscommand("allowscale",false);
var mc_menu:ContextMenu=new ContextMenu();
mc_menu.customItems.push(new ContextMenuItem("蓝光_BlueShine",GotoBlueShine));
this.menu=mc_menu;
function GotoBlueShine()
{
getURL("http://www.blue-sun.cn","_blank");
};
var MouseListener:Object=new Object();
//缩放剪辑的代码
MouseListener.onMouseWheel=function(delta)
{
with(Movie_Clip)
{
var omx=_xmouse,omy=_ymouse;
_xscale+=delta;
_yscale+=delta;
_x-=omx*delta/100;
_y-=omy*delta/100;
}
};
//移动剪辑的代码
//这里要注册两个变量,用以存储鼠标的初始位置
var originMusX:Number ,OriginMusY:Number ;
//还定义一个判断鼠标是否按下的boolean变量
var MousePress:Boolean;
MouseListener.onMouseDown = function()
{
MousePress=true;
originMusX=_xmouse;
originMusY=_ymouse;
}
MouseListener.onMouseUp = function()
{
MousePress=false;
}
MouseListener.onMouseMove = function()
{
trace(_xmouse);
if(MousePress)
{
Movie_Clip._x+=_xmouse-OriginMusX;
Movie_Clip._y+=_ymouse-OriginMusY;
originMusX=_xmouse;
originMusY=_ymouse;
}
}
Mouse.addListener(MouseListener);
补充:flash教程,动画技术