Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 22-11-2004, 23:17   #1 (permalink)
Co&Bold
 
Benutzerbild von Cysign
 
Registriert seit: Nov 2004
Ort: Troisdorf (bei Köln)
Beiträge: 170
Array oder if-Abfrage

Hallo, bin neu hier und hab auch schon direkt ein erstes Problem.
Mein beispiel gibt es unter http://rrs.bd-2.de/privat_michael/index.swf zu sehen. Klickt man im zweiten Menüpunkt auf einen Submenüpunkt und scrollt nun wieder im Hauptmenue rum, so wird das Submenü nicht mehr richtig angezeigt, falls die maus keinen Punkt im Menü hovert. Hat jemand von euch vielleicht ne Ahnung, wie ich das am besten löse?
Das helle hover-Feld im Hauptmenü heißt "Teil" und das im Submenü "Subteil"

Hier der Code:
Code:
//ANNIMATION
	
////////////////////////////////////////////////
/////////////    moveTeil 
////////////////////////////////////////////////
function moveTeil() { 

	//Animation
	
	//wenn ein button im hauptmenü geklickt, dann dorthin zurück, sonst zum button über dem die maus ist
	if (_root.clicked != null && _root.overed == 0) {
		_root.teil.tween("_x",_root.clicked,_root.speed, "easeOutCubic", 0);	
		_root.teil.tween("_width",_root.breite_c,_root.speed, "easeOutCubic", 0);
	}
	else {
		_root.teil.tween("_x",_root.ziel,_global.speed, "easeOutCubic", 0);
		_root.teil.tween("_width",_root.breite,_root.speed, "easeOutCubic", 0);
	}
}

////////////////////////////////////////////////
/////////////    moveSubTeil3
////////////////////////////////////////////////
function moveSubTeil3() { 

	//Animation
	
	//wenn ein button im hauptmenü geklickt, dann dorthin zurück, sonst zum button über dem die maus ist
	if (_root.subclicked != null && _root.subovered == 0) {
		
		_root.sub3.subteil.tween("_x",_root.subclicked,_root.speed, "easeOutCubic", 0);	
		_root.sub3.subteil.tween("_width",_root.subbreite_c,_root.speed, "easeOutCubic", 0);		
	}
	else {
	
		_root.sub3.subteil.tween("_x",_root.subziel,_global.speed, "easeOutCubic", 0);
		_root.sub3.subteil.tween("_width",_root.subbreite,_root.speed, "easeOutCubic", 0);
	}
}

////////////////////////////////////////////////
/////////////    moveSubTeil4
////////////////////////////////////////////////
function moveSubTeil4() { 

	//Animation
	
	//wenn ein button im hauptmenü geklickt, dann dorthin zurück, sonst zum button über dem die maus ist
	if (_root.subclicked != null && _root.subovered == 0) {
		
		_root.sub4.subteil.tween("_x",_root.subclicked,_root.speed, "easeOutCubic", 0);	
		_root.sub4.subteil.tween("_width",_root.subbreite_c,_root.speed, "easeOutCubic", 0);		
	}
	else {
	
		_root.sub4.subteil.tween("_x",_root.subziel,_global.speed, "easeOutCubic", 0);
		_root.sub4.subteil.tween("_width",_root.subbreite,_root.speed, "easeOutCubic", 0);
	}
}

////////////////////////////////////////////////
/////////////    moveSubTeil4
////////////////////////////////////////////////
function moveSubTeil5() { 

	//Animation
	
	//wenn ein button im hauptmenü geklickt, dann dorthin zurück, sonst zum button über dem die maus ist
	if (_root.subclicked != null && _root.subovered == 0) {
		
		_root.sub5.subteil.tween("_x",_root.subclicked,_root.speed, "easeOutCubic", 0);	
		_root.sub5.subteil.tween("_width",_root.subbreite_c,_root.speed, "easeOutCubic", 0);		
	}
	else {
	
		_root.sub5.subteil.tween("_x",_root.subziel,_global.speed, "easeOutCubic", 0);
		_root.sub5.subteil.tween("_width",_root.subbreite,_root.speed, "easeOutCubic", 0);
	}
}


