FlxBar
Deterministic value bar with renderer-owned fill geometry.
The optional parent/property binding is read once per fixed update. Rendering never regenerates textures when the value changes.
export declare class FlxBar extends FlxSpriteConstructors
constructor(x?: number, y?: number, direction?: FlxBarFillDirection, width?: number, height?: number, parent?: object | null, variable?: string, minimum?: number, maximum?: number, showBorder?: boolean)Constructs a new instance of the FlxBar class
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
direction | FlxBarFillDirection | - |
width | number | - |
height | number | - |
parent | object | null | - |
variable | string | - |
minimum | number | - |
maximum | number | - |
showBorder | boolean | - |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
barHeight | readonly | number | Logical bar height in pixels. |
barWidth | readonly | number | Logical bar width in pixels. |
borderColor | readonly | number | Packed 0xRRGGBBAA border color. |
BOTTOM_TO_TOP | static readonly | `` | - |
direction | - | FlxBarFillDirection | - |
emptyCallback | - | FlxBarCallback | null | - |
emptyColor | readonly | number | Packed 0xRRGGBBAA empty/background color. |
fillColor | readonly | number | Packed 0xRRGGBBAA fill color. |
filledCallback | - | FlxBarCallback | null | - |
fixedPosition | - | boolean | When false, the bar follows its parent position each fixed update. |
fraction | readonly | number | Current value normalized to the inclusive range, from 0 through 1. |
HORIZONTAL_INSIDE_OUT | static readonly | `` | - |
HORIZONTAL_OUTSIDE_IN | static readonly | `` | - |
killOnEmpty | - | boolean | - |
LEFT_TO_RIGHT | static readonly | `` | - |
maximum | readonly | number | - |
minimum | readonly | number | - |
parent | readonly | object | null | Bound parent object, when value tracking is active. |
parentVariable | readonly | string | Property name read from the bound parent object each fixed update. |
percent | readonly | number | Current value as a percentage from 0 through 100. |
positionOffset | readonly | FlxPoint | - |
RIGHT_TO_LEFT | static readonly | `` | - |
showBorder | readonly | boolean | - |
TOP_TO_BOTTOM | static readonly | `` | - |
value | - | number | - |
VERTICAL_INSIDE_OUT | static readonly | `` | - |
VERTICAL_OUTSIDE_IN | static readonly | `` | - |
Methods
createFilledBar()
createFilledBar(emptyColor?: number, fillColor?: number, showBorder?: boolean, borderColor?: number): thisParameters:
| Parameter | Type | Description |
|---|---|---|
emptyColor | number | - |
fillColor | number | - |
showBorder | boolean | - |
borderColor | number | - |
Returns: this
createRenderHandle()
createRenderHandle(): FlxBarRenderHandleReturns: FlxBarRenderHandle
destroy()
destroy(): voidReturns: void
setCallbacks()
setCallbacks(emptyCallback?: FlxBarCallback | null, filledCallback?: FlxBarCallback | null, killOnEmpty?: boolean): thisParameters:
| Parameter | Type | Description |
|---|---|---|
emptyCallback | FlxBarCallback | null | - |
filledCallback | FlxBarCallback | null | - |
killOnEmpty | boolean | - |
Returns: this
setParent()
setParent(parent: object | null, variable: string, track?: boolean, offsetX?: number, offsetY?: number): thisBind a parent object and optional property for value tracking.
When track is true the bar also follows the parent position using offsetX and offsetY.
Parameters:
| Parameter | Type | Description |
|---|---|---|
parent | object | null | - |
variable | string | - |
track | boolean | - |
offsetX | number | - |
offsetY | number | - |
Returns: this
setRange()
setRange(minimum: number, maximum: number): thisParameters:
| Parameter | Type | Description |
|---|---|---|
minimum | number | - |
maximum | number | - |
Returns: this
setValueProvider()
setValueProvider(provider: FlxBarValueProvider | null): thisParameters:
| Parameter | Type | Description |
|---|---|---|
provider | FlxBarValueProvider | null | - |
Returns: this
stopTrackingParent()
stopTrackingParent(posX: number, posY: number): thisStop following the parent and remain at the given world position.
Parameters:
| Parameter | Type | Description |
|---|---|---|
posX | number | - |
posY | number | - |
Returns: this
trackParent()
trackParent(offsetX: number, offsetY: number): thisBind a parent object property for value tracking, or follow an already-bound parent's position when the first argument is a numeric offset.
Parameters:
| Parameter | Type | Description |
|---|---|---|
offsetX | number | - |
offsetY | number | - |
Returns: this
trackParent()
trackParent(parent: object | null, variable: string): thisParameters:
| Parameter | Type | Description |
|---|---|---|
parent | object | null | - |
variable | string | - |
Returns: this
update()
update(): voidReturns: void