A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11261 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: David Brown
» Title: 3D Pyramid
» Description: 3D pyramid created for the SharedKnowledge.net web intro.
» More by David Brown


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 6325 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Leeds Technical Design
» Comments: Leeds Technical Design - Design consultancy, CAD Draughting and Contract Staff.


Random Links | Add your own Flash Related Links
Flash Tutorials 1212 Tutorials 7 New Tutorials Added!
What's New | Top100

» How to Make 3D Wall Flash Photo Gallery
» How to Make Personalized Multimedia Flash eCard in PowerPoint
» How to Create Grown up Christmas List Photo Story
» How to convert Youtube video(online SWF file) to video for portable devices?
» How to Make Flash Christmas Quizzes with Sounds & Videos
» FLV to PSP - How to convert YouTube video to PSP for mac
» Creating widgets fast and easily with SPAS 3.0
» How to Let PowerPoint Memorize like Man
» How to insert YouTube video (Flash video) into PowerPoint
» Unknown Tag: Title10
Random Tutorial | Add Site

bbm.netBBM.net is designed to save you time and deliver the highest quality royalty-free music for your multimedia projects. Features include: over 450 Music Loop Packages from some of the best composers in the business, our music search engine to speed your selection process, alternate music versions & bonus sounds to use for rollovers or transitions, free technical support and free consulting.

Click here for details »

Web Designer (+ some Development)
Aquent
US-SC-Spartanburg

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Special_Effects

Categories Fire effect class (Fire)
Author: alex winx | Website: www.winx.ws |

 
Page 1
1

Untitled Document

Fire effect class (Fire)

by Winx

Before Flash 8 we made fire mainly by drawing flames and animating every frame. We have use some programs like Photoshop or other that make animated gifs or into Flash itself. We have achived big .fla size, little reality cos of repeating frames and even low customization. Thx to Ken Perlin and his Perlin noise function, gives mankind opportunity programatically to create nature texture like wood, water, marible, fire, clouds ..... Perlin noise function is added to Flash 8 AS2 which allow us to make realistic textures and by using Flash animating engine make them alive.

Making Fire programatically takes 4 planing steps:

First step is to make gradient source movie clip that make fire color and form :

//create gradient movie that form the fire color
mcEx.createCustomGradientMovieClip(mcFire,"fireGradientSource",drawFunc,9,colors,alphas,ratios,"pad",
"LinearRGB",0,new Point(0,0),null,width,height,90);//+15+10

Note: I have use function createCustomGradientMovieClip(..) from MovieEx class to create gradient Movie Clip but u can write your own.
Note: Use your own drawFunc to draw Fire form. In second step we need to create flame granularity texture. So we apply perlinNoise on a bmp that we have created before.

In second step we need to create flame granularity texture. So we apply perlinNoise on a bmp that we have created before.

//create perlin noise flame granularity
classObject.perlinNoiseBitmap.perlinNoise(classObject.sampleSize/2,classObject.sampleSize,3,classObject.rnd,
false,true,1,true,classObject.noiseOffsets);

Then we need to create fire flames. For that we will use DisplacementMapFilter on a perlinNoiseBitmap and then apply on Fire gradient source movie clip.

classObject.displacementMapBitmap.draw(classObject.mcPerlinNoiseBitmapContainer);
//apply diplaced fire parts filter on gradient source (dying)
classObject.mcFire.fireGradientSource.filters =[classObject.fltDM];

Finnaly we will animating fire (make flames moves) by changing PerlinNoise noiseOffsets in EnterFrame or Interval events.


//make flames moving
classObject.noiseOffsets[i].x = classObject.noiseOffsets[i].x + classObject.noiseOffsetDeltas[i].x;
classObject.noiseOffsets[i].y = classObject.noiseOffsets[i].y + classObject.noiseOffsetDeltas[i].y;

Fire class contains:
-Fire
-startEffect
-stopEffect
-dispose

-------------------------------------
USAGE:
-------------------------------------

function Fire(target:MovieClip,name:String,x:Number,y:Number,width:Number,height:Number,
rotation:Number,sStrength:Number,spdRise:Number,spdFall:Number,colors:Array,alphas:Array,ratios:Array)

target: reference - the object which the Tween targets
name: string - name of new fire MovieClip
x: number - x coord
y: number - y coord
width: number - height of new fire MovieClip
height: number - width of new fire MovieClip
rotation: number - rotation angle
sStrength: number - starting fire value (0)
spdRise: number - fire rising intensity time period
spdFall:Number - fire falling intensity time period
colors:Array - gradient fire color (u can set custom color let say blue Fire)
alphas:Array - alphs
ratios:Array - intensity
drawFunc:Function - fire form (make ur own) *see drawFireForm
-------------------------------------
EXAMPLE: "fire"
------------------------------------

import effects.Fire;
import flash.geom.Point;
var
f:Fire=new Fire(_root,"fire",150,220,100,100,30,5,10,10,[0x910000,0x910000,0x910000,0xFF9900,0xFFFD8A,0xFFFD8B,0xFFFDCB],[0,0,100,100,100,100,100],[0,70,90,110,148,250,255]);

1

» Level Advanced

Added: : 2006-04-27
Rating: 2.76 Votes: 25
Hits: 1931
» Author
N/A
» Download
Download the files used in this tutorial.
Download (0 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers