Package | flexlib.controls |
Class | public class Fire |
Inheritance | Fire ![]() |
Fire
produces a simulated fire or smoke-like effect.
By adjusting various parameters you can achieve a wide variety of different effects.
Fire
allows you to generate a multi-colored flame by setting the colors
array.
Property | Defined by | ||
---|---|---|---|
angle : Number
The angle that is used to generate the radial gradient that is used for the
| Fire | ||
color : uint
Fire can be customized to display in any color by setting the
color property. | Fire | ||
colors : Array
An array of colors that will color the Flame.
| Fire | ||
delay : Number
The delay in ms between visual updates.
| Fire | ||
detail : int
Level of detail for the flame.
| Fire | ||
displacementScaleX : Number = 50
The
scaleX factor that is used to generate the DisplacementMapFilter. | Fire | ||
displacementScaleY : Number = 50
The
scaleY factor that is used to generate the DisplacementMapFilter. | Fire | ||
fireBlendMode : String
The blendMode to use for the Flame object.
| Fire | ||
hFactor : Number = 5
Determines how much "distortion" there is vertically.
| Fire | ||
wFactor : Number = 6
Determines how much "distortion" there is horizontally.
| Fire | ||
xSpeed : Number = 0
The speed of the flame moving horizontally.
| Fire | ||
ySpeed : Number = 1
The speed of the flame moving vertically.
| Fire |
Method | Defined by | ||
---|---|---|---|
startBurning():void
Re-starts the animated flame animation, if it has been previously stopped by using the
stopBurning funtion. | Fire | ||
stopBurning():void
Stops the animated flame burning.
| Fire |
Method | Defined by | ||
---|---|---|---|
createChildren():void
| Fire | ||
createInput(g:Graphics, w:Number, h:Number):void
Creates the base bitmap that we're going to be applying the DisplacementMapFilter to.
| Fire | ||
makeNoise(event:Event):void
Rawr! OK, not that type of noise.
| Fire | ||
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
| Fire |
angle | property |
angle:Number
[read-write]The angle that is used to generate the radial gradient that is used for the
Implementation public function get angle():Number
public function set angle(value:Number):void
color | property |
color:uint
[read-write]
Fire can be customized to display in any color by setting the color
property.
You can also use the colors
property to set an array of colors. If you set
color
instead of colors
then it is the same as setting colors
to an array with only one color.
This property can be used as the source for data binding.
Implementation public function get color():uint
public function set color(value:uint):void
colors | property |
colors:Array
[read-write]An array of colors that will color the Flame. You can specify any number of colors, they will form a gradient from one to the other. The colors are ordered from the inside of the flame toward the outside.
This property can be used as the source for data binding.
Implementation public function get colors():Array
public function set colors(value:Array):void
delay | property |
delay:Number
[read-write]
The delay in ms between visual updates. Setting this to a higher number will slow
the visual updating, maybe enhancing performance. Setting this to 0 makes the effect
run based on the ENTER_FRAME
event. If you set this to anything higher
than 0 you will see choppiness in the effect (the higher the number the less smooth).
This property can be used as the source for data binding.
Implementation public function get delay():Number
public function set delay(value:Number):void
detail | property |
detail:int
[read-write]
Level of detail for the flame. What this is actually doing is using this number as the
octave
parameter for the perlinNoise function. Be careful with values over 3
or 4, the CPU usage increases as this property increases. And if you go over about 5 it's
hard to see much of a visual difference.
public function get detail():int
public function set detail(value:int):void
displacementScaleX | property |
public var displacementScaleX:Number = 50
The scaleX
factor that is used to generate the DisplacementMapFilter.
This property can be used as the source for data binding.
displacementScaleY | property |
public var displacementScaleY:Number = 50
The scaleY
factor that is used to generate the DisplacementMapFilter.
The default value is 50
.
This property can be used as the source for data binding.
fireBlendMode | property |
fireBlendMode:String
[read-write]The blendMode to use for the Flame object.
The default value is BlendMode.SCREEN
.
This property can be used as the source for data binding.
Implementation public function get fireBlendMode():String
public function set fireBlendMode(value:String):void
hFactor | property |
public var hFactor:Number = 5
Determines how much "distortion" there is vertically. Values must be greater than 0.
This property can be used as the source for data binding.
wFactor | property |
public var wFactor:Number = 6
Determines how much "distortion" there is horizontally. Values must be greater than 0.
This property can be used as the source for data binding.
xSpeed | property |
public var xSpeed:Number = 0
The speed of the flame moving horizontally. Use a positive number to have the flame appear to go left. A negatrive number will make it go right.
ySpeed | property |
public var ySpeed:Number = 1
The speed of the flame moving vertically. Use a positive number to have the flame appear to go up. A negatrive number will make it go downward.
createChildren | () | method |
protected override function createChildren():void
createInput | () | method |
protected function createInput(g:Graphics, w:Number, h:Number):void
Creates the base bitmap that we're going to be applying the DisplacementMapFilter to. Override this to create different types of Fire (or water) effects.
Parametersg:Graphics |
|
w:Number |
|
h:Number |
makeNoise | () | method |
protected function makeNoise(event:Event):void
Rawr! OK, not that type of noise.
This does all the heavy lifting to create the fire effect. If you wanted to extend this
component and use your own algorithm for distortion, you can override this method. This method
should set the bitmapData
of the output
variable.
event:Event |
startBurning | () | method |
public function startBurning():void
Re-starts the animated flame animation, if it has been previously stopped by using the
stopBurning
funtion.
stopBurning | () | method |
public function stopBurning():void
Stops the animated flame burning. The component will remain with the last flame image that was generated.
updateDisplayList | () | method |
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Parameters
unscaledWidth:Number |
|
unscaledHeight:Number |