We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

XML scrolling gallery needs links on images.

rrattie
rrattie asked
on
Medium Priority
669 Views
Last Modified: 2013-11-11
I have a working "horizontal scrolling image gallery" that needs one more thing. I want to put links to full size images on the images that are in the gallery.

So, when you click on an image in the gallery, it would open in a separate window (html)

Here is my code so far.
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		thumbnails = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
			thumbnails_fn(i);
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
///////////////////////////////////// 
listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		prevImage();
	} else if (Key.getCode() == Key.RIGHT) {
		nextImage();
	}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
	prevImage();
};
next_btn.onRelease = function() {
	nextImage();
};
///////////////////////////////////// 
p = 0;
 
function thumbNailScroller() {
	// thumbnail code! 
	this.createEmptyMovieClip("tscroller", 1000);
	scroll_speed = 10;
	tscroller.onEnterFrame = function() {
		if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
			if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
				thumbnail_mc._x -= scroll_speed;
			} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
				thumbnail_mc._x += scroll_speed;
			}
		} else {
			delete tscroller.onEnterFrame;
		}
	};
}
function thumbnails_fn(k) {
	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
	tlistener = new Object();
	tlistener.onLoadInit = function(target_mc) {
		target_mc._x = hit_left._x+(target_mc._width+60)*k;
		target_mc.pictureValue = k;
		target_mc.onRelease = function() {
			p = this.pictureValue-1;
			nextImage();
		};
		target_mc.onRollOver = function() {
			this._alpha = 80;
			thumbNailScroller();
		};
		target_mc.onRollOut = function() {
			this._alpha = 100;
		};
	};
	image_mcl = new MovieClipLoader();
	image_mcl.addListener(tlistener);
	image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}

Open in new window

Comment
Watch Question

Commented:
Hellow rrattie,

You can set these values in your xml file. So you have the thumbnail location and the highres location. To open these large images in a popup window you need to put a piece of javascript in your html page, and call this with a getURL action (getURL("javascript:openPopup('"+largeLocation+"');");)

if you can profide a working example and an example of your xml file, i can make the changes for you if you like.

greetz,
walter

Author

Commented:
wal_toor,

I think I know what you mean, but I would really appreciate the help.

Here are my files (xml, fla, jpgs..etc..)http://www.stillpixel.com/files/flash/help.zip

Author

Commented:
BTW, this is related to the other question I had posted about moving between the 3 different galleries.
Commented:
Hellow rrattie,

I have changed the xml files (image paths so it works local and online) and the flash files (all changes are commented), and it nows seems to work. I have uploaded the files on my server to test them, and the popup works like it should.

Ow, i have also changed the publisch settings of the flash file, it could'nt find you desktop :-)

Demo:

http://www.zoetebroodjes.nl/downloads/slider/

Download files:

http://www.zoetebroodjes.nl/downloads/slider/help_1.zip

As for the sliding thing. This is not going to work the way it is build now. When you click on a gallery button the gallery is replaced by another gallery because you use loadMovieNum. If you really want to slide the "old" gallery to the end, and the replace this by the new one you need to add a function that first scrolls the gallery out, and the load the new gallery in its place.

If this is still what you need, i can think of a little script that does this.

greetz,
walter

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
That works great! Thanks so much!

If you could think of a little script to do that, that would be awesome!

*I'm going to accept the solution here and if you come up with a script it can be over on the other question I posted. Sound good?

Commented:
Hellow rrattle,

Sounds great, I am going to add that slidescript tomorrow morning early. I am now heading home.

greetz,
walter

Author

Commented:
Walter you rock! Thanks so much!!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.