1.Create one XML file for loading the images & title in the xml
Eg
<gallery>
<image ptext=”Title1.1” main=”test.jpg” />
<image ptext=”Title1.2” main=”test1.jpg” />
<image ptext=”Title1.3” main=”test2.jpg” />
end </gallery>
save the name in xmlphoto.xml
2.Create the new flash file save the file as photogallery.
3.In flash file create the movie clip & give the instancename as loader_mc
4.Create the dynamic text field and give the instance name caption
5.create the new layer & named it actions paste the code
//create the xml object
myphoto – new XML();
myphoto.ignoreWhitespace = true;
myphoto.load(“xmlphoto.xml”);
//create array for photos,text to store separately
toa = new Array();
photo = new Array();
Ptext = new Array();
var nx:Number;
myphoto.onLoad = function(success)
{
toa = myphoto.firstChild.childNodes;
// trace(toa);
loader_mc._alpha=0
trace(loader_mc._alpha);
for(i=0;i
{
photo.push(toa[i].attributes.main);
//trace(photo);
ptext.push(toa[i].attributes.ptexts);
//trace(ptext);
}
fadeef();
loader_mc.loadMovie(photo[0]);
caption.text =ptext[0];
nx=0;
//nextImage();
//trace(“Loaded Success….”);
}
function fadeef()
{
this.onEnterFrame=function(){
if(loader_mc._alpha<=100){
//increase the opacity on each frame
loader_mc._alpha+=6;
trace(loader_mc._alpha);
}else{
//once the opacity reaches 100, delete the on enter frame function
delete loader_mc.onEnterFrame;
//loader_mc._alpha+=4;
}
}
}
//setProperty(loader_mc,_alpha,0);
next_btn.onPress= function()
{
loader_mc._alpha=0
//trace(“nextImage loaded”);
if(nx
0)
{
nx–;
fadeef()
loader_mc.loadMovie(photo[nx]);
caption.text =ptext[nx];
next_btn._visible=true;
}
else
{
prev_btn._visible= false;
}
}