一个模仿Acdsee浏览图片的效果
作者 佚名技术
来源 服务器技术
浏览
发布时间 2012-07-11
今天帮别人解决一个地图的问题,顺便就做了这个效果。现把原文件共享出来,有需要的可以下载。 点击浏览该文件 点击浏览该文件 | 所有as代码如下: //---------------------------------------------------------------------------------------------------------- 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 = "放大"; _root.onLoad = function() { var btnName = new Array(); btnName = Array("放大", "缩小", "全图", "加大", "减小", "移动"); btnNameLen = btnName.length; for (i=1; i } for (i=0; 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 == "全图") { initMapZoom(); } if (this.vars == "加大") { var mapx = ((stageL+stageR)/2-map_mc._x)/mapScale; var mapy = ((stageT+stageB)/2-map_mc._y)/mapScale; if (mapScale*1.2 } else { mapZoom(maxZoom, mapx, mapy); } } if (this.vars == "减小") { 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 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 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 } if (actionLabel == "移动") { 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 ! |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: 革命性的Flash应用程序优化工具reshacker下一篇: 黑纹手镯制作
关于一个模仿Acdsee浏览图片的效果的所有评论