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

**URL:** <https://forum.kirupa.com/t/xml-is-it-possible-to-assign-more-than-1-action-to-the-button-senocular-tutorial/56720>\
**Category:** flash\
**Created:** [July 7, 2004, 3:51am UTC](https://forum.kirupa.com/t/xml-is-it-possible-to-assign-more-than-1-action-to-the-button-senocular-tutorial/56720 "2004-07-07T03:51:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beebs](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Beebs](https://forum.kirupa.com/u/Beebs)\
**Post date:** [July 7, 2004, 3:51am UTC](https://forum.kirupa.com/t/xml-is-it-possible-to-assign-more-than-1-action-to-the-button-senocular-tutorial/56720/1 "2004-07-07T03:51:44Z")

</div>

I have studied Senocular tutorial at Kirupa : XML- Driven Drop Down Menu at [this link](http://www.kirupa.com/developer/actionscript/xml_dropdown_menu.htm) an I learnt a lot.

The menu1.xml has a structure like this :

```auto
 <?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 :

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 5:58am UTC](https://forum.kirupa.com/t/xml-is-it-possible-to-assign-more-than-1-action-to-the-button-senocular-tutorial/56720/2 "2004-07-07T05:58:18Z")

</div>

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\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 6:21am UTC](https://forum.kirupa.com/t/xml-is-it-possible-to-assign-more-than-1-action-to-the-button-senocular-tutorial/56720/3 "2004-07-07T06:21:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 5:09pm UTC](https://forum.kirupa.com/t/xml-is-it-possible-to-assign-more-than-1-action-to-the-button-senocular-tutorial/56720/4 "2004-07-07T17:09:20Z")

</div>

Hi Beebs,

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

[kirupa.com - XML-Driven Drop-Down Menu](http://www.kirupa.com/developer/actionscript/xml_dropdown_menu6.htm)

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

> [@Beebs](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 11:03pm UTC](https://forum.kirupa.com/t/xml-is-it-possible-to-assign-more-than-1-action-to-the-button-senocular-tutorial/56720/5 "2004-07-07T23:03:43Z")

</div>

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…
