/****************************
* 鼠标控制图片移动实例 *
*****************************/
////////////////////////////////
//初始化数据//
var leftest = 50;
var rightest = 350;
var startX = -50;
var startY = -3;
var click = false;
var nowTime = 0;
////////////////////////////////
//加载相关元件//
_root.attachMovie("mouseHand", "hand", 1000);
hand._x = _root._xmouse;
hand._y = _root._ymouse;
_root.attachMovie("myPic", "pic", 11);
pic._x = startX;
pic._y = startY;
pic._xscale = pic._yscale=60;
_root.createEmptyMovieClip("screen", 10);
with (screen) {
lineStyle(1, 0x000000, 0);
beginFill(0x000000, 100);
moveTo(leftest, 0);
lineTo(rightest, 0);
lineTo(rightest, 200);
lineTo(leftest, 200);
lineTo(leftest, 0);
}
pic.setMask(screen);
////////////////////////////////
//鼠标跟随//
startDrag("hand", true, leftest, 0, rightest, 200);
Mouse.hide();
////////////////////////////////
//图片控制//
var oldX = _root._xmouse;
var hSpeed = 3;//图片移动速度
var zSpeed = 1;//图片放大速度
Mouse.addListener(_root);//定义监听器
_root.onMouseDown = function() {
click = true;
hand.gotoAndStop("click");
var old#000088">_xscale;
var old#000088">_yscale;
var mouseX = _root._xmouse;
var mouseY = _root._ymouse;
var picX = pic._x;
var picY = pic._y;
var moveX, moveY;
pic.onEnterFrame = function() {
if (this._xscale<100 || this._yscale<100) {
//图片放大
this._xscale += zSpeed;
this._yscale += zSpeed;
//图片以鼠标点击位置为中心放大时,图片坐标的移动
moveX = ((mouseX-picX)/oldWidth*this._xscale+picX)-mouseX;
moveY = ((mouseY-picY)/oldHeight*this._yscale+picY)-mouseY;
this._x = picX-moveX;
this._y = picY-moveY;
} else {
delete this.onEnterFrame;
}
};
};
_root.onMouseUp = function() {
publicAS();
pic.onEnterFrame = function() {
//图片缩小为初始状态
if (this._xscale>60 || this._yscale>60) {
this._xscale += (60-this._xscale)/10;
this._yscale += (60-this._yscale)/10;
this._x += (startX-this._x)/10;
this._y += (startY-this._y)/10;
} else {
delete this.onEnterFrame;
}
};
};
////////////////////////////////
//控制图片//
_root.onEnterFrame = function() {
//鼠标花絮//
var elapse = getTimer()-nowTime;
if (elapse-3000>=0 && !click) {
elapse = 0;
click = true;
nowTime = getTimer();
hand.gotoAndPlay(2);
}
//左移右移//
var nowX = _root._xmouse;
if (((oldX-nowX)<0 || nowX>=rightest) && (pic._x+pic._width)>350) {
//鼠标右移,图片左移
pic._x -= hSpeed;
publicAS();
}
if (((oldX-nowX)>0 || nowX<=leftest) && pic._x<50) {
//鼠标左移,图片右移
pic._x += hSpeed;
publicAS();
}
oldX = _root._xmouse;
};
//一些公用的代码
function publicAS() {
hand.gotoAndStop(1);
nowTime = getTimer();
click = false;
}
我最强舞者 (I, Best Dancer)安卓版v8
我最强舞者(I, Best Dancer)是一款休闲放置类手
迷你世界国服版本2024 v1.43.0
迷你世界国服版本2024是一款自由度非常高的沙盒游戏,玩法和
烹饪乐园 安卓版v1.23.6
烹饪乐园(Cooking Town)是一款非常好玩的餐厅模拟
迷你世界小米服 最新安卓版v1.43.0
迷你世界小米版是由迷你玩科技开发的休闲模拟经营类游戏。此版本
布娃娃Sprunki沙盒 安卓版v0.0.1
布娃娃Sprunki沙盒是一个非常有趣的沙盒游戏,复古简约的