PDA

View Full Version : noob dynamic menu problem



jajaklar82
September 29th, 2008, 11:47 AM
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:



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[i];
b.linkk = linkurl[i];
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;
}

pensamente
September 29th, 2008, 12:57 PM
maybe you post in wrong section... this is all about as3.
inside flash forum you can find Flash 8 and actionscript 2.0, both might serve your needs

jajaklar82
September 29th, 2008, 08:23 PM
sorry for that