Advertisement
  1. Code
  2. Effects
Code

Quick Tip: Create Instant Fire Particles With TeraFire

by
Difficulty:BeginnerLength:QuickLanguages:

Fire effects can be difficult to create, as they require advanced use of ActionScript and can take a lot of time to accomplish. In this Quick Tip, I'll introduce you to an ActionScript class that will help you speed up the process.


Final Result Preview

Let's take a look at the final result we will be working towards:


Step 1: Brief Overview

Using a brilliant class called TeraFire, we will recreate a candle flame. You can download the source of the class from the developer's site.


Step 2: Set Up Your Flash File

Launch Flash and create a new Flash Document, set the stage size to 320x280px and the frame rate to 24fps.


Step 3: Interface

This is the interface used in the example, a background previously created to place the resulting flame. You can find it in the FLA in the source download.


Step 4: ActionScript

Create a new ActionScript Class (Cmd+N), save the file as Main.as, and write the following lines; please read the comments in the code to fully understand the class behavior.

You can customize the way the particle looks by passing parameters to the TeraFire constructor. These are the parameters available:

  • xPos: The x position to create the fire, default is 0
  • yPos:The y position to create the fire, default is 0
  • fireWidth: Width of the resulting fire, default is 30
  • fireHeight: Height of the resulting fire, default is 90

Step 5: Document Class

Add the class name to the Class field in the Publish section of the Properties panel.


Conclusion

Now you're aware of this easy way to create fire for your movies, you'll find it comes in really handy when building games. Implement your own!

I hope you liked this tutorial, thank you for reading!

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.