Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 25-01-2007, 15:06   #1 (permalink)
// Knäckebrot
 
Benutzerbild von modul47
 
Registriert seit: Mar 2002
Ort: München
Beiträge: 283
navi wie bei www.shopcomposition.com - funktion kommt nicht mehr mit...

hi all,

ich bin grade dabei eine ähnliche navigation wie der produktslider auf www.shopcomposition.com zu bauen.

habe im prinzip das ding auch schon fertig bekommen. nur einen hacken hat die sache. bei steuerung durch die buttons ist alles kein problem, da ich ich eine einzelnen klickevent habe und dann die aktion, das sliden, passiert.
wenn ich allerdings das scrollrad benutze, werden in kürzester zeit viele events ausgelöst, die ein leichtes chaos im slider produzieren.
da die einzelnen mc's ihre endgültige position noch nicht innehaben und auch die mc's die eigentlich "raus" müssen aus der bühne noch nicht außerhalb sind, überschlagen sich die anweisungen der bewegungs-skripte und sie bleiben hängen

so sieht mein code aus:
Code:
stop ();
Stage.scaleMode = "noScale";
//XML laden
function ladeXML ()
{
	menu_xml = new XML ();
	menu_xml.ignoreWhite = true;
	menu_xml.load ("menu.xml");
	menu_xml.onLoad = function ()
	{
		img_array = new Array ();
		name_array = new Array ();
		for (var y = 0; y < menu_xml.childNodes [0].childNodes.length; y ++)
		{
			img_array [y] = menu_xml.firstChild.childNodes [y].childNodes [0].childNodes;
			name_array [y] = menu_xml.firstChild.childNodes [y].childNodes [1].childNodes;
		}
		buildMenu ();
	}
}
this.LadeObj = new LoadVars ();
this.LadeObj.load ("menu.xml");
this.LadeObj.onLoad = ladeXML;
////////////////////////////////////////////////////////////////////////////////////
//alle mcs befüllen und anordnen 
function buildMenu ()
{
	this.createEmptyMovieClip ("menu_container", 100);
	this.menu_container._x = 0;
	this.menu_container._y = 0;
	for (var x = 0; x < menu_xml.childNodes [0].childNodes.length; x ++)
	{
		this.menu_container.attachMovie ("element", "element_" + x + "_att", x + 200);
		this.menu_container ["element_" + x + "_att"]._y = 10;
		this.menu_container ["element_" + x + "_att"]._x = (150 * x) + 800;
		this.menu_container ["element_" + x + "_att"].id = x
		this.menu_container ["element_" + x + "_att"].container._x = 10;
		this.menu_container ["element_" + x + "_att"].container._y = 10;
		this.menu_container ["element_" + x + "_att"].container.loadMovie (img_array [x])
		this.menu_container ["element_" + x + "_att"].info.text = x;
	}
	trace (img_array [x]);
	startMenu ();
}
_root.take = 0
////////////////////////////////////////////////////////////////////////////////////s
// die ersten 5 zeigen
function startMenu ()
{
	for (var v = 0; v < 5; v ++)
	{
		_root ["take_" + v] = 150 * v;
		this.menu_container ["element_" + v + "_att"].xSlideTo ((_root.take) + 50, 2);
		_root.take = _root.take + 150;		
	}
	varX = v - 1;
}
varA = 0;
////////////////////////////////////////////////////////////////////////////////////
// buttonfunktion nächstes element
function nextElement ()
{
	if ((varX + 1) < menu_xml.childNodes [0].childNodes.length)
	{
		varX = varX + 1;
		for (var a = 0; a < menu_xml.childNodes [0].childNodes.length; a ++)
		{
			this.menu_container ["element_" + a + "_att"].xSlideTo (this.menu_container ["element_" + a + "_att"]._x - 150, 2);
			if (this.menu_container ["element_" + a + "_att"]._x < 150) {
				this.menu_container ["element_" + a + "_att"].xSlideTo (this.menu_container ["element_" + a + "_att"]._x - 1800, 4);	
			}
		}
		this.menu_container ["element_" + (varX - 5) + "_att"].xSlideTo (this.menu_container ["element_" + (varX - 5) + "_att"]._x - 1800, 4);
		this.menu_container ["element_" + (varX) + "_att"].xSlideTo (650, 2);
		this.menu_container ["element_" + (varX - 1) + "_att"].xSlideTo (500, 2);
		this.menu_container ["element_" + (varX - 2) + "_att"].xSlideTo (350, 2);
		this.menu_container ["element_" + (varX - 3) + "_att"].xSlideTo (200, 2);
		this.menu_container ["element_" + (varX - 4) + "_att"].xSlideTo (50, 2);		
	}
}
// buttonfunktion voriges element
function prefElement ()
{
	if (varX > "4" )
	{
		varX = varX - 1;
		for (var a = 0; a < menu_xml.childNodes [0].childNodes.length; a ++)
		{
			this.menu_container ["element_" + a + "_att"].xSlideTo (this.menu_container ["element_" + a + "_att"]._x + 150, 2);
			if (this.menu_container ["element_" + a + "_att"]._x > 650) {
				this.menu_container ["element_" + a + "_att"].xSlideTo (this.menu_container ["element_" + a + "_att"]._x + 1800, 4);	
			}
		}
		this.menu_container ["element_" + (varX+1) + "_att"].xSlideTo (this.menu_container ["element_"+(varX+1)+"_att"]._x + 1800, 4);
		this.menu_container ["element_" + (varX - 0) + "_att"].xSlideTo (650, 2);
		this.menu_container ["element_" + (varX - 1) + "_att"].xSlideTo (500, 2);
		this.menu_container ["element_" + (varX - 2) + "_att"].xSlideTo (350, 2);
		this.menu_container ["element_" + (varX - 3) + "_att"].xSlideTo (200, 2);
		this.menu_container ["element_" + (varX - 4) + "_att"].xSlideTo (50, 2);	
	}		
}
////////////////////////////////////////////////////////////////////////////////////
// button clickevents
this.bt_next.onRelease = function ()
{
	nextElement ();
}
this.bt_pref.onRelease = function ()
{
	prefElement ();
}
// mouse scrollrad listener
var mouseListener : Object = new Object ();
mouseListener.onMouseWheel = function (delta)
{
	if ((delta/3) < 0) {
		nextElement ();
	} else if ((delta/3) > 0) {
		prefElement ();
	}
}
Mouse.addListener (mouseListener);
////////////////////////////////////////////////////////////////////////////////////
und die fla zum runterladen inkl. xml und images hier im anhang

