一个用as做出的FLASH导航条代码

演示地址:http://www.wsmmz.net/UploadFile/2005-6/2005629234318215.swf

该导航条共用到6个影片剪辑:两个动态文本框名称为itext,声音文件pipi

item_BG为一个白色小长方形图,为鼠标移上时用,居中下。
item_EN为一动态文本框,居中,放英文,属性单行可选;实例名mc_EN
item_ZH也是动态文本框,写中文,居左上;实例名mc_XH
item_L为一宽度为0的小竖条,垂直居中;实例名mc_L
item_TOPLine为一高度为3的小长条,全居中;实例名topLine
MenuItem里包含了上面4个剪辑,topLine透明度为0。

主场景帧1上语句:

var drag = 0.4;
var flex = 0.6;
var menuEN = new Array("News", "flash", "as", "asp", "ps", "DW", "leave word");
var menuZH = new Array("首页", "基础进阶", "脚本技术", "动态网站", "图形编辑", "网页制作", "留言本");
var menuURL = new Array("http://www.bnxy.com", "http://www.bnxy.com/list.asp?boardid=5", "http://www.bnxy.com/list.asp?boardid=7", "http://www.bnxy.com/list.asp?boardid=28", "http://www.bnxy.com/list.asp?boardid=12", "http://www.bnxy.com/list.asp?boardid=27", "#");
var menuColor = new Array(0xFF6699, 0x00A2FF, 0x96D302, 0xFFC600, 0xFF5400, 0xCD7DE1, 0x02D396);
var mBlock = this.attachMovie("mblock", "mb", 6);
mBlock._y = 5;
mBlock.goalX = -100;
mBlock.onEnterFrame = function() {
 this.Step = this.Step*flex+(this.goalX-this.px)*drag;
 this.px += this.Step;
 this._x = this.px;
 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;
 }
};
var MBColor = new Color(mBlock);
for (var i = 0; i<menuZH.length; i++) {
 pipi.start([1, 1]);
 var theItem = this.attachMovie("MenuItem", "Item"+i, i+10);
 theItem._x = i*84;
 theItem.mColor = menuColor[i];
 theItem.URL = menuURL[i];
 theItem.mc_ZH.itext.text = menuZH[i];
 theItem.mc_EN.itext.text = menuEN[i];
 theItem.onEnterFrame = function() {
  if (this.fadeOut) {
   if (this.topLine._alpha<99.5) {
    this.topLine._alpha += (100-this.topLine._alpha)/8;
   }
   if (this.mc_EN._alpha>0.5) {
    this.mc_EN._alpha += -this.mc_EN._alpha/0;
   }
   if (this.mc_ZH._xscale<00) {
    this.mc_ZH._xscale += 2;
    this.mc_ZH._yscale += 2;
   }
  }
  if (this.fadeIn) {
   if (this.mc_EN._alpha<99.5) {
    this.mc_EN._alpha += (100-this.mc_EN._alpha)/8;
   }
   if (this.topLine._alpha>0.5) {
    this.topLine._alpha += -this.topLine._alpha/8;
   }
   if (this.mc_ZH._xscale>100) {
    this.mc_ZH._xscale -= 2;
    this.mc_ZH._yscale -= 2;
   }
  }
 };
 theItem.onRollOver = function() {
  mBlock.goalX = this._x+42;
  mBlock.sOut = true;
  mBlock.sIn = false;
  MBColor.setRGB(this.mColor);
  new Color(this.topLine).setRGB(this.mColor);
  this.fadeOut = true;
  this.fadeIn = false;
 };
 theItem.onRollOut = function() {
  mBlock.sOut = false;
  mBlock.sIn = true;
  this.fadeIn = true;
  this.fadeOut = false;
 };
 theItem.onRelease = function() {
  getURL(this.URL);
 };
}
stop();

 另一代码:

演示地址:http://www.wsmmz.net/UploadFile/2005-6/2005629194239401.swf

主场景右下角舞台外有一无色无边框高0.1的小长条,其他同。

长方形图的MC上的AS:
drag = 0.400000;
flex = 0.700000;
Step=0;
px=0;
goalX = -100;

场景帧AS:
var drag = 0.400000;
var flex = 0.700000;
var menuEN = new Array("Home", "News", "Down", "Art", "Vouch", "BBS", "Links", "Gbook", "online", "User");
var menuZH = new Array("网站首页", "本站资讯", "字体下载", "设计文章", "精彩推荐", "论坛社区", "友情链接", "贵客留言", "与我在线", "用户中心");
var menuURL = new Array("http://www.wsmmz.com", "news.asp", "down.asp", "article.asp", "vouch.asp", "forum.asp", "links.asp", "gbook.asp", "online.asp", "user_main.asp");
var menuColor = new Array(16737945, 41727, 9884418, 16762368, 16733184, 13467105, 185238, 16762368, 184320, 188415);
var mBlock = this.attachMovie("mblock", "mb", 5);
mBlock._y = 6;
mBlock.goalX = -100;
mBlock.onEnterFrame = function ()
{  
    this.Step = this.Step * flex + (this.goalX - this.px) * drag;
    this.px = this.px + this.Step;
    this._x = this.px;
    if (this.sOut && this._xscale < 99.500000)
    {
        this._xscale = this._xscale + (100 - this._xscale) / 8;
    } // end if
    if (this.sIn && this._xscale > 0.100000)
    {
        this._xscale = this._xscale  - this._xscale / 8;
    } // end if
};
var MBColor = new Color(mBlock);
var i = 0;
while (i < menuZH.length)
{
   // pipi.start([1, 1]);
    var theItem = this.attachMovie("MenuItem", "Item" + i, i + 8);
    theItem._x = i * 75;
    theItem.mColor = menuColor[i];
    theItem.URL = menuURL[i];
    theItem.mc_ZH.itext.text = menuZH[i];
    theItem.mc_EN.itext.text = menuEN[i];
    theItem.onEnterFrame = function ()
    {
        if (this.fadeOut)
        {
            if (this.topLine._alpha < 99.500000)
            {
                this.topLine._alpha = this.topLine._alpha + (100 - this.topLine._alpha) / 8;
            } // end if
           
        } // end if
        if (this.fadeIn)
        {
          
            if (this.topLine._alpha > 0.500000)
            {
                this.topLine._alpha = this.topLine._alpha + -this.topLine._alpha / 8;
            } // end if
           
        } // end if
    };
    theItem.onRollOver = function ()
    {   pp=new Sound() ;pp.attachSound("pipi");pp.start();
        mBlock.goalX = this._x + 42;
        mBlock.sOut = true;
        mBlock.sIn = false;
        MBColor.setRGB(this.mColor);
        new Color(this.topLine).setRGB(this.mColor);
        this.fadeOut = true;
        this.fadeIn = false;
    };
    theItem.onRollOut = function ()
    {
        mBlock.sOut = false;
        mBlock.sIn = true;
        this.fadeIn = true;
        this.fadeOut = false;
    };
    theItem.onRelease = function ()
    {
        getURL(this.URL, "");
    };
    i++;
} // end while
//stop();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值