Flash to create an imitation acdsee browsing the image of the effect

Source: Internet
Author: User
Tags abs array vars
Today help others solve a map problem, by the way to do this effect. The original file is shared out, there is a need to download.

http://www.flash8.net/bbs/UploadFile/2005-7/200578181657650.swf

Click here to download the source file

All as codes are as follows:
//---------------------------------------------
Stage.showmenu = false;
Stage.scalemode = "Noscale";
Fscommand (Allowscale, true);
Mapscale = Map_mc._xscale;
Stagel = 0;
Staget = 0;
StageR = Map_mc._width;
Stageb = Map_mc._height;
Stagew = Mask_mc._width;
Stageh = Mask_mc._height;
Maxzoom = 800;
Minzoom = 50;
Initmapzoom ();
Actionlabel = "Enlarge";
_root.onload = function () {
var btnname = new Array ();
Btnname = Array ("Zoom in", "shrink", "full graph", "enlarge", "decrease", "move");
Btnnamelen = Btnname.length;
For (I=1 i<btnnamelen; i++) {
Ctrlbtn0.duplicatemovieclip ("ctrlbtn" +i, i);
}
For (i=0 i<btnnamelen; i++) {
Ctrlbtns = eval ("ctrlbtn" +i);
Ctrlbtns.btn_name.text = Btnname[i];
ctrlbtns._x = i* (ctrlbtn0._width+5) +10;
ctrlbtns._y = ctrlbtn0._y;
Ctrlbtns.vars = Btnname[i];
Ctrlbtns.onrollover = function () {
This._alpha = 60;
};
Ctrlbtns.onrollout = function () {
This._alpha = 100;
};
Ctrlbtns.onrelease = function () {
Actionlabel = This.vars;
if (This.vars = "full picture") {
Initmapzoom ();
}
if (This.vars = = "Enlarge") {
var mapx = ((Stagel+stager)/2-map_mc._x)/mapscale;
var mapy = ((STAGET+STAGEB)/2-map_mc._y)/mapscale;
if (mapscale*1.2<maxzoom) {
Mapzoom (mapscale*1.2, MAPX, mapy);
} else {
Mapzoom (Maxzoom, MAPX, mapy);
}
}
if (This.vars = = "reduced") {
var mapx = ((Stagel+stager)/2-map_mc._x)/mapscale;
var mapy = ((STAGET+STAGEB)/2-map_mc._y)/mapscale;
if (mapscale*.8>minzoom) {
Mapzoom (mapscale*.8, MAPX, mapy);
} else {
Mapzoom (Minzoom, MAPX, mapy);
}
}
};
}
};
function Initmapzoom () {
var MsW = Map_mc._width/stagew;
var MsH = Map_mc._height/stageh;
var mapbi = (MSW&LT;MSH)? Msw:msh;
map_mc._x = Stagel;
map_mc._y = Staget;
Mapscale = MAPSCALE/MAPBI;
Map_mc._xscale = Mapscale;
Map_mc._yscale = Mapscale;
}
var mouseobj = new Object ();
Mouse.addlistener (Mouseobj);
Mouseobj.onmousedown = function () {
if (_xmouse>stagel && _xmouse<stager && _ymouse>staget && _ymouse<stageb) {
if (Actionlabel = = "Zoom In" | | actionlabel = = "Shrink") {
box_x = _xmouse;
box_y = _ymouse;
Createemptymovieclip ("BOX_MC", btnnamelen+1);
With (BOX_MC) {
LineStyle (1, 0xff0000, 80);
MoveTo (0, 0);
LineTo (0, 1000);
LineTo (1000, 1000);
LineTo (1000, 0);
LineTo (0, 0);
_width = 1;
_height = 1;
}
MAPW = Map_mc._width;
Maph = Map_mc._height;
Box_mc.onenterframe = function () {
This._width = Math.Abs (_xmouse-box_x);
This._height = Math.Abs (_ymouse-box_y);
this._x = _xmouse<box_x? _xmouse:box_x;
This._y = _ymouse<box_y? _ymouse:box_y;
};
}
if (Actionlabel = = "Move") {
left = Stager-map_mc._width;
top = stageb-map_mc._height;
right = 0;
bottom = 0;
Map_mc.startdrag (False, left, top, right, bottom);
}
}
};
Mouseobj.onmouseup = function () {
if (box_mc!= undefined) {
Boxw = Box_mc._width+box_mc._x>stager? Stager-box_mc._x:box_mc._width;
Boxh = Box_mc._height+box_mc._y>stageb? Stageb-box_mc._y:box_mc._height;
MouseX = box_mc._width!= 0? Box_mc._x: _xmouse;
Mousey = box_mc._height!= 0? Box_mc._y: _ymouse;
if (Actionlabel = = "Zoom In") {
Large ();
}
if (Actionlabel = = "Shrink") {
Small ();
}
Box_mc.removemovieclip ();
}
if (Actionlabel = = "Move") {
Map_mc.stopdrag ();
}
};
function Large () {
_L1 = Boxw = = 0? 1.2:stager/boxw;
_L2 = Boxh = = 0? 1.2:stageb/boxh;
Point = _l1<_l2? _L1: _L2;
var mapx = ((mousex+_xmouse)/2-map_mc._x)/mapscale;
var mapy = ((mousey+_ymouse)/2-map_mc._y)/mapscale;
if (map_mc._xscale<maxzoom) {
if (mapscale*point<maxzoom) {
Mapzoom (Mapscale*point, MAPX, mapy);
} else {
Mapzoom (Maxzoom, MAPX, mapy);
}
}
}
function Small () {
_L1 = Boxw = = 0? 0.8:boxw/stager;
_L2 = Boxh = = 0? 0.8:boxh/stageb;
Point = _l1>_l2? _L1: _L2;
var mapx = (_xmouse-map_mc._x)/mapscale;
var mapy = (_ymouse-map_mc._y)/mapscale;
if (map_mc._xscale>minzoom) {
if (mapscale*point>minzoom) {
Mapzoom (Mapscale*point, MAPX, mapy);
} else {
Mapzoom (Minzoom, MAPX, mapy);
}
}
}
function Mapzoom (Map_scale, map_x, map_y) {
Map_mc._xscale = Map_scale;
Map_mc._yscale = Map_scale;
Mapscale = Map_scale;
map_mc._x = (Stagel+stager)/2-map_x*mapscale;
Map_mc._y = (STAGET+STAGEB)/2-map_y*mapscale;
//---------------------------------------------------
map_mc._x = Map_mc._x+map_mc._width<stager? stager-map_mc._width:map_mc._x;
map_mc._x = map_mc._x>0? 0:map_mc._x;
Map_mc._y = Map_mc._y+map_mc._height<stageb? stageb-map_mc._height:map_mc._y;
Map_mc._y = map_mc._y>0? 0:map_mc._y;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.