New deals posted everyday, starting Black Friday and running through the holiday season! No hassles, no lines - just awesome savings on art, deviantWEAR, Premium Memberships and more!
|
|
|
|
|
|
|
|
myXml = xmlfile.firstChild;
for(i=0; i<myXml.numChildren; i++){
loadImage(myXml.children[i].url);
}
private function ProcessXML(e:Event) {
//process xml
searchResult = new XML(e.target.data);
var totalNodes:Number = searchResult.item.length();
//clear arrays
ClearArray(aImgID);
ClearArray(aFileName);
ClearArray(aIndex);
//fetch arrays
for (var j:Number = 0; j<totalNodes; j++) {
aFileName[j] = searchResult.item[j].attribute("fileName");
aImgID[j] = searchResult.item[j].attribute("imgID");
}
//create thumbnails
CreateThumbnails(totalNodes, 12);
}
public function CreateThumbnails(thumbnails:uint, columns:uint) {
fullView = new Fullview();
addChild(fullView);
//remove thumbnails
DeleteThumbnails();
//
var aThumb:Array = new Array(thumbnails);
var nStartColumn:Number = 0;
var nColumn:Number = nStartColumn;
var nRow:Number = 0;
var nCount:Number = 0;
var nIncrease:Number = 60;
for (var j:Number = 0; j<aThumb.length; j++) {
var fileName:String = aFileName[j];
var imgID:Number = aImgID[j];
var sThumbPath:String = server + "/images/thumbs/" + aFileName[j];
aThumb[j] = new Thumbnail();
aThumb[j].x = nColumn;
aThumb[j].y = nRow;
aThumb[j].addEventListener(MouseEvent.CLICK, ClickListener);
aThumb[j].LoadImage(sThumbPath);
thumbContainer.addChild(aThumb[j]);
aIndex[j] = thumbContainer.getChildIndex(aThumb[j]);
aThumb[j].SetIndex(aIndex[j]);
if (nCount == columns-1) {
nColumn = nStartColumn;
nCount = 0;
nRow += nIncrease;
} else {
nCount++;
nColumn += nIncrease;
}
}
}
public function DeleteThumbnails() {
while (thumbContainer.numChildren > 0) {
thumbContainer.removeChildAt(0);
}
}
i'm a bit lost seeing as i have little experience with xml to flash. creating the xml file and all is easy, but getting flash to grab the images from the xml is taunting me lol.
i trying to get it to load images in this layout:
[0] [1] [2] [3] [4] [5]
[6] [7] [8] [9] [10][11]
[12][13][14][15][16][17]
AND this all needs to be done in AS2...
i've looked at various tutorials, though if you have any suggestion or even the source code lol...
that help heaps