zum compilieren fehlt dann noch die erweiterung "mc_tween2" - wer das noch nicht hat (lohnt sich aber ) -> hier

hat jemand ne idee, wie sich das lösen lässt?

vielen dank,

tom

//EDIT: habe grade noch ausprobiert eine variable zu setzen, die bei funktionsaufruf abgefragt wird, standard 0, dann gesetzt wird auf 1, und dann am ende der funtkion wieder auf 0 gesetzt wird. hatte den gedanken, wenn die funktion von oben nach unten abgearbeitet wird, könnte diese funktion dann erst wieder erneut aufgerufen werden, wenn sie einmal durchgelaufen ist... das scheint der funktion aber egal zu sein...
Angehängte Dateien
Dateityp: zip scroller_dynamic.zip (35,5 KB, 26x aufgerufen)
__________________
www.flickr.com/photos/i47/ - auswahl meiner pics
www.i47.de - portfolio

Geändert von modul47 (25-01-2007 um 15:49 Uhr)
modul47 ist offline   Mit Zitat antworten
Alt 26-01-2007, 10:09   #2 (permalink)
// Knäckebrot
 
Benutzerbild von modul47
 
Registriert seit: Mar 2002
Ort: München
Beiträge: 283
hat denn niemand eine ahnung?
__________________
www.flickr.com/photos/i47/ - auswahl meiner pics
www.i47.de - portfolio
modul47 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 01:23 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele