Ok hello everyone.
Rhamej thank you for the so solid xml gallery code.
Scotty stringy you are Gurus with that versions of the kirupa xml gallery.
I have a problem on this.
I tried to combine rhamej gallery with the script from the thumbnail bonus xml from stringy.
So far i managed only to get the bonus 1 2 to get displayed. when i move to the next image the bonus doesnt show at all and when i move to the first image the bonus are gone.
What am i doing wrong???
Please Help. I tried different things but nothing worked so far.
It must something on the bonusarray* because it only reads the bonus for the first image and not following the array?
Here is my code:
scroller.InstanceName_1._alpha += 100;
stop();
//set the initial postitions/properties of every thing.
mtClip._alpha = 0;
// define the vars
var frwrd:Boolean = true;
var pictures:Array = new Array();
var thumbs:Array = new Array();
var p:Number = -1;
var z:Number;
var clickCount:Number = 0;
var howMclick:Number;
var slideCount:Number = -1;
var images:Array = new Array();
var numOfBtns:Array = new Array();
var xml:XML = new XML();
var fadeOut:Boolean;
var setIt:Boolean = false;
var playFast:Boolean;
var nextImage;
var mainColor;
var nextLink;
bonusarray=[]
// set the colors
//Load the XML and set all the arrays, blah blah blah....
xml.ignoreWhite = true;
xml.onLoad = function(ok) {
if (ok) {
allData = this.firstChild.childNodes;
for (var i = 0; i<allData.length; i++) {
bonusarray*=[]
for(var obj in allData*.attributes){
bonusarray*.push(allData*.attributes[obj])
}
trace(this.firstChild.childNodes*.attributes.bonus1)
var newBut:MovieClip = scroller.container.attachMovie("thumbMC", "thumb"+i, i);
total = xmlNode.childNodes.length;
newBut.descript = allData*.firstChild.firstChild;
newBut.image = allData*.firstChild.nextSibling.nextSibling.firstChild;
thumbs.push(allData*.firstChild.nextSibling.firstChild);
pictures.push(allData*.firstChild.nextSibling.nextSibling.firstChild);
numOfBtns* = "but"+i;
newBut.slideCounter = i;
newBut.num.numtext = newBut.descript;
newBut._visible = false;
newBut.endY = i*(31);
newBut.endX = 0;
newBut._x = 0;
howMclick = Math.floor(scroller.container._height/100);
newBut.onRelease = function() {
checkThumbs();
if (showSlide == false) {
slideCount = this.slideCounter;
}
infoBox.infoText.text = this.descript;
nextImage = this.image;
fadeOut = true;
fadeMain();
getButtons();
this.enabled = false;
if ((this.slideCounter+1)>=10){
counterText_mc.loadingText.text = "0" + (this.slideCounter+1);
}else{
counterText_mc.loadingText.text = "00" + (this.slideCounter+1);
}
counterText_mc.totalText.text = "/0" + pictures.length;
};
newBut.onRollOver = function() {
this.num.fadeIn = true;
this.thumbClip.fadeIn = true;
this.thumbClip.fade();
this.num.fade();
};
newBut.onRollOut = function() {
this.num.fadeIn = false;
this.thumbClip.fadeIn = false;
this.thumbClip.fade();
this.num.fade();
};
}
// when all done with above caca, load the first thumb
nextPic();
}
};
mask._visible =true;
function getButtons(){
barray = [];
mask._width = 100;
mask._visible = true;
var clip =this.createEmptyMovieClip("paper",10000)
clip._y = 222
clip._x=20
for(var i=0;i<bonusarray[p].length;i++){
var clap =clip.attachMovie("btn","btn"+i,i)
clap._alpha = 100;
clap._x =(clap._width+2)*i
clap.ivar =i
barray.push(clap);
clap.p = p;
clap.myText.text ="0"+(i)
clap.onPress =dopress
clap.onRelease = clap.onReleaseOutside =dorelease
}
barray[0].enabled = false
mask.onEnterFrame =grow
}
function grow(){
this._width+=(paper._width-this._width)/5
if(Math.abs(paper._width-this._width)<2){
this._width = paper._width
delete this.onEnterFrame
}
}
function dorelease(){
for (var obj in barray) {
barray[obj].enabled = true;
bckmc.bck.bckbtn.enabled= false;
barray[obj].colorTo(0x686563,0.5,"easeOutCubic");
}
this.enabled = false;
this.colorTo(0xADAAA7,0.5,"easeOutCubic");
fcuk = this.ivar;
fcup = this.p;
fadeOut = true;
fadeMain2();
loadMainImage2();
}
barray[0].enabled = true
function getDesc(){
infoBox.infoText.alphaTo(100,0.5,"easeOutBack");
}
// slide the info box down
////load each thumb incrementaliy
// Step one, check to see if p is less than pictures array
function nextPic() {
p++;
if (p<pictures.length) {
moveThumbs();
} else {
counterText_mc.loadingText.text = "001";
counterText_mc.totalText.text = "/0" + pictures.length;
}
}
next_btn.onRelease = function() {
moveThumbs();
};
// Step two, call the function to show the thumb
function moveThumbs() {
var but:MovieClip = scroller.container["thumb"+p];
but.showThumbs();
}
// Step three, show the thumb by sliding it up or blinking it in. After its showing, preload the image
MovieClip.prototype.showThumbs = function() {
if (nav == "buttons") {
if (navani == "slide") {
this._y = 120;
this._x = this.endX;
this._visible = true;
this.tween("_y", this.endY, thumbUpTweenSpeed, upEaseType, 0, loadThumbs);
}
if (navani == "blink") {
this._visible = true;
this._x = this.endX;
loadThumbs();
}
} else if (nav == "nobuttons") {
if (navani == "slide") {
this._visible = true;
this._y = 0;
this._x = this.endX;
scroller.container.tween("_x", Stage.width/2-scroller.container._width/2, .5, "easeOutQuad");
this.tween("_y", this.endY, thumbUpTweenSpeed, upEaseType, 0, loadThumbs);
if (this._x>Stage.width-this._width) {
setIt = true;
}
}
if (navani == "blink") {
this._visible = true;
this._x = 0;
this._y = this.endY;
//scroller.container.tween("_x", Stage.width/2-scroller.container._width/2, .5, "easeOutQuad");
loadThumbs();
}
}
};
// load the thumb image
function loadThumbs() {
var but:MovieClip = scroller.container["thumb"+p];
but.thumbClip.loadMovie("landscapes/thumbs/"+thumbs[p]);
var temp:MovieClip = _root.createEmptyMovieClip("temp"+p, p);
if ((p+1)>=10){
counterText_mc.loadingText.text = "0"+(p+1);
}else{
counterText_mc.loadingText.text = "00"+(p+1);
}
counterText_mc.totalText.text = "/0" + pictures.length;
temp.onEnterFrame = function() {
BL = but.thumbClip.getBytesLoaded();
BT = but.thumbClip.getBytesTotal();
percent = Math.round(BL/BT*100);
but.bar.gotoAndStop(percent);
if (BL == BT && but.thumbClip._width>1 && but.thumbClip._height>1) {
but.bar.gotoAndStop(1);
but.thumbClip._width = 30;
but.thumbClip._height = 30;
if (firstLoad == 1) {
but.onRelease();
but.fadeIn = true;
but.thumbClip._alpha = 100;
firstLoad = false;
} else {
but.fadeIn = false;
but.thumbClip.fade();
but.num.fade();
}
nextPic();
delete temp.onEnterFrame;
}
};
}
//re-enable the disabled thumb button when another is clicked
function checkThumbs() {
for (var j = 0; j<=numOfBtns.length; j++) {
var theThumb:MovieClip = scroller.container["thumb"+j];
if (theThumb.enabled == false) {
theThumb.enabled = true;
theThumb.thumbClip.fadeIn = false;
theThumb.num.fadeIn = false;
theThumb.thumbClip.fade();
theThumb.num.fade();
}
}
}
// fade IN/OUT the thumb image on rollOver rollOut
MovieClip.prototype.fade = function() {
if (this.fadeIn == true) {
this.alphaTo(100,0.5,"linear");
} else {
this.alphaTo(30,0.3,"linear");
}
};
/*loadMain image. Even though it already preloaded in the thumb,
we want to make sure its there before we reveal it, plus we need to make sure all the other crap happens*/
function loadMainImage() {
mtClip.loadMovie("landscapes/images/"+nextImage);
var temp:MovieClip = _root.createEmptyMovieClip("temp", 99999);
preloader_mc._visible = true;
temp.onEnterFrame = function() {
IL = mtClip.getBytesLoaded();
IT = mtClip.getBytesTotal();
percentage = Math.round(IL/IT*100);
preloader_mc.gotoAndPlay(percentage);
if (mtClip._width>5 && mtClip._height>5 && IL == IT) {
if (showSlide == true) {
timer_mc.gotoAndPlay(2);
}
preloader_mc._visible = false;
preloader_mc.gotoAndStop(1);
fadeOut = false;
fadeMain();
delete temp.onEnterFrame;
}
};
}
function loadMainImage2() {
mtClip.loadMovie("landscapes/images/"+bonusarray[fcup][fcuk]);
var temp:MovieClip = _root.createEmptyMovieClip("temp", 99999);
preloader_mc._visible = true;
temp.onEnterFrame = function() {
IL = mtClip.getBytesLoaded();
IT = mtClip.getBytesTotal();
percentage = Math.round(IL/IT*100);
preloader_mc.gotoAndPlay(percentage);
if (mtClip._width>5 && mtClip._height>5 && IL == IT) {
if (showSlide == true) {
timer_mc.gotoAndPlay(2);
}
preloader_mc._visible = false;
preloader_mc.gotoAndStop(1);
fadeOut = false;
fadeMain2();
delete temp.onEnterFrame;
}
};
}
// fade IN/OUT the main image
function fadeMain() {
if (this.fadeOut == true) {
mtClip.tween("_alpha", 0, fadeOutMainSpeed, "easeOutQuad", 0, loadMainImage);
} else {
mtClip.tween("_alpha", 100, fadeInMainSpeed, "easeOutQuad");
}
}
function fadeMain2() {
if (this.fadeOut == true) {
mtClip.tween("_alpha", 0, fadeOutMainSpeed, "easeOutQuad", 0, loadMainImage2);
} else {
mtClip.tween("_alpha", 100, fadeInMainSpeed, "easeOutQuad");
}
}
//slide the thumbs left or right if set to "buttons"
// slide show function
//button actions
// fire it all off! BAM!
xml.load("landscapes/landscapes.xml");
And here is a part of the xml code:
<?xml version="1.0" encoding="iso-8859-1"?>
<gallery>
<image b="McAir3.jpg" b1="McAir2.jpg">
<description>AIR</description>
<thumb>McAir_sm.jpg</thumb>
<pic>McAir.jpg</pic>
</image>
</gallery
Does anyone can help?