qnx.ui.core.UIComponent

UIComponent

Properties | Methods


Packageqnx.ui.core
Classpublic class UIComponent
InheritanceUIComponent Inheritance flash.display.MovieClip
Implements IContainable
Subclasses Container, DropDown, Image, Label, List, MediaControl, Picker, ScrollPane, SegmentedControl, SkinnableComponent, Slider, TilingBackground, UISkin, VideoDisplay

The UIComponent class is the base class for all components.

Class information:
PlayBook Tablet OS Version:   1.0.6

See also

InvalidationType



Public Properties

 PropertyDefined By
  containment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
  size : Number
Gets or sets the size for this component (as a percentage of the container's size, or in pixels).
UIComponent
  sizeMode : String
Gets or sets the size mode for this component.
UIComponent
  sizeUnit : String
Gets or sets the unit of measure for the size property.
UIComponent

Public Methods

 MethodDefined By
  
Creates a new UIComponent instance.
UIComponent
  
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
  
drawNow():void
Calls the draw() method.
UIComponent
  
invalidate(property:String = all, invalidateNow:Boolean = false):void
Marks the property as invalid and the draw() method is called on the next frame or the next render, whichever comes first.
UIComponent
  
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
  
setSize(w:Number, h:Number):void
Sets the width and height of the component.
UIComponent

Protected Methods

 MethodDefined By
  
callLater(method:Function):void
Calls the specified method on the next frame or the next render, which ever happens first.
UIComponent
  
createInstance(linkage:Object):DisplayObject
Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.
UIComponent
  
draw():void
Called every time you set the width and height of the component.
UIComponent
  
isInvalid(property:String, ... properties):Boolean
Checks to see if the property is invalid and returns true if it is.
UIComponent
  
onAdded():void
Called when the instance is added to the stage.
UIComponent
  
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
  
setEnabled(val:Boolean):void
Called when the enabled property changes.
UIComponent
  
validate(property:String = all):void
Lets the component know that the specified property has been validated.
UIComponent

Property Detail

containment


containment:String

Gets or sets a property that determines how a component is contained within a parent container.

Possible values are:

  • Containment.BACKGROUND
  • Containment.UNCONTAINED
  • Containment.CONTAINED
  • Containment.DOCK_LEFT
  • Containment.DOCK_TOP
  • Containment.DOCK_RIGHT
  • Containment.DOCK_BOTTOM


Implementation

public function get containment():String
public function set containment(value:String):void

See also

Containment

size


size:Number

Gets or sets the size for this component (as a percentage of the container's size, or in pixels). This property is used by a container to layout this component in the appropriate direction.

If the size is 0, the component is not resized during container layout (it is positioned like any other MovieClip, Sprite or DisplayObject).


Implementation

public function get size():Number
public function set size(value:Number):void

See also

sizeUnit
Container.layout()

sizeMode


sizeMode:String

Gets or sets the size mode for this component. This property is used by a container when laying out a child component. Possible values are:

  • SizeMode.FLOW
  • SizeMode.BOTH
Note that this property is ignored when size is 0.


Implementation

public function get sizeMode():String
public function set sizeMode(value:String):void

See also

SizeMode

sizeUnit


sizeUnit:String

Gets or sets the unit of measure for the size property.

Possible values are:

  • SizeUnit.PERCENT
  • SizeUnit.PIXELS


Implementation

public function get sizeUnit():String
public function set sizeUnit(value:String):void

See also

SizeUnit

Constructor Detail

UIComponent()


public function UIComponent()

Creates a new UIComponent instance.

Method Detail

callLater()


protected function callLater(method:Function):void

Calls the specified method on the next frame or the next render, which ever happens first. The will only occur if the item is in the display list. If the item is not on the display list, the method will be called when it is added to the stage.

Parameters

method:Function — The method to call.

createInstance()


protected function createInstance(linkage:Object):DisplayObject

Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.

The linkage parameter can be one of three different types: Class, String, or DisplayObject instance.

  • If you pass in a Class, a new instance of that class is created and returned.
  • If you pass in a String, the flash.utils.getDefinitionByName will attempt to create a new method.
  • If you pass in a DisplayObject instance, the x and y values of the instance are set to 0 and returned.

Parameters

linkage:Object — The instance to create.

Returns

DisplayObject — A DisplayObject instance of the specified object.

destroy()


public function destroy():void

Call this method when you want to have your object collected by the garbage collector.

NOTE: This method does not remove the object from memory. Instead, it enables your instance to clean up after itself internally so that it can be garbage-collected.

draw()


protected function draw():void

Called every time you set the width and height of the component.

Subclassing this method allows you to redraw and set the layout for the children of the component in order to accomodate the new dimensions. If you decide to implement your own draw method, you should avoid calling super.draw(), as this will cause the physical dimensions of your component to be resized.

drawNow()


public function drawNow():void

Calls the draw() method. This immediately re-draws the component.

See also

draw()

invalidate()


public function invalidate(property:String = all, invalidateNow:Boolean = false):void

Marks the property as invalid and the draw() method is called on the next frame or the next render, whichever comes first.

Parameters

property:String (default = all) — The property to mark as invalid. Default value is InvalidationType.ALL.
invalidateNow:Boolean (default = false) — When set to true, the draw() method is called immediately. Default is false.

See also

InvalidationType
draw()

isInvalid()


protected function isInvalid(property:String, ... properties):Boolean

Checks to see if the property is invalid and returns true if it is. If multiple properties are passed in, true will be returned if 1 of the properties are invalid.

Parameters

property:String — The property to check.
... properties — Additional properties to check.

Returns

Boolean

See also

InvalidationType

onAdded()


protected function onAdded():void

Called when the instance is added to the stage.

This method can be overwritten in your subclasses. This method is called when the Event.ADDED_TO_STAGE event is dispatched.

onRemoved()


protected function onRemoved():void

Called when the instance is removed from the stage.

This method can be overwritten in your subclasses. This method is called when the Event.REMOVED_FROM_STAGE event is dispatched.

setEnabled()


protected function setEnabled(val:Boolean):void

Called when the enabled property changes.

You can override this method in order to customize how your component sets the enabled property.

Parameters

val:Boolean — A Boolean indicating the state of the enabled property.

See also

enabled

setPosition()


public function setPosition(x:Number, y:Number):void

Sets the x and y position of the component.

Parameters

x:Number — The new x position to be set.
y:Number — The new y position to be set.

setSize()


public function setSize(w:Number, h:Number):void

Sets the width and height of the component.

After setting the new dimensions, the setSize() function calls the draw() method, which allows you to adjust the layout or redraw your component's children.

Parameters

w:Number — The new width of the component.
h:Number — The new height of the component.

See also

draw()

validate()


protected function validate(property:String = all):void

Lets the component know that the specified property has been validated.

Parameters

property:String (default = all) — The property to mark as valid. The default is InvalidationType.ALL.

See also

InvalidationType.ALL