movieclip & button

icke07

Grünschnabel
Hallo,

ich hab eine Navi aus Movieclips erstellt, deren Beschriftung so gelöst ist :

Code:
myLabels = new Array("STARTSEITE", "A", "B", "M", "I" , "V", "L", "N" , "KONTAKT", "IMPRESSUM");

for (i=0; i<myLabels.length; i++) {
	akt_bt = eval("bt"+i);
	akt_bt.textMC.mylabel.text = myLabels[i];
	akt_bt.onRollOver = function() {
		this.gotoAndPlay("Over");
	};
	akt_bt.onRollOut = function() {
		this.gotoAndPlay("Out");
	};
	akt_bt.onPress = function() {
		this.gotoAndPlay("Klick");	
	};
}

Wenn ich jetzt - egal welchen - button die getURL(); Anweisung gebe, haben alle den selben Link :confused:

Muss ich erst das gesamte Handbuch lesen und auch noch verstanden haben, um dieses Problem zu lösen?

Noch ein Array und dann verbinden - aber wie?
 
Hi und willkommen im Forum,

Code:
var myLabels = new Array("STARTSEITE", "A", "B", "M", "I" , "V", "L", "N" , "KONTAKT", "IMPRESSUM");

var myLinks = new Array("http://www.google.de", "http://www.tutorials.de", "", "", "", "", "", "", "", ""); // Array mit den Links

for (i=0; i<myLabels.length; i++) {
	akt_bt = this["bt" + i]; // eval ist in diesem Kontext veraltet
	akt_bt.textMC.mylabel.text = myLabels[i];
	akt_bt._link = myLinks[i]; // Link als Member des Buttons speichern
	akt_bt.onRollOver = function() {
		this.gotoAndPlay("Over");
	}
	akt_bt.onRollOut = function() {
		this.gotoAndPlay("Out");
	}
	akt_bt.onPress = function() {
		getURL(this._link); // gespeicherte URL aufrufen
		this.gotoAndPlay("Klick");
	}
}

Gruß
.
 
Zurück