求高手帮忙改个flash代码

[复制链接]
查看11 | 回复1 | 2011-4-12 11:23:50 | 显示全部楼层 |阅读模式
xmin = 280;
xmax = 1000;
ymin = 155;
ymax = 500;
speed = 15;
eanum = 20;
for (i = 1; i <= eanum; i++)
{

sm.duplicateMovieClip("m" + i, i);

this["m" + i].xran = random(_root.xmax - _root.xmin) + _root.xmin;

this["m" + i].yran = random(_root.ymax - _root.ymin) + _root.ymin;

this["m" + i].onEnterFrame = function ()

{

if (Math.round(this._x) != this.xran)

{

this._x = this._x + this.xn;

this.xn = (this.xran - this._x) / _root.speed;

}

else

{

this.xran = random(_root.xmax - _root.xmin) + _root.xmin;

} // end else if

if (Math.round(this._y) != this.yran)

{

this._y = this._y + this.yn;

this.yn = (this.yran - this._y) / _root.speed;

}

else

{

this.yran = random(_root.ymax - _root.ymin) + _root.ymin;

} // end else if

updateAfterEvent();

};
} // end of for
_root.onEnterFrame = function ()
{

this["m" + Math.ceil(Math.random() * _root.eanum)].play();
};
上面这个代码如何更改才能让动画效果不是始终至于页面顶层,而是在哪个图层通道就在哪显示的

回复

使用道具 举报

千问 | 2011-4-12 11:23:50 | 显示全部楼层
把这段代贴复制到一个元件里面, 然后放入场景上.把_root替换成this元件可以在图层里移动从而改变层级
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行