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

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

<codeph>Fire</codeph> produces a simulated fire or smoke-like effect. <p>By adjusting various parameters you can achieve a wide variety of different effects. <codeph>Fire</codeph> allows you to generate a multi-colored flame by setting the <codeph>colors</codeph> array. </p>

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 <codeph>color</codeph> property. You can also use the <codeph>colors</codeph> property to set an array of colors. If you set <codeph>color</codeph> instead of <codeph>colors</codeph> then it is the same as setting <codeph>colors</codeph> 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 <codeph>ENTER_FRAME</codeph> 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 <codeph>octave</codeph> 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 <codeph>scaleX</codeph> 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 <codeph>scaleY</codeph> 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 <codeph>bitmapData</codeph> of the <codeph>output</codeph> 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 <codeph>stopBurning</codeph> 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 6 2011, 09:45 PM +02:00