| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| // Knäckebrot 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);
//////////////////////////////////////////////////////////////////////////////////// zum compilieren fehlt dann noch die erweiterung "mc_tween2" - wer das noch nicht hat (lohnt sich aber ) -> hierhat 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... Geändert von modul47 (25-01-2007 um 15:49 Uhr) |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |