皮什切克新闻:解释flash脚本

来源:百度文库 编辑:中科新闻网 时间:2024/04/25 07:47:00
这是一个导航栏的第一帧脚本:

// [Action in Frame 1]
function start_on()
{
_root.menu_chk = sub;
} // End of the function
fscommand("fullscreen", "false");
fscommand("allowscale", "false");
fscommand("showmenu", "false");
speed = 6;
menu_chk = 0;
menu_num = 6;
movieClip.prototype.setColor = function (code)
{
myColor = new Color(this);
mycolor.setRGB(code);
};
Menu_color = new Array();
Menu_color[1] = "0xCCCCCC";
Menu_color[2] = "0xCCCCCC";
Menu_color[3] = "0xCCCCCC";
Menu_color[4] = "0xCCCCCC";
Menu_color[5] = "0xCCCCCC";
Menu_color[6] = "0xCCCCCC";
for (i = 1; i <= menu_num; i++)
{
_root["menu" + i].onRollOver = function ()
{
menuString = new String(this._name);
num = menuString.substr(4, 6);
_root.menu_chk = num;
};
_root["menu" + i].onRollOut = function ()
{
_root.menu_chk = 0;
_root.start_on();
};
_root["menu" + i].onRelease = function ()
{
menuString = new String(this._name);
num = menuString.substr(4, 6);
getURL(_root["menuLink" + num], "");
};
_root["menu" + i].onEnterFrame = function ()
{
var _l1 = _root;
var _l2 = this;
menuString = new String(_l2._name);
num = menuString.substr(4, 6);
numFrame = _l1["menu" + num]._totalframes;
myFrame = _l1["menu" + num]._currentframe;
if (_l1.menu_chk == num)
{
_l2.nextFrame();
trace(myFrame);
_l1.mcSub.gotoAndStop("s" + num);
}
else if (myFrame == 1)
{
}
else
{
_l2.prevFrame();
_l1.mcSub.gotoAndStop(1);
} // end if
};
} // end of for
_root.slide.onEnterFrame = function ()
{
var _l1 = this;
var _l2 = _root;
if (_l2.menu_chk != 0)
{
elastic = 0.750000;
Move = (Move + (_l2["menu" + _l2.menu_chk]._x - _l1._x) / _l2.speed) * elastic;
_l1._x = _l1._x + Move;
_l1._width = _l1._width + (_l2["menu" + _l2.menu_chk]._width - _l1._width) / _l2.speed;
_l1._alpha = _l1._alpha + (100 - _l1._alpha) / _l2.speed;
_l1.colorBg.setColor(_l2.Menu_color[_l2.menu_chk]);
}
else
{
_l1._alpha = _l1._alpha - _l1._alpha / _l2.speed;
_l1._width = _l1._width - _l1._width / _l2.speed * _l2.menu_num;
} // end if
};
sub = 1;
sub_on = true;
start_on();
menuLink1 = "";
menuLink2 = "";
menuLink3 = "";
menuLink4 = "";
menuLink5 = "";
menuLink6 = "";
m1_s1 = "";
m1_s2 = "";
m1_s3 = "";
m1_s4 = "";
m1_s5 = "";
m2_s1 = "";
m2_s2 = "";
m2_s3 = "";
m3_s1 = "";
m3_s2 = "";
m3_s3 = "";
m3_s4 = "";
m3_s5 = "";
m4_s1 = "";
m4_s2 = "";
m4_s3 = "";
m5_s1 = "";
m5_s2 = "";
m5_s3 = "";
m6_s1 = "";
m6_s2 = "";
m6_s3 = "";
m6_s4 = "";
m6_s5 = "";
m6_s6 = "";

我的目的是再增加一个主栏目