My account
Shopping cart
Knowledge base
Support


Usage and Code Samples for Text Menu Bar V1 Flash Component


Text Menu Bar V1 Usage and Code Samples

Properties

activeStates(defaultValue=true) :Boolean - property type boolean, true if the menu can have an active item, otherwise, if false, even an item is pressed, at the rollout event the text format for this item will change to the initialization properties.

horizontalAlign(default = "left") :String - property type string, indicates the horizontal alignment for the TextMenuBar. As default this is “left” and the TextMenuBar will have the fix point the X coordinate of the TextMenuBar, if it’s set to “right” the fix point will be the X coordinate of the TextMenuBar + the width of TextMenuBar. In addition, this property can be set to “center”.

verticalAlign (default="center"): String – property type string, indicates the vertical alignment of the TextMenuBar. It can be set to vertical alignment with “up”, “down” and “center”. If this property is set to “up” when the rollover event is taking place, the item will go down, if it’s set to “down”, the item will go up, otherwise if it’s set to “center” the item will have the fix position the center of its.

xmlPath(defaultValue="")-the path to the xml that will be loaded.

Methods

loadXML(arg:String)-this method can be used if there is a need to change the xml path to load another xml for the component, or if the component is attached from script one can use this method to load the xml.

setActiveItem(arg:Number)- method used to set active a menu item; arg – a number that indicates the index of the menu item that will be set as active. This method is used after the initialization of the component has been completed.

getActiveItem(arg:Number)- returns an integer, the index of the active menu item.

playIcon(index: Number, frame:Number ) - If there is an animation inside the icon clip, this method can be used to play the animation from the wanted frame. Index- optional, a number indicates the index of the menu item, if this parameter is undefined, it will play the animation from current roll over menu item. Frame – optional, a number representing the frame number to which the playhead is sent, if it is undefined the animation will play from the _currentframe.

Events

onLoadXmlComplete(arg:Object)-broadcast when the xml has been loaded completed successfully. Returns an object with an xml property, which is the xml file.

initializationComplete ()-broadcast when the initialization of the TextMenuBar has finished.

onItemPress (arg:Object)-broadcast when an item is pressed; returns an object with the three properties: properties, id, and target; properties is an XMLNode from the xml file for that item, id is the menu item’s from the menu and target, which is the reference of the item.

onItemRelease (arg:Object)-broadcast when an item is released; returns an object with the three properties: properties, id, and target; properties is an XMLNode from the xml file for that item, id is the menu item’s from the menu and target, which is the reference of the item.

onItemRollOver (arg:Object)-broadcast when mouse cursor roll over of an item; returns an object with the three properties: properties, id, and target; properties is an XMLNode from the xml file for that item, id is the menu item’s from the menu and target, which is the reference of the item.

onItemRollOut(arg:Object)- broadcast when mouse cursor roll out of an item; returns an object with the three properties: properties, id, and target; properties is an XMLNode from the xml file for that item, id is the menu item’s from the menu and target, which is the reference of the item.

Code Samples

var listener:Object=new Object();
listener.onLoadXmlComplete=function(arg)
{
//trace ("xml loaded"+arg.xml)
}
listener.initializationComplete=function ()
{
//trace("init complete")
}
listener.onItemRollOver=function(arg)
{
//trace("item roll over "+arg.id+"::"+arg.target)
}
listener.onItemRollOut=function(arg)
{
//trace("item roll out "+arg.id)
}
listener.onItemRelease=function(arg)
{
//trace("item released "+arg.id)
}
listener.onItemPress=function(arg)
{
//trace("item press "+arg.id)
}
clip.addEventListener("onLoadXmlComplete", listener)
clip.addEventListener("onItemRollOver", listener)
clip.addEventListener("onItemRollOut", listener)
clip.addEventListener("onItemRelease", listener)
clip.addEventListener("onItemPress", listener)
clip.addEventListener("initializationComplete", listener)