PositionManager
Kind of class: | class |
---|---|
Inherits from: | CoreObject |
Version: | 04/06/07 |
Author: | Aaron Clinger |
Classpath: | org.casalib.layout.PositionManager |
File last modified: | Monday, 01 December 2008, 13:34:40 |
Gives the ablility to position and size
MovieClip
s, TextField
s and Button
s with either an external CSS file or an internal StyleSheet
object.Since:
- Flash Player 7
Example:
-
var positionManager:PositionManager = new PositionManager(); 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%"}); this.positionManager.positionItems();
See also:
- "For information on which CSS properties are supported by PositionManager see org.casalib.util.StyleSheetUtil.positionItemWithStyleObject."
Summary
Constructor
Instance methods
- setStyleSheet (style:StyleSheet) : Void
- Defines a global stylesheet.
- addItem (item:Object, style:Object) : Boolean
- Adds item to be positioned and sized by styles.
- removeItem (item:Object) : Boolean
- Removes item previously added with addItem from receiving style and position updates from PositionManager.
- positionItems : Void
- Positions all items added with addItem with the defined styles.
Instance methods inherited from CoreObject
Constructor
PositionManager
function PositionManager (
)
Creates a new 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 typeMovieClip
,TextField
orButton
and was successfully added; otherwisefalse
.
Example:
-
this.positionManager.addItem(this.movie_mc, {left:"0", height:"100%"});
orthis.positionManager.addItem(this.movie_mc, this.styleSheet.getStyle("styleName"));
See also:
- "For information on which CSS properties are supported by PositionManager see org.casalib.util.StyleSheetUtil.positionItemWithStyleObject."
positionItems
function positionItems (
) : Void
Positions all items added with addItem with the defined styles.
Usage note:
-
positionItems
is automatically called after setStyleSheet.
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; otherwisefalse
.
setStyleSheet
function setStyleSheet (
style:StyleSheet) : Void
Defines a global stylesheet.
Class maps style IDs to instance names of added items. Style
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 org.casalib.util.StyleSheetUtil.positionItemWithStyleObject."