ActionScript 2 XML Photo Gallery

How to make a custom scrollbar for thumbnails?

Page 1 of 1

2 Replies - 7847 Views - Last Post: 16 June 2009 - 11:42 PM

#1 LonelyStar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-June 09

ActionScript 2 XML Photo Gallery

Posted 02 June 2009 - 06:48 AM

Hello! I've made a photo gallery that loads photos via XML and it's working, and i want to make a scrollbar for the thumbnails so all the thumbnails can be seen, and i want to do something like this: http://www.cursurifotografie.ro :blink:
Here is te AS2 code:

loader.onEnterFrame = function(){
this.loadMovie("big/1.jpg");
}

myPhoto =new XML();
myPhoto.ignoreWhite = true;
myPhoto.onload = function(){
nrImages =this.firstChild.childNodes.length;
space =64;
for(i=0; i<nrImages; i++){
this.picholder=this.firstChild.childNodes[i];
this.thumbholder=thumbnails.createEmptyMovieClip("thumbnail"+i,i);
this.thumbholder._y =i*space;
this.thumbloader = this.thumbholder.createEmptyMovieClip("thumbnailimage", 0);
this.thumbloader.loadMovie(this.picholder.attributes.imgSmall);
this.thumbholder.title =this.picholder.attributes.imgtitle;
this.thumbholder.imgBig=this.picholder.attributes.imgBig;
this.thumbholder.onRelease = function(){
loader.loadMovie(this.imgBig);
title_txt.text=this.title;
}
}
}
myPhoto.load("gallery.xml");




If somebody can help me with a tutorial or something that teach how to make a custom scrollbar with actionscript 2 i would be very grateful :rolleyes:

Is This A Good Question/Topic? 0
  • +

Replies To: ActionScript 2 XML Photo Gallery

#2 bmcc81  Icon User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 312
  • Joined: 10-July 07

Re: ActionScript 2 XML Photo Gallery

Posted 02 June 2009 - 08:34 AM

Try modifying this to sute your code.



var objPokerXml = new XML();
var arPokerDates = new Array();

objPokerXml.ignoreWhite = true;
objPokerXml.onload = function(success) {
	if (success) {

		var iTotalTournaments = objPokerXml.childNodes[0].childNodes.length;

		for (i=0; i<iTotalTournaments; i++) {
			var arTempArray = new Array();

			iTempID = objPokerXml.childNodes[0].childNodes[i].attributes.id;
			sTempName = objPokerXml.childNodes[0].childNodes[i].childNodes[0].firstChild.nodeValue;
			sTempGameType = objPokerXml.childNodes[0].childNodes[i].childNodes[1].firstChild.nodeValue;
			sTempReBuys = objPokerXml.childNodes[0].childNodes[i].childNodes[2].firstChild.nodeValue;
			sTempAddOns = objPokerXml.childNodes[0].childNodes[i].childNodes[3].firstChild.nodeValue;
			sTempBuyIn = objPokerXml.childNodes[0].childNodes[i].childNodes[4].firstChild.nodeValue;
			sTempFee = objPokerXml.childNodes[0].childNodes[i].childNodes[5].firstChild.nodeValue;
			sTempPrizePool = objPokerXml.childNodes[0].childNodes[i].childNodes[6].firstChild.nodeValue;
			iTempMinPlayers = objPokerXml.childNodes[0].childNodes[i].childNodes[7].firstChild.nodeValue;
			iTempMaxPlayers = objPokerXml.childNodes[0].childNodes[i].childNodes[8].firstChild.nodeValue;
			sTempStatus = objPokerXml.childNodes[0].childNodes[i].childNodes[9].firstChild.nodeValue;
			sTempRegoTime = objPokerXml.childNodes[0].childNodes[i].childNodes[10].firstChild.nodeValue;
			sTempRegoDate = objPokerXml.childNodes[0].childNodes[i].childNodes[11].firstChild.nodeValue;
			sTempStartTime = objPokerXml.childNodes[0].childNodes[i].childNodes[12].firstChild.nodeValue;
			sTempStartDate = objPokerXml.childNodes[0].childNodes[i].childNodes[13].firstChild.nodeValue;

			arTempArray.push(iTempID);//0 
			arTempArray.push(sTempName);//1 
			arTempArray.push(sTempGameType);//2 
			arTempArray.push(sTempReBuys);//3 
			arTempArray.push(sTempAddOns);//4 
			arTempArray.push(sTempBuyIn);//5 
			arTempArray.push(sTempFee);//6 
			arTempArray.push(sTempPrizePool);//7 
			arTempArray.push(iTempMinPlayers);//8 
			arTempArray.push(iTempMaxPlayers);//9 
			arTempArray.push(sTempStatus);//10 
			arTempArray.push(sTempRegoTime);//11 
			arTempArray.push(sTempRegoDate);//12 
			arTempArray.push(sTempStartTime);//13 
			arTempArray.push(sTempStartDate);//14 
			arPokerDates.push(arTempArray);
		}
		fnCreateText();
		tourny_txt.wordWrap = true;
	} else {
		myTextFormat = new TextFormat();
		myTextFormat.size = 10;
		tourny_txt.setTextFormat(myTextFormat);
		trace("XML FEED DOWN");
		tourny_txt.text = "XML_DOWN";
		_root.xml_down._visible=true;
		
	}
};

function fnCreateText() {
	// trace('arr: '+ arPokerDates); 
	
	this.createTextField('tourny_txt',0,5,0,210,270);
	
	var myTextFormat:TextFormat = new TextFormat();
	
	myTextFormat.size = 10;
	myTextFormat.font = "Arial"
	myTextFormat.color = 0xFFFFFF;
	myTextFormat.leading = 2;

	
	

	
	for (i=0; i<arPokerDates.length; i++) {
		_root.scrollingText_mc.tourny_txt.text = tourny_txt.text+arPokerDates[i][13]+' - '+arPokerDates[i][1]+newline;
		this.tourny_txt.setTextFormat(myTextFormat);
	}
}


Was This Post Helpful? 0
  • +
  • -

#3 forbiddensmile  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-June 09

Re: ActionScript 2 XML Photo Gallery

Posted 16 June 2009 - 11:42 PM

Hello,

I am supposed to do a Flash Gallery to display photos without any basic knowledge on Flash.
Could anyone help me or guide me on where to start as I have no basics at all,
and the project is due in 2 weeks time and no help is given from the teachers at all.

I wish to know how to code AS 2.0 for button.
like..

on (click) something,
then the images in my .xml files will show in my loader.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1