Hi all,
i have an xml picture gallery with a thumbnails row etc.
This is the code in the first frame of the timeline:
System.useCodePage = true;
imageURL = new Array();
thumbURL = new Array();
des = new Array();
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (temp)
{
_global.numOfPhoto = this.childNodes.length;
for (i = 1; i <= numOfPhoto; i++)
{
imageURL* = this.childNodes[i - 1].childNodes[0].childNodes[0];
thumbURL* = this.childNodes[i - 1].childNodes[1].childNodes[0];
des* = this.childNodes[i - 1].childNodes[2].childNodes[0];
} // end of for
gotoAndStop(2);
};
stop ();
myXML.load("gallery.xml")
and in the second frame:
centerX = 400;
centerY = 275;
gapOfBtn =105;
gap = 6;
btnEnd = gap;
Stage.scaleMode = "noScale";
speed = 20;
_global.current = 1;
work.screen.loadMovie(imageURL[1]);
title.text = des[1];
work.onEnterFrame = function ()
{
this.temp1 = this.screen.getBytesLoaded();
this.temp2 = this.screen.getBytesTotal();
if (this.temp1 == this.temp2 && this.temp1 > 200)
{
work.screen._x = centerX - work.screen._width / 2;
work.screen._y = centerY - work.screen._height / 2;
work.screen._visible = 0;
myColor = new Color(work.screen);
myColorTransform = new Object();
work.screen.ra = 100;
work.screen.ga = 100;
work.screen.ba = 100;
work.screen.aa = 100;
work.screen.rb = 255;
work.screen.gb = 255;
work.screen.bb = 255;
work.screen.ab = 0;
work.screen.onEnterFrame = function ()
{
myColorTransform = {ra: this.ra, rb: this.rb, ga: this.ga, gb: this.gb, ba: this.ba, bb: this.bb, aa: this.aa, ab: this.ab};
myColor.setTransform(myColorTransform);
this.ra = this.ra + (100 - this.ra) / speed;
this.ga = this.ga + (100 - this.ga) / speed;
this.ba = this.ba + (100 - this.ba) / speed;
this.aa = this.aa + (100 - this.aa) / speed;
this.rb = this.rb + -this.rb / speed;
this.gb = this.gb + -this.gb / speed;
this.bb = this.bb + -this.bb / speed;
this.ab = this.ab + -this.ab / speed;
work.screen._visible = 1;
};
delete this.onEnterFrame;
} // end if
};
for (i = 1; i <= numOfPhoto; i++)
{
btnSet.attachMovie("btn", i, i + 10);
btnSet*._x = gapOfBtn * (i - 1) + 10;
btnSet*._y = 0;
btnSet*.ae.loadMovie(thumbURL*);
btnSet*.onRollOver = function ()
{
this.gotoAndPlay(2);
};
btnSet*.onRollOut = function ()
{
if (this._name != current)
{
this.gotoAndPlay(7);
} // end if
};
btnSet*.onRelease = function ()
{
if (current != this._name)
{
this._parent[current].gotoAndPlay(7);
} // end if
title.text = des[current];
_global.current = Number(this._name);
title.text = des[current];
work.screen.loadMovie(imageURL[this._name]);
work.onEnterFrame = function ()
{
this.temp1 = this.screen.getBytesLoaded();
this.temp2 = this.screen.getBytesTotal();
if (this.temp1 == this.temp2 && this.temp1 > 200)
{
work.screen._x = centerX - work.screen._width / 2;
work.screen._y = centerY - work.screen._height / 2;
work.screen._visible = 0;
myColor = new Color(work.screen);
myColorTransform = new Object();
work.screen.ra = 100;
work.screen.ga = 100;
work.screen.ba = 100;
work.screen.aa = 100;
work.screen.rb = 255;
work.screen.gb = 255;
work.screen.bb = 255;
work.screen.ab = 0;
work.screen.onEnterFrame = function ()
{
myColorTransform = {ra: this.ra, rb: this.rb, ga: this.ga, gb: this.gb, ba: this.ba, bb: this.bb, aa: this.aa, ab: this.ab};
myColor.setTransform(myColorTransform);
this.ra = this.ra + (100 - this.ra) / speed;
this.ga = this.ga + (100 - this.ga) / speed;
this.ba = this.ba + (100 - this.ba) / speed;
this.aa = this.aa + (100 - this.aa) / speed;
this.rb = this.rb + -this.rb / speed;
this.gb = this.gb + -this.gb / speed;
this.bb = this.bb + -this.bb / speed;
this.ab = this.ab + -this.ab / speed;
work.screen._visible = 1;
};
delete this.onEnterFrame;
} // end if
};
};
} // end of for
prev.enabled = 0;
if (numOfPhoto <= gap)
{
prev.enabled = next.enabled = 0;
} // end if
prev.onRelease = function ()
{
next.enabled = 1;
if (btnEnd - gap > gap)
{
btnSet.targetX = btnSet.targetX + gap * gapOfBtn;
btnEnd = btnEnd - gap;
}
else
{
btnSet.targetX = 0;
btnEnd = gap;
this.gotoAndPlay(11);
this.enabled = 0;
} // end else if
};
prev.onRollOver = function ()
{
this.gotoAndPlay(2);
};
prev.onRollOut = function ()
{
this.gotoAndPlay(11);
};
next.onRelease = function ()
{
prev.enabled = 1;
if (btnEnd + gap < numOfPhoto)
{
btnSet.targetX = btnSet.targetX - gap * gapOfBtn;
btnEnd = btnEnd + gap;
}
else
{
btnSet.targetX = btnSet.targetX - (numOfPhoto - btnEnd) * gapOfBtn;
btnEnd = numOfPhoto;
this.gotoAndPlay(11);
this.enabled = 0;
} // end else if
};
next.onRollOver = function ()
{
this.gotoAndPlay(2);
};
next.onRollOut = function ()
{
this.gotoAndPlay(11);
};
btnSet.defaultX = btnSet._x;
btnSet.targetX = 0;
btnSet[1].gotoAndPlay(2);
btnSet.onEnterFrame = function ()
{
this._x = this._x + (this.targetX + this.defaultX - this._x) / 5;
}
Everything works perfectly but as it is now there’s no preloader bar when it loads the big images. I would like to add one but i don’t know how.
Can anybody help me? please…
thanks.