# Linking to named frames using XML menu

**URL:** <https://forum.kirupa.com/t/linking-to-named-frames-using-xml-menu/293877>\
**Category:** flash\
**Created:** [August 5, 2009, 8:26am UTC](https://forum.kirupa.com/t/linking-to-named-frames-using-xml-menu/293877 "2009-08-05T08:26:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grldnmb9](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@grldnmb9](https://forum.kirupa.com/u/grldnmb9)\
**Post date:** [August 5, 2009, 8:26am UTC](https://forum.kirupa.com/t/linking-to-named-frames-using-xml-menu/293877/1 "2009-08-05T08:26:28Z")

</div>

Greetings to all.

I have just joined this forum after searching for days for a solution to my problem.

I downloaded a flash/xml menu and I would want to link to a spacific frame on my flash website. I’m not that good at coding yet. Can anybody help?

Here is what the actionscript looks like:

import flash.filters.DropShadowFilter;  
import mx.transitions.Tween;  
import mx.transitions.easing.\*;

stop();

//create function to add buttons  
function addButtons() {  
pushOverX = 0;  
for (i=0; i\<obj.buttons.length; i++) {  
btn = buttons.attachMovie(“menu”, “menu”+i, i, {\_x:pushOverX, \_y:0});  
btnsArray.push(btn);  
pushOverX += btn.\_width + btnSpacing;  
btn.itemOverColor = obj.buttons\*.attributes.itemRollOverColor;  
btn.itemColor = obj.buttons\*.attributes.itemColor;  
btn.parentBtn.name\_txt.text = obj.buttons\*.attributes.title;  
btn.parentBtn.name\_txt.textColor = btn.itemColor;

```
	//create menuItems array to store the text labels (do not change the array name, keep it &gt;&gt;menuItems&lt;&lt;);
	btn.menuItems = new Array();
	btn.links = new Array();
	for (j=0; j&lt;obj.buttons*.childNodes.length; j++) {
		btn.menuItems.push(obj.buttons*.childNodes[j].attributes.title);
		btn.links.push(obj.buttons*.childNodes[j].attributes.link);
	}
	//add shadow filter
	btn.filters = [ds];
}

```

}

var ds:DropShadowFilter = new DropShadowFilter(2, 45, 0x000000, 100, 6, 6, 1.1, 3);

//space between buttons  
var btnSpacing:Number = new Number();

//object that contains data from xml  
var obj:Object = new Object();

//create nex xml object  
var xml:XML = new XML();  
xml.ignoreWhite = true;

//after the xml is loaded, load variables and parse the date to obj  
xml.onLoad = function(succes) {  
if (succes) {  
//bS = Number(this.firstChild.attributes.spacing);  
obj.buttons = this.firstChild.childNodes;  
btnSpacing = Number(this.firstChild.attributes.buttonsSpacing);  
//function call  
addButtons();  
} else {  
trace(“xml could not load”);  
}  
};

//the path to the xml file  
xml.load(“menu.xml”);

//this part is for tooltip functionality, if you don’t need a tooltip you can delete the code  
var mouseListener:Object = new Object();  
var btnsArray:Array = new Array();  
var showMenu:Boolean = true;  
\_global.showTooltip = true;

function hideAll() {  
for (i=0; i\<btnsArray.length; i++) {  
mc = btnsArray\*;  
mc.enabled = false;  
}  
buttons.tweenAlpha.stop();  
buttons.tweenAlpha = new Tween(buttons, “\_alpha”, Strong.easeOut, buttons.\_alpha, 0, 2, true);  
}  
function showAll() {  
for (i=0; i\<btnsArray.length; i++) {  
mc = btnsArray\*;  
mc.enabled = true;  
}  
buttons.tweenAlpha.stop();  
buttons.tweenAlpha = new Tween(buttons, “\_alpha”, Strong.easeIn, buttons.\_alpha, 100, 2, true);  
}

Mouse.addListener(mouseListener);

mouseListener.onMouseDown = function() {  
if (\_global.showTooltip) {  
if (showMenu) {  
showMenu = false;  
tooltip.txt.text = “+ Click to show menu”;  
hideAll();  
} else {  
showMenu = true;  
tooltip.txt.text = “- Click to hide menu”;  
showAll();  
}  
}  
};  
tooltip.txt.text = “- Click to hide menu”;

tooltip.onEnterFrame = function() {  
//follow the cursor  
if (\_global.showTooltip) {  
this.\_visible = true;  
this.\_x = \_xmouse+10;  
this.\_y = \_ymouse+5;  
updateAfterEvent();  
} else {  
//if a menu is active hide the tooltip  
this.\_visible = false;  
}  
};

And my XML:

\<?xml version=“1.0” encoding=“UTF-8”?\>

\<menu buttonsSpacing=“25” \>

```
&lt;item title="Who We Are" itemColor="0xFFFFFF" itemRollOverColor="0xFFCC00"&gt;
	&lt;subitem title="menu item 1" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 3" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 4" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 4" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 4" link ="http://www.ffiles.com/users/NoGrids" /&gt;
&lt;/item&gt;

&lt;item title="What We Do" itemColor="0xFFFFFF" itemRollOverColor="0x33CC66"&gt;
	&lt;subitem title="menu item 1" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 3" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 3" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 4" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 5" link ="http://www.ffiles.com/users/NoGrids" /&gt;
&lt;/item&gt;

&lt;item title="Why We Do It" itemColor="0xFFFFFF" itemRollOverColor="0x0EF0C0"&gt;
	&lt;subitem title="menu item 1" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 3" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 4" link ="http://www.ffiles.com/users/NoGrids" /&gt;
&lt;/item&gt;

&lt;item title="How We Do It" itemColor="0xFFFFFF" itemRollOverColor="0x0EF0C0"&gt;
	&lt;subitem title="menu item 1" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;		
&lt;/item&gt;

&lt;item title="Research and Insights" itemColor="0xFFFFFF" itemRollOverColor="0x0EF0C0"&gt;
	&lt;subitem title="menu item 1" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 3" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 4" link ="http://www.ffiles.com/users/NoGrids" /&gt;
&lt;/item&gt;

&lt;item title="Careers" itemColor="0xFFFFFF" itemRollOverColor="0xFE3090"&gt;
	&lt;subitem title="menu item 1" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
	&lt;subitem title="menu item 2" link ="http://www.ffiles.com/users/NoGrids" /&gt;
&lt;/item&gt;

```

\</menu\>

I need to get something like “go to this frame in the flash site” instead but don’t know how.

Any help would be greatly, greatly appreciated

Thanx in advance
