模板天下 | 网页模板 | 学 院 | 源 码 | 书 籍 | 壁 纸 | 字 体 | JS脚本 | FLASH源码 | 软 件 | 矢 量 | 服务器软件 | 素 材 | 其 它 |
设为主页
加入收藏
联系站长
平面设计 | 网页制作 | 程序编写 | 数 据 库 | 媒体动画 | 网络冲浪 | 服务器相关 | 站长乐园 | 业界动态 |
当前在线
Flash AS代码制作鼠标触发图片缓冲放缩
2007-10-25 17:20:11  作者:模板天下收集整理  来源:未知 网友评论 0 条 论坛
   本文中我们用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;
   }
  };

共分1页  [1] 

>> 相关文章

关于网站 | 客服中心 | 服务条款 | 合作伙伴 | 广告联系 | 本站历程 | 网站导航 | 发布资源 == 好的资源 大家共享

吉ICP备05000107号