////////////////////////////////////////////////
/////////////    moveSub
////////////////////////////////////////////////
function moveSub(y) {
	if (y == 3) {
		_root.sub3.tween("_x",_root.subpos3,_root.speed, "easeOutCubic", 0);
		_root.sub3.tween("_alpha",_root.subalpha3,1, "easeOutCirc", 0);
		}

	if (y == 4) {
		_root.sub4.tween("_x",_root.subpos4,_root.speed, "easeOutCubic", 0);
		_root.sub4.tween("_alpha",_root.subalpha4,1, "easeOutCirc", 0);
	}

	if (y == 5) {
		_root.sub5.tween("_x",_root.subpos5,_root.speed, "easeOutCubic", 0);
		_root.sub5.tween("_alpha",_root.subalpha5,1, "easeOutCirc", 0);
	}
}

////////////////////////////////////////////////
/////////////    resetSub
////////////////////////////////////////////////
function resetSub(x) {
	
	if (x != 3) {
		_root.subpos3 = -500;
		moveSub(3);
	}
	if (x != 4) {
		_root.subpos4 = -500;
		moveSub(4);
	}
	if (x != 5) {
		_root.subpos5 = -500;
		moveSub(5);
	}
}
Code:
#include "lmc_tween.as"

_root.speed = 1;

//Schaltervariable und gleichzeitig wird die xpos vom button übergeben
_root.clicked = null;
_root.subclicked = null;


////////////////////////////////////////////////
/////////////    menu button actions
////////////////////////////////////////////////
for (i=1; i<=8; i++) {
	
	this["buttonname"] = "button" + i;
	
	
	_root[this["buttonname"]].onRollOver = function () {
		//wo soll das teil anhalten wenn over und anim fertig
		_root.ziel = this._x;
		_root.overed = 1;
		_root.breite = this._width;
		moveTeil();
		
		//für untermenü		
		zahl = this._name.substring(6, 7);
		
		//_root.subpos3 = this._x;		
		this["subpos"+zahl] = "subpos" + zahl;
		_root[this["subpos"+zahl]] = this._x;
				
		//_root.subalpha3 = 100;
		this["subalpha"+zahl] = "subalpha" + zahl;
		_root[this["subalpha"+zahl]] = this._x;
				
		moveSub(zahl);
		resetSub(zahl);


	}
	_root[this["buttonname"]].onRollOut = function () {
		_root.overed = 0;
		_root.breite = this._width;
		moveTeil();
	}
	_root[this["buttonname"]].onRelease = function () {
		_root.clicked = Math.floor(this._x);
		_root.breite_c = this._width;
		moveTeil();
		
		
		///CONTENT TEST///
		_root.conti = this._name + "clicked";

		
	}
}//for


////////////////////////////////////////////////
/////////////    Subnav3, die Erste :)
////////////////////////////////////////////////


for (i=1; i<=4; i++) {
	
	this["buttonname"] = "button" + i;
	
	//_root["liste"][this["container"+b]]
	
	_root["sub3"][this["buttonname"]].onRollOver = function () {
	//_root.sub3.button2.onRollOver = function () {
	//_root[this["buttonname"]].onRollOver = function () {
		_root.subziel = this._x;
		_root.subovered = 1;
		_root.subbreite = this._width;
		moveSubTeil3();
	}
	
		_root["sub3"][this["buttonname"]].onRollOut = function () {
		_root.subovered = 0;
		_root.subbreite = this._width;
		moveSubTeil3();
	}
	_root["sub3"][this["buttonname"]].onRelease = function () {
		_root.subclicked = Math.floor(this._x);
		_root.subbreite_c = this._width;
		moveSubTeil3();
		
		_root.conti = this._name + "clicked";
		
	}

}//for


////////////////////////////////////////////////
/////////////    Subnav4
////////////////////////////////////////////////


for (i=1; i<=3; i++) {
	
	this["buttonname"] = "button" + i;
	
	//_root["liste"][this["container"+b]]
	
	_root["sub4"][this["buttonname"]].onRollOver = function () {
	//_root.sub3.button2.onRollOver = function () {
	//_root[this["buttonname"]].onRollOver = function () {
		_root.subziel = this._x;
		_root.subovered = 1;
		_root.subbreite = this._width;
		moveSubTeil4();
	}
	
		_root["sub4"][this["buttonname"]].onRollOut = function () {
		_root.subovered = 0;
		_root.subbreite = this._width;
		moveSubTeil4();
	}
	_root["sub4"][this["buttonname"]].onRelease = function () {
		_root.subclicked = Math.floor(this._x);
		_root.subbreite_c = this._width;
		moveSubTeil4();
		
		_root.conti = this._name + "clicked";
		
	}

}//for

////////////////////////////////////////////////
/////////////    Subnav5
////////////////////////////////////////////////


for (i=1; i<=3; i++) {
	
	this["buttonname"] = "button" + i;
	
	//_root["liste"][this["container"+b]]
	
	_root["sub5"][this["buttonname"]].onRollOver = function () {
	//_root.sub3.button2.onRollOver = function () {
	//_root[this["buttonname"]].onRollOver = function () {
		_root.subziel = this._x;
		_root.subovered = 1;
		_root.subbreite = this._width;
		moveSubTeil5();
	}
	
		_root["sub5"][this["buttonname"]].onRollOut = function () {
		_root.subovered = 0;
		_root.subbreite = this._width;
		moveSubTeil5();
	}
	_root["sub5"][this["buttonname"]].onRelease = function () {
		_root.subclicked = Math.floor(this._x);
		_root.subbreite_c = this._width;
		moveSubTeil5();
		
		_root.conti = this._name + "clicked";
		
	}

}//for
btw: #include "lmc_tween.as"
ruft die Extension MovieClipTween 1_1_7 auf, die dafür benötigt wird...ihr wisst schon...
Cysign ist offline   Mit Zitat antworten
Alt 23-11-2004, 11:44   #2 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Was macht die Funktion moveSubTeil3 und wo wird sie gestartet?

BTW: _root[this["buttonname"]] - schlimmer geht's nimmer *kopfschüttel*
  Mit Zitat antworten
Alt 23-11-2004, 15:02   #3 (permalink)
Neuer User
 
Registriert seit: May 2004
Beiträge: 21
hmm wäre schön wenn du so eine aussage auch erläutern würdest...

und die funktion liegt auf den submenü buttons im unteren codeblock

Geändert von brainiac (23-11-2004 um 15:08 Uhr)
brainiac ist offline   Mit Zitat antworten
Alt 23-11-2004, 17:11   #4 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Zitat:
hmm wäre schön wenn du so eine aussage auch erläutern würdest...
"_root" als Pfad gehört eigentlich verboten, weil er immer auf die aktuelle Hauptzeitleiste zeigt. Wird der Film mit der "_root"-Anweisung jetzt in einen Container-Film nachgeladen, zeigt "_root" auf die Hauptzeitleiste des Container-Films und die Objektpfade stimmen nicht mehr.

Und eine Kombination aus "_root" und "this" finde ich einfach grauenhaft, weil "this" bezieht sich sowieso auf die aktuelle Zeitleiste und ein _level0["buttonname"] wird als Objektpfad genauso reichen...
  Mit Zitat antworten
Alt 02-12-2004, 17:52   #5 (permalink)
Neuer User
 
Registriert seit: May 2004
Beiträge: 21
hmm recht hast du.. aber das scheint hier nicht das problem zu sein..
brainiac ist offline   Mit Zitat antworten
Alt 02-12-2004, 21:54   #6 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
"scheint" ist immer eine sehr schwammige Aussage... Du solltest besser mal testen und "buggern"...
  Mit Zitat antworten
Alt 11-12-2004, 15:16   #7 (permalink)
Co&Bold
 
Benutzerbild von Cysign
 
Registriert seit: Nov 2004
Ort: Troisdorf (bei Köln)
Beiträge: 170
Zitat:
Zitat von agedoubleju
"_root" als Pfad gehört eigentlich verboten, weil er immer auf die aktuelle Hauptzeitleiste zeigt. Wird der Film mit der "_root"-Anweisung jetzt in einen Container-Film nachgeladen, zeigt "_root" auf die Hauptzeitleiste des Container-Films und die Objektpfade stimmen nicht mehr.

Und eine Kombination aus "_root" und "this" finde ich einfach grauenhaft, weil "this" bezieht sich sowieso auf die aktuelle Zeitleiste und ein _level0["buttonname"] wird als Objektpfad genauso reichen...

Also wenn ich das richtig verstehe, bezieht sich _level0 auf die hauptzeitleiste dieser swf-datei und _root auf die zeitleiste des übergeordneten films, wenn ich den hier in einen anderen reinlade.

dann werd ich das sinnvollerweise mal ändern müssen.
hab das menü jetzt abgeändert, dass es zwar nicht das tut, was ich gerne hätte, aber erstmal seine funktion erfüllt.

mein nächstes problem ist ein preloader...
zuerst soll ein intro laufen und wenn man dieses abbricht, soll man zu der hier beschriebenen seite kommen.
allerdings sollen intro und hier die seite einen preloader bekommen, damit der user nicht denkt "hier kommt nichts mehr"...

wie stelle ich das denn am geschicktesten an?
Cysign ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 11:19 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele