XML- Is it possible to assign more than 1 "action" to the button - Senocular tutorial

I have studied Senocular tutorial at Kirupa : XML- Driven Drop Down Menu at this link an I learnt a lot.

The menu1.xml has a structure like this :

 <?xml version="1.0"?>
<menu name="example">
	<item name="example" action="message" variables="this shows an example menu with no real functionality"/>
	<menu name="submenu">
		<menu name="submenu">
			<item name="item"/>
			<item name="item"/>
			<item name="item"/>
		</menu>
		<menu name="submenu">
			<item name="item"/>
			<item name="item"/>
			<item name="item"/>
		</menu>
		<item name="item"/>
	</menu>
	<menu name="submenu">
		<item name="item"/>
		<item name="item"/>
		<item name="item"/>
	</menu>
	<item name="item"/>
	<item name="item"/>
	<menu name="load menu">
		<item name="example" action="newMenu" variables="xmlstuff/menu1.xml"/>
		<item name="messages" action="newMenu" variables="xmlstuff/menu2.xml"/>
		<item name="links" action="newMenu" variables="xmlstuff/menu3.xml"/>
	</menu>
</menu>

and the snippet code for action are :

Actions = Object();
Actions.gotoURL = function(urlVar){
	getURL(urlVar, "_blank");
};
Actions.message = function(msg){
	message_txt.text = msg;
};
Actions.newMenu = function(menuxml){
	menu_xml.load(menuxml);
};

Please have a look at the item name =“example” above. It has an action"message".

So, my question is :Is it possible to assign more than 1 “action” to the item name =“example”? How?

I desperately need your help.

Why don’t you try something like this:

<menu name=“example”>
<item name="example"variables=“this shows an example menu with no real functionality”>
<actions>
<action>mesage</action>
<action>message2</action>
… etc.
</actions>
</item>

Sorry mariachi,
I tried instanly and it does not work. The structure that you gave is actually giving a “new item” rather than assign the item to do something.

In the Senocolar method above, for example, the item name= “example” is assigned to the message action. Again my question is, instead of only assigned tpo the message action, can it also be assigned to gotoURL, or newMenu, or maybe to loadVariable.

Hi Beebs,

After reading the tute, I understand your point. If you go to this page:

kirupa.com - XML-Driven Drop-Down Menu

near the bottom is the answer to your question:

Just define a new function under the Actions object for each different function that you want to call.

Anyway, you can read it there.

Cheers,

Mike

Hi Mike,

Yeah, I’ve read that paragraph too, but my point is not how to define new function, but how can one item can execute more than 1 action. So, for item name=“example” instead only doing action=“message”, it can also doing action=“newMenu” at only one onRelease action.

The workaround in my brain are :

  1. Rework the any available action, by:
  • adding LoadMovie action ( this is going to be used to load any external file - jpg, swf and such) to the target movieclip on the stage called “container”)
  • adding loadVariables ( this is going to be used to load external text, or html text into multiline dynamic text on the stage called “info-txt” and variable name is = “displayText”)
  1. Adding new properties(variable) from xml:
    -properties “picture” is assigned to the picture
    -properties “article” is assigned to the article.
    I know and I did to rework the menu.xml but it just dont work.

That’s all my idea, I’ve been trying to work it out and no luck until this hour…