Flash AS 制作用鼠標可以觀看圖片各個部分的效果,至于具體怎么用,你就自己決定吧!這個教程因為制作方法非常簡單所以不給大家提供Fla源文件了!
先看演示效果:
制作方法非常簡單。
首先準備一幅大的圖片(圖片盡量足夠大),導入到Flash庫中,然后建立一個影片剪輯map,把圖片放到這里來,調整到合適位置。
然后再建立一個影片剪輯,制作一個箭頭。
回到主場景中在第一幀添加如下代碼:
Mouse.hide();
_root.attachMovie("map", "map", 1);
_root.attachMovie("the_arrow", "the_arrow", 2, {_x:250, _y:175});
the_arrow.onEnterFrame = function() {
this._x = (_xmouse-this._x)/5;
this._y = (_ymouse-this._y)/5;
dist_x = this._x-250;
dist_y = this._y-175;
angle = Math.atan(dist_y/dist_x)/(Math.PI/180);
if (dist_x<0) {
angle = 180;
}
if (dist_x>=0 and dist_y<0) {
angle = 360;
}
this._rotation = angle;
deltax = -(this._x-250)/90;
deltay = -(this._y-175)/90;
map._x = deltax;
map._y = deltay;
if (map._x>1000) {
map._x = 1000;
}
if (map._x<-500) {
map._x = -500;
}
if (map._y>1000) {
map._x = 1000;
}
if (map._y<-650) {
map._y = -650;
}
};
保存測試吧!在這里演示因為網絡原因我只給大家導入一幅小圖。
歡迎轉載:http://www.kanwencang.com/bangong/20161206/63740.html
文章列表