class flixel.addons.ui.FlxUI extends FlxUIGroup implements IEventGetter
Available on all platforms
A simple xml-driven user interface * * Usage example: ui = new FlxUI(U.xml("saveslot"),this); add(_ui); * * @author Lars Doucet
Class Fields
static function event(name:String, sender:IFlxUIWidget, data:Dynamic, ?params:Array<Dynamic> = null):Void
EVENT HANDLING
static function forceFocus(b:Bool, thing:IFlxUIWidget):Void
Static-level function used to force giving a certain widget focus (useful for e.g. enforcing overlap logic) *
b | * |
thing |
static function request(name:String, sender:IFlxUIWidget, data:Dynamic, ?params:Array<Dynamic> = null):Dynamic
Broadcasts an event to the current FlxUIState/FlxUISubState, and expects data in return *
name | string identifier of the event -- each IFlxUIWidget has a set of string constants * |
sender | the IFlxUIWidget that sent this event * |
data | non-array data (boolean for a checkbox, string for a radiogroup, etc) * |
?params | (optional) user-specified array of arbitrary data * |
returns | some sort of arbitrary data from the recipient |
Instance Fields
function new(?data:Fast = null, ?ptr:IEventGetter = null, ?superIndex_:FlxUI = null, ?tongue_:IFireTongue = null):Void
PUBLIC FUNCTIONS
function addAsset(asset:IFlxUIWidget, key:String, ?group_id:String = '', ?recursive:Bool = false):Bool
Adds an asset to this UI, and optionally puts it in a group *
asset | the IFlxUIWidget asset you want to add * |
key | unique key for this asset. If it already exists, this fails. * |
group_id | string id of group inside this FlxUI you want to add it to. * |
recursive | whether to recursively search through sub-ui's |
function callEvent(id:String, sender:IFlxUIWidget, data:Dynamic, ?params:Array<Dynamic> = null):Void
function getRequest(id:String, sender:IFlxUIWidget, data:Dynamic, ?params:Array<Dynamic> = null):Dynamic
function getText(flag:String, ?context:String = 'data', ?safe:Bool = true, ?code:String = ''):String
UTILITY FUNCTIONS
function onFocusLost(widget:IFlxUIWidget):Void
This causes FlxUI to respond to a specific widget losing focus *
widget |
function removeAsset(key:String, ?destroy:Bool = true):IFlxUIWidget
Removes an asset *
key | the asset to remove * |
destroy | whether to destroy it * |
returns | the asset, or null if destroy=true |
function replaceAsset(key:String, replace:IFlxUIWidget, ?center_x:Bool = true, ?center_y:Bool = true, ?destroy_old:Bool = true):IFlxUIWidget
Replaces an asset, both in terms of location & group position *
key | the string id of the original * |
replace | the replacement object * |
destroy_old | kills the original if true * |
returns | the old asset, or null if destroy_old=true |
function setMode(mode_id:String, ?target_id:String = ''):Void
Set a mode for this UI. This lets you show/hide stuff basically. *
mode_id | The mode you want, say, "empty" or "play" for a save slot * |
target_id | UI element to target - "" for the UI itself, otherwise the id of an element that is itself a FlxUI |
function setSuperIndex(flxUI:FlxUI):Void
Set a pointer to another FlxUI for the purposes of indexing *
flxUI |