關於一個網站FLASH導航條的製作

http://shineday.nease.net/

這裏的代碼是抄襲過來的,根本是爲了說明問題和解決問題:)

var drag =0.1;
//震動參數
var flex =0.7;
//震動參數
mc._y =20;
mc.goalX =10;  //裝入動畫後影片剪輯(也就是滑塊)首先出現的位置
mc.onEnterFrame = function() {
 
 this.Step =this.Step*flex+(this.goalX-this.px)*drag; //計算滑塊移動步長的公式
 this.px+=this.Step;  //將步長累加,個人認爲這個很重要,相當於一個循環,以本次移動步長爲基準,進行下次累加
 this._x =this.px; //使影片剪輯的X座標軸等於
 
 if (this.sOut && this._xscale<99.5) {        /*這裏是縮放影片剪輯*/
  this._xscale += (100-this._xscale)/8;
 }
 if (this.sIn && this._xscale>0.1) {
  this._xscale += -this._xscale/8;
  
 }
};

////The First Button Events

b1.onRollOver = function() {
 mc.goalX =this._x;   //將按鈕的X座標值賦給影片剪輯的初始位置,也就是說,下次移動以這次的位置爲原點這裏根據按  鈕和影片剪輯的大小而定,若按鈕比影片剪輯小,相應的加上一些數值以作調節
  mc.sOut = true;       /*這裏是把一個BOOBLE值返回給調用它的函數,如下:
                                     if (this.sOut && this._xscale<99.5),以控制整個影片剪輯的縮放功能*/
  mc.sIn = false;
  this.fadeOut = true;
  this.fadeIn = false;
 };
 b1.onRollOut = function() {
  mc.sOut = false;
  mc.sIn = true;
  this.fadeIn = true;
  this.fadeOut = false;
 };
 
//The second Button Events
 b2.onRollOver = function() {
  mc.goalX =this._x;
  mc.sOut = true;
  mc.sIn = false;
  this.fadeOut = true;
  this.fadeIn = false;
 };
 b2.onRollOut = function() {
  mc.sOut = false;
  mc.sIn = true;
  this.fadeIn = true;
  this.fadeOut = false;
 };
 //The Third Button Events

b3.onRollOver = function() {
  mc.goalX =this._x;
  mc.sOut = true;
  mc.sIn = false;
  this.fadeOut = true;
  this.fadeIn = false;
 };
 b3.onRollOut = function() {
  mc.sOut = false;
  mc.sIn = true;
  this.fadeIn = true;
  this.fadeOut = false;
 };
 
 
 //The Fourth Button Events
 b4.onRollOver = function() {
  mc.goalX =this._x;
  mc.sOut = true;
  mc.sIn = false;
  this.fadeOut = true;
  this.fadeIn = false;
 };
 b4.onRollOut = function() {
  mc.sOut = false;
  mc.sIn = true;
  this.fadeIn = true;
  this.fadeOut = false;
 };
 
 //The Fifth Button Events
 
 b5.onRollOver = function() {
  mc.goalX =this._x;
  //trace(mc.goalX);
  mc.sOut = true;
  mc.sIn = false;
  
  this.fadeOut = true;
  this.fadeIn = false;
 };
 b5.onRollOut = function() {
  mc.sOut = false;
  mc.sIn = true;
  this.fadeIn = true;
  this.fadeOut = false;
 };

stop();

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章