热门关键字:  电脑爱好者  XP的vista主II  隐藏我的电脑常规  WORD表竛的諥作  photoshop
当前位置 :| 主页>图形图像>Flash>

Flash实现动画影片中图片缓冲放大和缩小效果

来源: 时间:2008-11-13 点击:

效果如下:



点击这里下载源文件

  要求:

  按下鼠标拖动图片缓冲放大并移到最前面,松开鼠标停止拖动图片缓冲缩小。

  步骤:

  导入几张图片分别转为影片元件,拖到主场景,实例名分别为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;
   }
  };
};
}

 

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册