13
Jan.2011
在修改一个FLASH导航条的时候,出现了AS代码的错误:实例名不能为纯数字,链接未定义。
原因:FLASH高版本中实例名不可以为纯数字,必须是字母开头,而原先的FLASH是低版本的FLASH做的,实例名为纯数字,在添加新的按钮后,AS代码不能用了,需要修改:
修改重定义所有按钮实例名为a1、a2、a3... 这样的格式;
修改所有的 this[i] 为 this["a" + i];
修改链接link数组代码link[] 为 link["a" + 1]
以下是完整as代码:
link = new Array();
link["a" +1] = "/";
link["a" +2] = "/index.php?c=msg&ts=aboutus";
link["a" +3] = "/index.php?c=list&cs=news";
link["a" +4] = "/index.php?c=list&cs=daily";
link["a" +5] = "/index.php?c=list&cs=pics";
link["a" +6] = "/index.php?c=list&cs=pros";
link["a" +7] = "/index.php?c=list&ms=jobs";
link["a" +8] = "/index.php?c=list&ms=contactus";
link["a" +9] = "/index.php?c=list&ms=book";
numOfMenu = 9;
_global.active = m;
_global.subActive = s;
_global.over = active;
for (i = 1; i <= numOfMenu; i++)
{
this["a"+i].bg.onRollOver = function ()
{
_global.over = this._parent._name;
};
this["a"+i].bg.onRollOut = this["a"+i].bg.onDragOut = function ()
{
_global.over = active;
};
this["a"+i].bg.onRelease = function ()
{
getURL(link[this._parent._name], "_self");
};
this["a"+i].onEnterFrame = function ()
{
var _loc2 = this;
if (over == _loc2._name)
{
_loc2.direction = "next";
_loc2.nextFrame();
return;
} // end if
_loc2.direction = "prev";
_loc2.prevFrame();
};
} // end of for
if (over)
{
point._x = point._x + (this[over]._x - point._x) * 3.000000E-001;
}
else
{
point._x = point._x + (-100 - point._x) * 3.000000E-001;
} this.onEnterFrame = function() {
// end else if
};
原因:FLASH高版本中实例名不可以为纯数字,必须是字母开头,而原先的FLASH是低版本的FLASH做的,实例名为纯数字,在添加新的按钮后,AS代码不能用了,需要修改:
修改重定义所有按钮实例名为a1、a2、a3... 这样的格式;
修改所有的 this[i] 为 this["a" + i];
修改链接link数组代码link[] 为 link["a" + 1]
以下是完整as代码:
link = new Array();
link["a" +1] = "/";
link["a" +2] = "/index.php?c=msg&ts=aboutus";
link["a" +3] = "/index.php?c=list&cs=news";
link["a" +4] = "/index.php?c=list&cs=daily";
link["a" +5] = "/index.php?c=list&cs=pics";
link["a" +6] = "/index.php?c=list&cs=pros";
link["a" +7] = "/index.php?c=list&ms=jobs";
link["a" +8] = "/index.php?c=list&ms=contactus";
link["a" +9] = "/index.php?c=list&ms=book";
numOfMenu = 9;
_global.active = m;
_global.subActive = s;
_global.over = active;
for (i = 1; i <= numOfMenu; i++)
{
this["a"+i].bg.onRollOver = function ()
{
_global.over = this._parent._name;
};
this["a"+i].bg.onRollOut = this["a"+i].bg.onDragOut = function ()
{
_global.over = active;
};
this["a"+i].bg.onRelease = function ()
{
getURL(link[this._parent._name], "_self");
};
this["a"+i].onEnterFrame = function ()
{
var _loc2 = this;
if (over == _loc2._name)
{
_loc2.direction = "next";
_loc2.nextFrame();
return;
} // end if
_loc2.direction = "prev";
_loc2.prevFrame();
};
} // end of for
if (over)
{
point._x = point._x + (this[over]._x - point._x) * 3.000000E-001;
}
else
{
point._x = point._x + (-100 - point._x) * 3.000000E-001;
} this.onEnterFrame = function() {
// end else if
};
相关日志
优秀的通用图片轮换播放器 Bcastr 4.0 及参数配置
四款实用的Flash载入动画Loading素材源代码
JTBC(php版):FLASH幻灯片完美调用方法
writeFlashHTML,一个JS方法,主要用于Flash的输出及用法
优秀的通用图片轮换播放器 Bcastr 4.0 及参数配置
四款实用的Flash载入动画Loading素材源代码
JTBC(php版):FLASH幻灯片完美调用方法
writeFlashHTML,一个JS方法,主要用于Flash的输出及用法
