# Noob dynamic menu problem

**URL:** <https://forum.kirupa.com/t/noob-dynamic-menu-problem/271848>\
**Category:** Uncategorized\
**Created:** [September 29, 2008, 3:47pm UTC](https://forum.kirupa.com/t/noob-dynamic-menu-problem/271848 "2008-09-29T15:47:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jajaklar82](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jajaklar82](https://forum.kirupa.com/u/jajaklar82)\
**Post date:** [September 29, 2008, 3:47pm UTC](https://forum.kirupa.com/t/noob-dynamic-menu-problem/271848/1 "2008-09-29T15:47:33Z")

</div>

Hey everyone!

First of all I have to say I m really a beginner with action script.:ch:  
So right now I’m trying to adapt some code I found to my needs.

The goal is to create several buttons dynamically, each with a different link.  
The titles of the buttons as well as the links’ URLs are passed as variables from swfobject.

The linkttitles (from “menu”) get displayed as they should nicely on each button.  
However, if I try the same thing with urls for the buttons, it does not work: Every button links to the same destination, right now \_root.label5 (as the limit set by \_root.albumcount is currently 5).

Thanks for any comments or any help, hints or advice to improve myself and/or the code below!  
cheers:mario:

```auto

menu = [_root.linktitel1, _root.linktitel2, _root.linktitel3, _root.linktitel4, _root.linktitel5, _root.linktitel6, _root.linktitel7,_root.linktitel8, _root.linktitel9];
linkurl = [_root.label1, _root.label2, _root.label3, _root.label4, _root.label5, _root.label6, _root.label7, _root.label8, _root.label9];
this.createEmptyMovieClip("content", 1000);
this.attachMovie("sectionBackground", "mask", 1001);
mask._y = content._y=165;
mask._x = target=96;
content.setMask(mask);
content._x = -1000;
xStart = -100;
yStart = 0;
bWidth = 75.5;
bHeight = 47.5;
interval = 50;
countDown = _root.albumcount;
menuOpen = false;
theTime = 0;
buttonScrollSpeed = 2;

for (var i = 0; i<_root.albumcount; i++) {
	
	var b = this.attachMovie("subButton", "subButton"+i, countDown);
	countDown--;
	b.stop();
	b._x = xStart;
	b._y = yStart;
	b.interval = interval*i;
	b.target = xStart+(bWidth*i);
	b.txt = menu*;
	b.linkk = linkurl*;
	b.pos = target+(i*-section._width);
	b.onPress = function() {
		
		this.gotoAndStop(1);
		getURL(b.linkk)
	};
	
	b.onRollOver = function() {
		this.gotoAndStop(2);
	};
	b.onRollOut = function() {
		this.gotoAndStop(1);
		
	};
	b._visible = true;
}

```
