鼠标滑动
package
{
import flash.display.MovieClip;
import flash.events.Event;
dynamic public class Main extends MovieClip
{
public var stageW:Number;
public var stageH:Number;
public var chaH:Number;
public var picW:Number;
public var img_mc:MovieClip;
public var chaW:Number;
public var picH:Number;
public function Main()
{
addFrameScript(0,frame1);
}
function frame1()
{
stageW = stage.stageWidth;
stageH = stage.stageHeight;
picW = img_mc.width;
picH = img_mc.height;
chaW = picW - stageW;
chaH = picH - stageH;
img_mc.addEventListener(Event.ENTER_FRAME,onen);
}
public function onen(e:Event) : void
{
var a:* = mouseX / stageW;
var b:* = mouseY / stageH;
img_mc.x = img_mc.x + (800 - chaW * a - img_mc.x) / 10;
img_mc.y = img_mc.y + (600 - chaH * b - img_mc.y) / 10;
}
}
}