Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Starry Night Flash ActionScript Particle System

Part 1: Create Stars Randomly on the Stage

To create a starry night Flash Actionscript Particle System, the first thing come to your mind is the stars.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

The first step of creating a starry night Flash Actionscript Particle System is to create all stars on the stage of Flash Movie in random.

Flash ActionScript Codes:

// Declare number of star
var numOfStars:uint = 60;

// Creates 60 stars randomly on the stage.
for (var i:uint = 0; i < numOfStars; i++) {

// Create a new star
// Remember to set linkage in Movie Library
var star:Star = new Star();

// Add the star to the stage
addChild(star);

// Assign start location of star
// stage.stageHeight and stage.stageWidth do not work in rubbish IE 6.0
//star.x = Math.random() * stage.stageWidth;
//star.y = Math.random() * stage.stageHeight;
star.y = Math.random() * 384;
star.x = Math.random() * 512;

}

 

/////////////////////////////////////////////
///// Add the Night Scenery MovieClip //////
////////////////////////////////////////////

// Create a new MovieClip
var nightScenery:MovieClip = new NightScenery();

// Add the new MovieClip to the MainTimeline
// so that we can see it.
addChild(nightScenery);

// Set the location of the new MovieClip
nightScenery.x = 256;
nightScenery.y = 273;

Remarks:

This Flash ActionScript Starry Night Particle System tutorial shows how to create stars randomly on the stage of flash Movie.