flash duplicateMovieClip问题
y = 1;/**/
x = i;//
if (Number(i)<Number(h)) {
k = i;//
} else if (Number(i)>Number(w)) {
k = Number((m-i))+1;
y = i-w;
x = w;
} else {//
k = h;
}
l = "1";
while (Number(l)<=Number(k)){//
x = x-1;
y = Number(y)+1;
duplicateMovieClip("move""move"+mc mc);
setProperty("move"+mc _x 220+Number(x*4));
setProperty("move"+mc _y 150+Number(y*4));
setProperty("move"+mc _rotation mc*angle);
mc = Number(mc)+1;
l = Number(l)+1;
i = Number(i)+1;
代码是as2的怎样将代码改为as3的代码呢? 展开
影片剪辑在一个区域里随意的动类似下雨 下雪那种效果 你能把上面的代码
变成as3格式的代码吗?
帮你现写了一个 是这样的效果吧
import flash.events.Event;
var left:Number = 0;
var right:Number = stage.stageWidth;
var top:Number = 0;
var bottom:Number = stage.stageHeight;
var snowArr:Array = new Array ;
for (var i:int=0; i<100; i++)
{
var s:Snow = new Snow ;
s.x = Math.random() * right;
s.y = - Math.random() * bottom;
s.scaleX = s.scaleY = Math.random() * 0.6 + 0.4;
s.alpha = Math.random() * 0.8 + 0.2;
s.rotation = Math.random() * 360;
s.vx = Math.random() * 5 - 6;
s.vy = Math.random() * 3 + 2;
addChild(s);
snowArr.push(s);
}
//;
addEventListener(Event.ENTER_FRAME,onFrame);
function onFrame(e:Event):void
{
for (var i:int=0; i<100; i++)
{
var s:Snow = snowArr[i] as Snow;
s.x += s.vx;
s.y += s.vy;
if (s.y > bottom)
{
s.y = top;
}
if (s.x > right)
{
s.x = left;
}
if (s.x < left)
{
s.x = right;
}
}
}