最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
图片随鼠标反向缓冲
时间:2022-07-02 17:07:35 编辑:袖梨 来源:一聚教程网
var sp:Sprite = new Sprite();
sp.graphics.beginFill(0,0.8)
sp.graphics.drawCircle(0,0,10);
sp.graphics.endFill();
sp.x=stage.stageWidth/2;
sp.y=stage.stageHeight/2;
addChild(sp);
var mousex:int;
var mousey:int;
mousex = mouseX;
mousey = mouseY;
stage.addEventListener(MouseEvent.MOUSE_MOVE,MouseMove);
function MouseMove(e:MouseEvent)
{
(sp.x > 0) ? sp.x -= mouseX-mousex : sp.x = 0;
(sp.x
(sp.y < stage.stageHeight) ? sp.y -= mouseY-mousey : sp.y = stage.stageHeight;
mousex = mouseX;
mousey = mouseY;
}
package {
import flash.events.MouseEvent;
import flash.events.Event;
import fl.transitions.Tween;
import fl.transitions.easing.*;
public class bgControl {
public var _mouseX:uint;
public var _mouseY:uint;
public var _followSpList:Array=new Array;
public var pic:Object;
public var bloone:Boolean=false;
public var canshu:uint;
private var Boolean_chu:Boolean
private var stageW:uint;
private var stageH:uint;
private var picW:uint;
private var picH:uint;
public function bgControl() {
Boolean_chu=false;
Theinit(pic)//舞台创建图片实例,pic图片超大
}
public function Theinit(pic) {
pic.addEventListener(MouseEvent.MOUSE_MOVE,mousemove);
}
public function mousemove(e) {
var _l0=e.target.parent
if (Boolean_chu==false) {
stageW=e.target.root.stage.stageWidth;
stageH=e.target.root.stage.stageHeight;
picW=_l0.width;
picH=_l0.height;
Boolean_chu=true;
}
var xTween:Tween = new Tween(_l0, "x", Regular.easeOut, _l0.x,-e.target.root.mouseX / stageW * (picW - stageW), 0.5, true);
var yTween:Tween = new Tween(_l0, "y", Regular.easeOut, _l0.y,-e.target.root.mouseY / stageH * (picH - stageH), 0.5, true);
e.updateAfterEvent();
}
}
}
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20