Menu 01 Javascript Interaction

Author: Digicrafts Last Update: 26/08/2008

Javascript Interaction with Menu 01

1. In the "Other" interface, tick the "Enable Item Event".





2. In the html file, insert the event javascript. Menu 01 includes 4 standard event listeners for implementation. Only define the event function you need. Menu 01 will bypass the event that user do not define.

<script type="text/javascript"> 
//Suppose the flash object id is menu01
var menu01 = new DWControl('menu01');
menu01.onItemClick = function(id, selectedItem) {
//Implement the function when item click
alert ("Click on: " + id + " " + selectedItem.id + " " + selectedItem.title);
}
menu01.onItemSelect = function(id, selectedItem) {
//Implement the function when item select
alert ("Select: " + id + " " + selectedItem.id + " " + selectedItem.title);
}
menu01.onItemRollOver = function(id, selectedItem) {
//Implement the function when mouse over
alert ("Roll Over: " + id + " " + selectedItem.id + " " + selectedItem.title);
}
menu01.onItemRollOut = function(id, selectedItem) {
//Implement the function when mouse out
alert ("Roll Out: " + id + " " + selectedItem.id + " " + selectedItem.title);
}
</script>







3. Save and test your html.





4. User can defined their parameters in the photo source xml file. For example: If the user want to create an URL for each icon when click. He can add this script in the xml.



And he can get back the url by writing the following script:
<script type="text/javascript">
menu01.onItemClick = function(id, selectedItem)
alert (selectedItem.url);
}
</script>


The output should be http://IceAge.com .