FLASH:韩国导航条解析

  效果如下:

准备工作:
1.新建一个名为item_BG的影片剪辑~
    在item_BG中添加一个矩形块,大小大概就和按钮的大小差不多,具体自己调~
    然后将item_BG该影片剪辑的链接名称命名为"mblock"
2.新建一个名为item_EN的影片剪辑~()
    在item_EN中添加一个动态文本框,将实例名称命名为"itext",文本框位置大小自己调~
    这里要注意的是在属性栏的右下方,有一个“字符...”按钮,点击可以看到字符选项~其中默认是无字符,也就是说什么字符都能显示~点击“指定范围”按钮后,可以在“包含此属性”下的输入框中输入字符或文字,只有这些文字或字符才能显示~
3.新建一个名为item_ZH的影片剪辑~
    在item_EN中添加一个动态文本框,将实例名称命名为"itext",文本框位置大小自己调~
    很多朋友都是在这里搞不懂,不明白为什么自己添加的文字不能够显示,看了上面第二段应该可以明白了~只需要把自己添加的文字加在“包含此属性”下的输入框中~
4.另外新建两个影片剪辑,分别为item_L和item_TOPLine~
    item_L就是分割线,item_TOPLine则是文字上方的颜色条,大小位置自己调~
5.新建名为MenuItem的影片剪辑~
    这里主要是把刚才做的各个影片剪辑排布好~
    实例名分别如下:
    item_TOPLine:topLine
    item_L:mc_L
    item_EN:mc_EN
    item_ZH:mc_CH
    并将MenuItem该影片剪辑的链接名称命名为"MenuItem"~
所有的准备工作的做好了,接下来添加代码~
回到主场景,在第一帧添加如下代码: 

 

var  drag  =   0.1 ;
// 震动参数
var  flex  =   0.7 ;
// 震动参数
var  menuEN  =   new   Array ( " News " ,   " Movie " ,   " Music " ,   " Game " ,   " Net TV " ,   " BBS " ,   " Member " );
// 定义一个数组,调用相应的英文文字,你可以在这里添加或修改,当然不想要英文就把它删掉吧~
var  menuZH  =   new   Array ( " 我要公文网 " ,   " 写作之家 " ,   " 音乐频道 " ,   " 游戏频道 " ,   " 网络电视 " ,   " 网友论坛 " ,   " 会员专区 " );
// 定义一个数组,调用相应的中文文字,同上,记住这两个数组中的文字只能输入你指定范围的文字,否则无法显示~
var  menuURL  =   new   Array ( " http://www.51gongwen.com " ,   " http://www.writehome.cn " ,   " # " ,   " # " ,   " # " ,   " # " ,   " # " );
// 定义一个数组,调用相应的链接~
var  menuColor  =   new   Array ( 0xD808B8 ,   0x00A2FF ,   0x96D302 ,   0xFFC600 ,   0xFF5400 ,   0x7908D8 ,   0x02D396 );
// 定义一个数组,调用相应的颜色值~
var  mBlock  =  this . attachMovie( " mblock " ,   " mb " ,   0 );
// 将链接名称为mblock的影片剪辑附加到场景中来,并声明一个变量mBlock来指定它~
mBlock . _y  =   5 ;
// 设定y坐标,y坐标始终是不变的

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 ++ ) {
    
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
. mc_EN . _alpha  =   0 ;
    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 < 99.5 ) {
                this
. mc_EN . _alpha  +=  ( 100 - this . mc_EN . _alpha) / 8 ;
            }
            
if  (this . mc_ZH . _xscale < 130 ) {
                this
. mc_ZH . _xscale  +=   2 ;
                this
. mc_ZH . _yscale  +=   2 ;
            }
        }
        
if  (this . fadeIn) {
            
if  (this . mc_EN . _alpha > 0.5 ) {
                this
. mc_EN . _alpha  +=   - 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);
        
// new Color(this.mc_ZH).setRGB(0xFFFFFF);
        this . fadeOut  =   true ;
        this
. fadeIn  =   false ;
    };
    theItem
. onRollOut  =   function () {
        mBlock
. sOut  =   false ;
        mBlock
. sIn   =   true ;
        
// new Color(this.mc_ZH).setRGB(0x000000);
        this . fadeIn  =   true ;
        this
. fadeOut  =   false ;
    };
    theItem
. onRelease  =   function () {
        getURL(this
. URL);
    };
}
stop();
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值