logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
English Garden
Costuming
Charity
Women's Fashion
Pop Music


dailyclick
All times in EST

Genealogy: 06:00 PM

Autism Spectrum Disorders: 4:00 PM

Full Schedule
g
g Flash Site
Diane Cipollo
BellaOnline's Flash Editor

g

Using Variables for Modular Particle System

When we began this FlashR CS3 particle system series of tutorials, we created a simple, modular function and demonstrated that we could use that function to animate three instances of the same movie clip. Since that first tutorial, we have come a long way and have built a particle system in ActionScriptTM 3. But how modular is this latest particle system? Can it be used for movie clips other than our mcSnowflake? Can we use it for a Flash movie that has a smaller or larger stage? Can we use a movie clip of a different size? Can we easily increase or decrease the maximum number of movie clips or the speed at which they fall down the stage?

Because this was a beginner's tutorial with many things to learn, the particle system was written using specific, hard coded settings for these features. But now that you have completed your particle system, we can make a few changes to the program code that will make it more modular and reuseable.

Rename the Functions

When we were only concerned with learning how to animate our snowflake movie clip, it was easier to name the function that created our snowflakes "snowflake" and the function that animated the snowflakes "snowfall". To make our program more versatile, we need to rename the functions with more generic names that still reflect the purpose of the functions.

Because this is a particle system, another name for the function that creates the snowflake can be "createParticles". Let's rename the snowflake function from "snowflake()" to "createParticles()".

At the top of the Actions panel, you will see a Find and Replace icon. Click on this icon to open the Find and Replace dialog box. In this dialog box, check the option called "Match Case" and use the following values.

Find what: snowflake()
Replace with: createParticles()

You should get a message that two were found and replaced. Repeat this step to rename the second function from "snowfall()" to "particlefall()". Again you will see two have been changed. Close the dialog box and test your movie. It still works.

Next →





RSS | Related Articles | Previous Features | Site Map


Content copyright © 2008 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.

Digg! g delicious Save to Del.icio.us

g


For FREE email updates, subscribe to the Flash Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
Flash Motion Editor and Presets

Flash CS4 Object-based Animation

Adobe Flash CS4 – 3D Tools

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Driving Amount
Much more
Slightly more
Slightly less
Much less

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2008 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor