首 页 ┆ 源码下载 ┆ IT学院 ┆ 字体下载 ┆ 模板下载 ┆ 源码发布 ┆ 广告合作 ┆ 网站地图 ┆ 虚拟主机 ┆ 中文域名
► 设为首页
► 加入收藏
► 联系我们
源码下载 >> ASP源码 | PHP源码 | ASP.net源码 | JSP源码 | CGI源码 | VC/C++源码 | VB源码 | Delphi源码 | Flash源码
文章学院 >> 网络编程 | 网页设计 | 图形图象 | 数据库 | 服务器 | 网络媒体 | 网络安全 | 操作系统 | 办公软件 | 软件开发 | 黑客知识
字体下载 >> 精制字体 | 非英字体 | 艺术字体 | 著名字体 | 哥特式 | 简单字体 | 手写体 | 节假日 | 图案字体 | 精度像素 | 中文字体
模板下载 >> 企业门户 | 数码网络 | 休闲娱乐 | 影视音乐 | 旅游名胜 | 文化艺术 | 电子商务 | 个性展示 | 登陆导航 | Flash模板
►►您当前的位置:源码园 → IT学院 → 网络媒体 → FLASH → 文章内容

图片放大缩小移动类

作者:风未起时  来源:中国站长学院  发布时间:2007-2-8 0:32:51
-图片放大缩小移动类:
-----------------------class-------------------------

class ZoomOpenMove {
   private var obj:MovieClip;
   private var pos_scale:Number;
   private var x_speed:Number;
   private var y_speed:Number;
   private var scale_speed:Number;
   private var scale_step:Number;
   public function ZoomOpenMove(_obj:MovieClip) {
      this.obj = _obj;
   }
   public function get s_speed():Number {
      return scale_speed;
   }
   public function set s_speed(_s_speed:Number):Void {
      scale_speed = _s_speed;
   }
   public function get _x_speed():Number {
      return x_speed;
   }
   public function set _x_speed(_x_x_speed:Number):Void {
      x_speed = _x_x_speed;
   }
   public function get _y_speed():Number {
      return y_speed;
   }
   public function set _y_speed(_y_y_speed:Number):Void {
      y_speed = _y_y_speed;
   }
   public function get _scale_step():Number {
      return scale_step;
   }
   public function set _scale_step(scalestep:Number):Void {
      scale_step = scalestep;
   }
   public function get _scale_speed():Number {
      return scale_speed
   }
   public function set _scale_speed(scalespeed:Number):Void {
      scale_speed = scalespeed
   }
   public function get _pos_scale():Number {
      return pos_scale;
   }
   public function set _pos_scale(posscale:Number):Void {
      pos_scale = posscale;
   }
   public function Open() {
      if (_root._xmouse<Stage.width and _root._xmouse>0 and _root._ymouse>0 and _root._ymouse<Stage.height) {
         obj._xscale<pos_scale ? obj._xscale=obj._yscale += scale_step : obj._xscale=obj._yscale=pos_scale;
      }
   }
   public function Zoom() {
      if (_root._xmouse<Stage.width and _root._xmouse>0 and _root._ymouse>0 and _root._ymouse<Stage.height) {
         obj._x += (0-obj._x)/scale_speed;
         obj._y += (0-obj._y)/scale_speed;
         obj._xscale += (100-obj._xscale)/scale_speed;
         obj._yscale += (100-obj._yscale)/scale_speed;
      }
   }
   public function Move() {
      if (obj.hitTest(_root._xmouse, _root._ymouse, true)) {
         var pos_x = _root._xmouse*(Stage.width-obj._width)/Stage.width;
         var pos_y = _root._ymouse*(Stage.height-obj._height)/Stage.height;
         obj._x += (pos_x-obj._x)/x_speed;
         obj._y += (pos_y-obj._y)/y_speed;
      }
   }
}
//------------------------------------fla---------------------------------------

//插入一张大于或者等于场景大小的图片,按f8,顶点为左上角,位置为0,0.

图片的实例名为:pic.

然后把以下复制到第一桢看效果:

//---------------------

var newzom:ZoomOpenMove = new ZoomOpenMove(pic);
newzom._x_speed = newzom._y_speed=9;
newzom._pos_scale = 300;
newzom._scale_speed = 9;
press = 0;
onMouseDown = function () {
   press = 1;
   this.Oldtime = getTimer();
   this.onEnterFrame = function() {
      this.Newtime = getTimer();
      this.preTime = this.Newtime-this.Oldtime;
      newzom._scale_step = this.preTime/400;
      newzom.Move();
      press ? newzom.Open() : newzom.Zoom();
   };
};
onMouseUp = function () {
   press = 0;
};
//完成。


[] [返回上一页] [打 印]
  • 上一篇文章:Actionscript优化教程
  • 下一篇文章:setInterval全面的介绍

  • 相关文章:
  • 图片放大缩小移动类
  • [图文]奇妙的Javascript图片放大镜
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 源码发布
Copyright © 2003-2009 Ymyasp.Com. All Rights Reserved .
备案序号:粤ICP备07029071号