flexlib :: library Documentation | All Packages | All Classes | Index | Frames No Frames |
Fire

Package | flexlib.controls
Class | public class Fire
Inheritance | Fire mx.core.UIComponent

`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.

Public Properties

| 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 The scaleX factor that is used to generate the DisplacementMapFilter. | Fire
|  | displacementScaleY : Number The scaleY factor that is used to generate the DisplacementMapFilter. | Fire
|  | fireBlendMode : String The blendMode to use for the Flame object. | Fire
|  | hFactor : Number Determines how much "distortion" there is vertically. | Fire
|  | wFactor : Number 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

Public Methods

| 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

Protected Methods

| Method | Defined By
--- | --- | ---
|  | createChildren():void [override] | 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 [override] | Fire

Property Detail

angle | property

`angle:Number`

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`

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`

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`

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`

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.

Implementation
`public function get detail():int`
`public function set detail(value:int):void`

displacementScaleX | property |

`displacementScaleX:Number`

The `scaleX` factor that is used to generate the DisplacementMapFilter.

This property can be used as the source for data binding.

Implementation
`public function get displacementScaleX():Number`
`public function set displacementScaleX(value:Number):void`

displacementScaleY | property |

`displacementScaleY:Number`

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.

Implementation
`public function get displacementScaleY():Number`
`public function set displacementScaleY(value:Number):void`

fireBlendMode | property |

`fireBlendMode:String`

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 |

`hFactor:Number`

Determines how much "distortion" there is vertically. Values must be greater than 0.

This property can be used as the source for data binding.

Implementation
`public function get hFactor():Number`
`public function set hFactor(value:Number):void`

wFactor | property |

`wFactor:Number`

Determines how much "distortion" there is horizontally. Values must be greater than 0.

This property can be used as the source for data binding.

Implementation
`public function get wFactor():Number`
`public function set wFactor(value:Number):void`

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.

Method Detail

createChildren | () | method

`override protected 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.

Parameters

| `g: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.

Parameters

| `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 |

`override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void`

Parameters

| `unscaledWidth:Number`
| `unscaledHeight:Number`

Mercredi Juillet 4 2012, 09:36 PM +02:00