First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: EmperorGR

Step 2:actionscript

¡ö Choose Insert--> New Symbol.Make it a movie clip named firework.

¡ö From the Library (Window--> Library) drag in an instance of myBeam. In the Property inspector, type myBeam1 in the Instance Name text box.

¡ö Insert a layer named actions. Add keyframes in Frames 2 and 3. In the first keyframe, type or paste in the following ActionScript.

Code

//This action script duplicates the
//symbol instance myBeam1
//and rotates it to appear as the
//firework. It randomizes the//overall size of the firework, as
//well as the individual beam
//lengths. It also randomizes the
//color of each firework.
//Initialize variables
i=0;
//Cf is the variable that counts the
//frame and aids in setting
//the alpha value so that the
//fireworks twinkle.
cf=0;
//Number of beams regulates the
//fullness of each firework.
numberOfBeams=40;
// Random sizes are set for a single
//firework on the screen
myScale = 20 + Random(80);
//Make the instance, myBeam1,
//visible. This is necessary because
//myBeam1 gets set to invisible
//below.
setProperty("myBeam1",_visible,true)
;
// A maximum random size is set for
//the next firework on the screen
xyscalevar = 20 + Random(80);
//Randomize the color of the next
//firework
colorArray=["FF","00","33","99","66",
"CC"]
myColor=new Color(myBeam1);
myColor.setRGB("0x"+colorArray
[Random(6)]+colorArray[Random(6)]+
colorArray[Random(6)]);
// The following lines create the
//firework from a single beam
// and give each beam a random length
//which does not exceed the maximum
//size
// set by the variable xyscalevar
//above
do {
duplicateMovieClip("myBeam1","beam"
add i,i);
setProperty("beam" + i,_rotation,
random(360));
setProperty("beam" +
i,_xscale,myScale+random(myScale));
setProperty("beam" +
i,_yscale,myScale+random(myScale));
i = Number(i) + 1;
)
while (Number(i)<=numberOfBeams
)
//Make the instance, myBeam1,
//invisible. This is necessary
//because myBeam1 was never resized
//for this particular
//firework and it would look odd if
//it were visible.
setProperty("myBeam1",_visible,false
);
» Level Basic

Added: 2003-12-26
Rating: 5.92 Votes: 62
(10 being the highest)
» Author
18 years old,student,new to Flash
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.