dragonlau
%Europe/Berlin %069 %2008, 01:39
Ik maak gebruik van XML om een gallery slideshow weer te geven.
Dit werkt allemaal perfect. Maar in plaats van 1 slideshow op de homepage, wil ik 4 slideshows tegelijkertijd weergeven.
Kan ik door middel van 1 XML 4 slideshows tonen (geheel onafhankelijk van elkaar laten roteren)?
En hoe kan ik onderstaande code compacter maken, nu geef ik voor alle term een nummer mee.. dus ik heb nu 4x het dubbele staan, waarvan maar 1 term verschilt en dat is het nummer erachter.
/////////////////// Gallery 1 ///////////////////
var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load("gallery1.xml");
myShowXML.onLoad = function() {
_root.myWidth = myShowXML.firstChild.attributes.width;
_root.myHeight = myShowXML.firstChild.attributes.height;
_root.mySpeed = myShowXML.firstChild.attributes.speed;
_root.myImages = myShowXML.firstChild.childNodes;
_root.myImagesNo = myImages.length;
createContainer();
callImages();
};
function createContainer() {
_root.createEmptyMovieClip("myContainer_mc",_root.getNextHighestDepth());
myContainer_mc.lineStyle(3,0x000000,100);
myContainer_mc.lineTo(_root.myWidth,0);
myContainer_mc.lineTo(_root.myWidth,_root.myHeight );
myContainer_mc.lineTo(0,_root.myHeight);
myContainer_mc.lineTo(0,0);
myContainer_mc._x = 37;
myContainer_mc._y = 265;
}
/////////////////// Gallery 2 ///////////////////
var myShowXML2 = new XML();
myShowXML2.ignoreWhite = true;
myShowXML2.load("gallery2.xml");
myShowXML2.onLoad = function() {
_root.myWidth2 = myShowXML2.firstChild.attributes.width;
_root.myHeight2 = myShowXML2.firstChild.attributes.height;
_root.mySpeed2 = myShowXML2.firstChild.attributes.speed;
_root.myImages2 = myShowXML2.firstChild.childNodes;
_root.myImagesNo2 = myImages2.length;
createContainer2();
callImages2();
};
function createContainer2() {
_root.createEmptyMovieClip("myContainer_mc2",_root.getNextHighestDepth());
myContainer_mc2.lineStyle(3,0x000000,100);
myContainer_mc2.lineTo(_root.myWidth2,0);
myContainer_mc2.lineTo(_root.myWidth2,_root.myHeig ht2);
myContainer_mc2.lineTo(0,_root.myHeight2);
myContainer_mc2.lineTo(0,0);
myContainer_mc2._x = 865;
myContainer_mc2._y = 265;
}
// idem voor gallery3 en gallery4 met dezelfde code, maar dan met een andere nummering
kan iemand mij vertellen of dit compacter kan?
Dit werkt allemaal perfect. Maar in plaats van 1 slideshow op de homepage, wil ik 4 slideshows tegelijkertijd weergeven.
Kan ik door middel van 1 XML 4 slideshows tonen (geheel onafhankelijk van elkaar laten roteren)?
En hoe kan ik onderstaande code compacter maken, nu geef ik voor alle term een nummer mee.. dus ik heb nu 4x het dubbele staan, waarvan maar 1 term verschilt en dat is het nummer erachter.
/////////////////// Gallery 1 ///////////////////
var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load("gallery1.xml");
myShowXML.onLoad = function() {
_root.myWidth = myShowXML.firstChild.attributes.width;
_root.myHeight = myShowXML.firstChild.attributes.height;
_root.mySpeed = myShowXML.firstChild.attributes.speed;
_root.myImages = myShowXML.firstChild.childNodes;
_root.myImagesNo = myImages.length;
createContainer();
callImages();
};
function createContainer() {
_root.createEmptyMovieClip("myContainer_mc",_root.getNextHighestDepth());
myContainer_mc.lineStyle(3,0x000000,100);
myContainer_mc.lineTo(_root.myWidth,0);
myContainer_mc.lineTo(_root.myWidth,_root.myHeight );
myContainer_mc.lineTo(0,_root.myHeight);
myContainer_mc.lineTo(0,0);
myContainer_mc._x = 37;
myContainer_mc._y = 265;
}
/////////////////// Gallery 2 ///////////////////
var myShowXML2 = new XML();
myShowXML2.ignoreWhite = true;
myShowXML2.load("gallery2.xml");
myShowXML2.onLoad = function() {
_root.myWidth2 = myShowXML2.firstChild.attributes.width;
_root.myHeight2 = myShowXML2.firstChild.attributes.height;
_root.mySpeed2 = myShowXML2.firstChild.attributes.speed;
_root.myImages2 = myShowXML2.firstChild.childNodes;
_root.myImagesNo2 = myImages2.length;
createContainer2();
callImages2();
};
function createContainer2() {
_root.createEmptyMovieClip("myContainer_mc2",_root.getNextHighestDepth());
myContainer_mc2.lineStyle(3,0x000000,100);
myContainer_mc2.lineTo(_root.myWidth2,0);
myContainer_mc2.lineTo(_root.myWidth2,_root.myHeig ht2);
myContainer_mc2.lineTo(0,_root.myHeight2);
myContainer_mc2.lineTo(0,0);
myContainer_mc2._x = 865;
myContainer_mc2._y = 265;
}
// idem voor gallery3 en gallery4 met dezelfde code, maar dan met een andere nummering
kan iemand mij vertellen of dit compacter kan?