Autor |
Nachricht |
public
Threadersteller
Dabei seit: 29.11.2004
Ort: Dessau
Alter: 43
Geschlecht: -
|
Verfasst Fr 18.03.2005 16:51
Titel Slide Gallerie |
|
|
Guten Tag...
Ich habe ein kleines Problem mit meiner Gallerie.
Die URL s zu den Bildern werden via XML geladen un d in einem Array (dURL) gespeichert. Nun mein Problem, beim ersten laden (automatisch) kann ich nicht auf das Array dURL zugreifen, sondern ich muss die Bild URL als String angeben.
Code: | //*******************************************
// GENAU DAS MEINE ICH, ES MUESSTE HEISSEN *
// loadCont(dURL[0],cont_mc,loader_mc); *
// GEHT ABER NICHT *
//*******************************************
loadCont("bilder/01.jpg", cont_mc, loader_mc); |
wie bekomme ich es nun hin das ich auf das Array zugreifen kann.
Wenn die Methode loadCont in einem Event Handler liegt geht es, aber es soll ja das erste Foto automatisch geladen werden.
Ich hoffe ihr habt mich verstanden.
download
Hier der gesamte Code
Code: | stop();
System.useCodepage = true;
MovieClip.prototype.loadCont = function(pURL, pCont, pLoader) {
_global.end = false;
pCont._alpha = 0;
pCont.loadMovie(pURL);
pLoader._visible = true;
rahmen_mc._visible = true;
this.onEnterFrame = function() {
var geladen = pCont.getBytesLoaded();
var gesamt = pCont.getBytesTotal();
var prozent = geladen/gesamt*100;
//trace(prozent);
pLoader._width = prozent;
if (prozent == 100) {
var breite = pCont._width;
var hohe = pCont._height+head_mc._height;
pLoader._visible = false;
//pCont._visible = true;
rahmen_mc._visible = false;
//setLayout();
body_mc.slideScale(breite, hohe, pCont, 4, 10);
delete this.onEnterFrame;
}
};
};
/*
slideScale
*/
MovieClip.prototype.slideScale = function(pW, pH, pCont, pSteps, pSpeedAlpha) {
_global.end = false;
this.onEnterFrame = function() {
var diffX = pW-this._width;
var diffY = pH-this._height;
this._width += diffX/pSteps;
this._height += diffY/pSteps;
setLayout();
if (Math.round(this._height) == pH && Math.round(this._width) == pW) {
this._width = pW;
this._height = pH;
setLayout();
pCont._alpha += pSpeedAlpha;
if (pCont._alpha>=100) {
pCont._alpha = 100;
_global.end = true;
delete this.onEnterFrame;
}
}
};
};
/*
setLayout
*/
MovieClip.prototype.setLayout = function() {
// body_mc
//this.body_mc._width = this.cont_mc._width;
//this.body_mc._height = this.cont_mc._height+this.head_mc._height;
// cont_mc
cont_mc._x = body_mc._x-body_mc._width/2;
cont_mc._y = body_mc._y-body_mc._height/2+this.head_mc._height;
// head_mc
head_mc._width = body_mc._width;
head_mc._y = body_mc._y-body_mc._height/2+head_mc._height/2;
// rahmen_mc
rahmen_mc._x = body_mc._x-rahmen_mc._width/2;
rahmen_mc._y = body_mc._y;
rahmen_mc._visible = false;
// loader_mc
loader_mc._x = body_mc._x-rahmen_mc._width/2;
loader_mc._y = body_mc._y;
loader_mc._width = 0;
loader_mc._visible = false;
// Buttons
next_btn._x = head_mc._x+head_mc._width/2-next_btn._width-10;
next_btn._y = head_mc._y-head_mc._height/2+next_btn._height-8.5;
prev_btn._x = head_mc._x+head_mc._width/2-prev_btn._width*2-20;
prev_btn._y = head_mc._y-head_mc._height/2+prev_btn._height-8.5;
};
//
//
//
/*
Arrays
*/
var dURL = new Array();
var dText = new Array();
var daten = new XML();
/*
Variablen
*/
var counter = 0;
_global.end = true;
_global.starter;
/*
XML auslesen
*/
daten.ignoreWhite = true;
daten.load("list.xml");
daten.onLoad = function(ok) {
if (ok) {
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
dURL.push(this.firstChild.childNodes[i].attributes.url);
dText.push(this.firstChild.childNodes[i].attributes.text);
}
}
};
body_mc._width = 300;
body_mc._height = 400;
//
setLayout();
//*******************************************
// GENAU DAS MEINE ICH, ES MUESSTE HEISSEN *
// loadCont(dURL[0],cont_mc,loader_mc); *
// GEHT ABER NICHT *
//*******************************************
loadCont("bilder/01.jpg", cont_mc, loader_mc);
//
//
//
this.next_btn.onRelease = function() {
if (counter<dURL.length-1 && _global.end == true) {
counter++;
trace(dURL[counter]);
loadCont(dURL[counter], cont_mc, loader_mc);
}
};
this.prev_btn.onRelease = function() {
if (counter>0 && _global.end == true) {
counter--;
loadCont(dURL[counter], cont_mc, loader_mc);
}
};
|
Ciao Public
|
|
|
|
|
tuxedo
Dabei seit: 10.10.2002
Ort: ~/
Alter: 51
Geschlecht: -
|
Verfasst Fr 18.03.2005 18:29
Titel
|
|
|
a) lass flash ein wenig zeit mit dem parsen des xmls. sprich: als erstes legst du dein xml-object an
und lädst den kram. entweder via timeline oder interval (oder wie auch immer) sprichst du dann später
die funktionen an. zwei frames wirken oft wunder...
am rande:
b) wieso prototypen? dir ist schon klar, das du damit ne menge ballast verursachst...?
c) ein weiterer tip: schreib sauberen code. halte dich an vernünftige abläufe....initialisiere die arrays
vor der bekanntmachung der funktionen. guter stil wäre:
globale variablen definieren
arrays initialisieren
funktionen schreiben
initfunktionsaufruf oder anderer funktionsaufruf...
|
|
|
|
|
Anzeige
|
|
|
Waschbequen
Account gelöscht
Ort: -
|
Verfasst Fr 18.03.2005 18:41
Titel
|
|
|
btw.: galerie, nicht gallerie.
|
|
|
|
|
public
Threadersteller
Dabei seit: 29.11.2004
Ort: Dessau
Alter: 43
Geschlecht: -
|
Verfasst Fr 18.03.2005 19:25
Titel
|
|
|
Habs hinbekommen.
Und ich schreibe jetzt "Galerie".
Cioa Public
|
|
|
|
|
Account gelöscht
Ort: -
Alter: -
|
Verfasst Sa 19.03.2005 10:04
Titel
|
|
|
oder gallery.
|
|
|
|
|
public
Threadersteller
Dabei seit: 29.11.2004
Ort: Dessau
Alter: 43
Geschlecht: -
|
Verfasst Sa 19.03.2005 15:28
Titel
|
|
|
So und nun zum angucken.
klick
Ciao Public
|
|
|
|
|
roblade
Dabei seit: 27.06.2002
Ort: Düsseldorf/Berlin
Alter: -
Geschlecht:
|
Verfasst Sa 19.03.2005 17:54
Titel
|
|
|
ist nett geworden.nur eins ist mir aufgefallen.wenn man alle durchklickt und wieder auf dem ersten ankommt, kann man nicht aufs letzte zurück - ist das so gewollt,denke mal schon,oder?!
edit:könntest du die datei nochmal kurz hochschieben, hab auch mal geschaut und würde gerne was versuchen...
ps:oder schicks per mail...
Zuletzt bearbeitet von roblade am Sa 19.03.2005 18:02, insgesamt 1-mal bearbeitet
|
|
|
|
|
public
Threadersteller
Dabei seit: 29.11.2004
Ort: Dessau
Alter: 43
Geschlecht: -
|
Verfasst Sa 19.03.2005 18:06
Titel
|
|
|
Ja ist so gewollt.
Ciao Public
|
|
|
|
|
|
|
|
Ähnliche Themen |
Flash-Gallerie
Gallerie mit Fireworks 8
Gallerie mit GoLive
simple gallerie
[Tutorial] Gallerie mit Actionscript
NEUE HP, Gallerie mit Mouseover etc.
|
|