Flash Views

FL • 鼠標觸發圖片緩衝放縮效果示 (AS2)

Flash CS3 logo
按下鼠標拖動圖片,圖片會緩衝放大並移到最前面,鬆開鼠標停止拖動圖片緩衝縮小


步驟如下:


先在Flash中導入幾張圖片,分別轉為影片元件,拖到主場景
實例名分別為pic0_mc、pic1_mc、pic2_mc...


語法如下:


for (var d:Number = 0; d<=4; d++) {  // d為數量,比如4張圖,就是d<=4
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;
   }
  };
};
}


範例網址:
page_white_flash.png http://www.swfcabin.com/open/1292480693
adobe_flash.png http://u.115.com/file/f0cfcee316


如果您喜歡我的文章,請在文章最末按5下Like!

You Might Also Like

0 意見

純粹分享麥子購買產品!
文筆絕對不好,請噴子勿噴