开发者

making photo gallery in flash with actionscript 3 without xml?

how do I make a photo gallery using actionscript 3 without XML where there is a row of thumbnails and when you click the thumbna开发者_如何转开发il, it fills the screen with the photo? Most of the tutorials I've seen use xml and I was wondering if you have to use it? Thanks in advance


There is plenty of tutorials explaining how to create photo galleries, they all use xml for a reason. If you hard code your images inside your swf file, every time you change/replace an image you would need to re-compile your flash movie, this process may became very messy and problematic overtime! Instead of using xml, you could use a database to store the gallery information.

Anyway if you dont want to use an sql database or xml, all you have to do is store the path for your images in an array. Example:

var loader:Array = new Array();
var myImg:Array = ["image1.jpg", "image2.jpg", "image3.jpg"];

//populate playing list -------------------------------
for (var i:uint=0; i < myImg.length; i++)
{
   loader[i] = new Loader();
   loader[i].load ("imgs/gallery/" + myImg[i]);
   addChild (myImg[i]);
}
  • keeping your images in an external folder "imgs/gallery/"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