Access keys

PositionManager

Kind of class: class
Inherits from: CoreObject
Version: 11/22/06
Author: Aaron Clinger
Classpath: org.casaframework.layout.PositionManager
File last modified: Wednesday, 24 January 2007, 21:45:39
Gives the ablility to position and size MovieClips, TextFields and Buttons with either an external CSS file or an internal StyleSheet object.
Since:
Flash Player 7
Example:
var positionManager:PositionManager = PositionManager.getInstance();

this.positionManager.setStyleSheet(this.styleSheet);

this.positionManager.addItem(this.text_txt);
this.positionManager.addItem(this.button_btn);
this.positionManager.addItem(this.movie_mc, {left:"0", height:"100%"});
See also:
For information on which CSS properties are supported by PositionManager see org.casaframework.util.StyleSheetUtil.positionItemWithStyleObject.
Usage note:
Class sets Stage.align = "TL"; and Stage.scaleMode = "noScale"; by default. If you would like them defined differently set them any time after the first getInstance call.

Summary

Instance properties
Instance properties inherited from CoreObject
Class methods
Instance methods
Instance methods inherited from CoreObject

Class methods

getInstance

static function getInstance (
Returns:
PositionManager instance.

Instance methods

addItem

function addItem (
item:Object, style:Object) : Boolean
Adds item to be positioned and sized by styles.
Parameters:
item :
A MovieClip, TextField or Button.
style:
[optional] An object with style properties defined. Any properties defined here overwrite the values of any identical properties that may have been defined by setStyleSheet.
Returns:
Returns true if item was of type MovieClip, TextField or Button and was successfully added; otherwise false.
Example:
this.positionManager.addItem(this.movie_mc, {left:"0", height:"100%"}); or this.positionManager.addItem(this.movie_mc, this.styleSheet.getStyle("styleName"));
See also:
For information on which CSS properties are supported by PositionManager see StyleSheetUtil.positionItemWithStyleObject.

removeItem

function removeItem (
item:Object) : Boolean
Removes item previously added with addItem from receiving style and position updates from PositionManager. Leaves item at its current size and position.
Parameters:
item:
A MovieClip, TextField or Button you wish to remove.
Returns:
Returns true if item was successfully found and removed; otherwise false.

setStyleSheet

function setStyleSheet (
style:StyleSheet) : Void
Defines a global stylesheet.

Class maps style IDs to instance names of added items. Style #square_mc { width: 200px; height: 200px; } would apply to an item with an instance name of "square_mc.
Parameters:
style:
A StyleSheet to apply to added items.
See also:
For information on which CSS properties are supported by PositionManager see StyleSheetUtil.positionItemWithStyleObject.

update

function update (
) : Void
Updates all items added with addItem with the defined styles.
Usage note:
update is automatically called after addItem, setStyleSheet and apon stage resize.