Advanced Features
The textMenu also includes additional ActionScript methods which you may want to use either in conjunction with or instead of some of the built in commands. The following code examples uses a textMenu with instance name "myMenu":
1. To get the ID of the current menu button:
myMenu.getCurrentMenuID()
2. To get the name of the current menu button:
myMenu.getCurrentMenuName()
You may wish to use this method to access specific actions of functions for some menu buttons. For example:
myMenu.onMenuRelease = function() {
if(myMenu.getCurrentMenuName() == "Contact Us") {
contactFunction();
} else if(myMenu.getCurrentMenuName() == "About") {
trace("pressed About button");
}
};
3. To detect whether the menu XML file has loaded or not:
myMenu.xmlLoaded; // returns true or false
4. Perform action when a menu button is released:
myMenu.onMenuRelease = function() {
// enter action here
};
5. Perform action when a menu button is pressed:
myMenu.onMenuPress = function() {
// enter action here
};
6. Perform action on menu button rollover:
myMenu.onMenuRollOver = function() {
// enter action here
};
7. Perform action on menu button rollout:
myMenu.onMenuRollOut = function() {
// enter action here
};
8. You can also use the asfunction command to call a specific function using the regular link parameter. For example:
getURL("asfunction:myFunction","")