In today's video tutorial, I'll show you how to create an ActionScript 3D particle effect that causes multiple stars to animate out in all directions in 3D space. Here is the ActionScript for this tutorial:

var container:MovieClip = new MovieClip();
addChild(container);
 
root.transform.perspectiveProjection.fieldOfView = 120;
 
addEventListener(Event.ENTER_FRAME, addStar);
 
function addStar(e:Event):void
{
	var mc:star = new star();
	mc.x = stage.stageWidth / 2;
	mc.y = stage.stageHeight / 2;
	mc.z = 0;
	mc.xVel = Math.random() * 4 - 2;
	mc.yVel = Math.random() * 4 - 2;
	mc.zVel = Math.random() * 4 - 2;
	mc.count = 0;
	container.addChild(mc);
	mc.addEventListener(Event.ENTER_FRAME, animate);
}
 
function animate(e:Event):void
{
	e.currentTarget.x += e.currentTarget.xVel;
	e.currentTarget.y += e.currentTarget.yVel;
	e.currentTarget.z += e.currentTarget.zVel;
	e.currentTarget.count++;
	if (e.currentTarget.count >= 100)
	{
		e.currentTarget.removeEventListener(Event.ENTER_FRAME, animate);
		container.removeChild(MovieClip(e.currentTarget));
	}
}

Click here for more comprehensive Flash video training