精彩专题推荐:建站之入门课 建站之必修课 建站之关键课 网站价值所在 流量提高专题 css+div 标准 个人网站打造全过程
  • 让你的网站产生收益赚钱,有博客和网站的绝对不能错过
  • 将指定的流量带到你的网站,为你站增加有效的访客,为你提升业绩
  • Flash AS代码制作鼠标触发图片缓冲放缩

    来源:网络 时间:07-10-26 点击: 点击这里收藏本文
      本文中我们用Flash制作一个鼠标触发的动态实例:按下鼠标拖动图片,图片会缓冲放大并移到最前面,松开鼠标停止拖动图片缓冲缩小。

      用鼠标点击图片并拖动,您将看到图片缓冲放缩效果

      Flash中制作步骤:

      先在Flash中导入几张图片,分别转为影片元件,拖到主场景,实例名分别为pic0_mc、pic1_mc、pic2_mc……

      在帧上写如下代码:原文链接


    for (var d:Number = 0; d<=2; d++) {
    this["pic"+d+"_mc"].onPress = function() {
      mx.behaviors.DepthControl.bringToFront(this);//移到最前
      startDrag(this);
      this.onEnterFrame = function() {
       this._xscale += (200-this._xscale)/4;//缓冲放大
       this._yscale += (200-this._yscale)/4;
       if (this._xscale>=200) {
        delete this.onEnterFrame;
       }
      };
    };
    this["pic"+d+"_mc"].onRelease = function() {
      stopDrag();
      this.onEnterFrame = function() {
       this._xscale -= (this._xscale-100)/4;//缓冲缩小
       this._yscale -= (this._yscale-100)/4;
       if (this._xscale<=100) {
        delete this.onEnterFrame;
       }
      };
    };
    }


    用户评论

    广而告之