最新下载
热门教程
- 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();
}
}
}
相关文章
- 第五人格11.22共研服有什么更新 11月22日共研服更新内容介绍 11-21
- 原神恰斯卡怎么培养 11-21
- 无期迷途四星装束是谁 11-21
- 王者荣耀帝丹高中校服怎么获得 11-21
- 光遇姆明季后续版本怎么玩 11-21
- 《潜行者2:切尔诺贝利之心》使用手电筒方法介绍 11-21