| View previous topic :: View next topic |
| Author |
Message |
anyonewannaspud
Joined: 01 Oct 2007 Posts: 8
|
Posted: Sat Apr 05, 2008 4:37 pm Post subject: Make an image a hyperlink |
|
|
Hello everyone,
I've got a slideshow that loads the images by XML through flash. It all works fine but I was wondering if it was possible to make the image a hyperlink and assign a target for it?
My XML is:
<xml>
<photo>
<thumb>photo_01.jpg</thumb>
</photo>
<photo>
<thumb>photo_02.jpg</thumb>
</photo>
<photo>
<thumb>animation_01.swf</thumb>
</photo>
<photo>
<thumb>photo_04.jpg</thumb>
</photo>
<photo>
<thumb>photo_05.jpg</thumb>
</photo>
</xml>
is it something i can write here or do i need to show the flash code as well?
thanks very much  |
|
| Back to top |
|
 |
|
|
webmaster Site Admin

Joined: 17 Aug 2004 Posts: 3593 Location: Sweden
|
Posted: Sun Apr 06, 2008 10:28 am Post subject: Re: Make an image a hyperlink |
|
|
You'll have to change the XML code to send a link for every photo too, like this:
| Code: |
<photo>
<thumb>photo_01.jpg</thumb>
<link>http://www.devppl.com</link>
</photo> |
The rest should be handled by flash, so you'll have to post that code too. |
|
| Back to top |
|
 |
anyonewannaspud
Joined: 01 Oct 2007 Posts: 8
|
Posted: Sun Apr 06, 2008 10:38 am Post subject: Re: Make an image a hyperlink |
|
|
Ah thank you. The flash part is on a lot of keyframes, I'm not sure what part you would need so I'll post them all.
First Keyframe:
| Code: |
itemlist = new Array();
itemlist_xml = new XML();
itemlist_xml.ignoreWhite = true;
itemlist_xml.onLoad = function(success) {
if (success) {
var startTime = getTimer();
var items_xml = itemlist_xml.firstChild;
for (var i = 0; i<items_xml.childNodes.length; i++) {
var trackData = new Object();
for (var j = 0; j<items_xml.childNodes[i].childNodes.length; j++) {
trackData[items_xml.childNodes[i].childNodes[j].nodeName] = items_xml.childNodes[i].childNodes[j].firstChild.nodeValue;
}
itemlist.push(trackData);
}
} else {
trace("Error loading itemlist.");
}
// clean up after ourselves
delete itemlist_xml;
play();
};
itemlist_xml.load("photo.xml");
stop();
|
Next Keyframe:
| Code: |
//trace (itemlist.length);
//trace (itemlist[0]["thumb"]);
this.createEmptyMovieClip("strip", this.getNextHighestDepth());
var i = 0;
var w = 0;
|
Next Keyframe
| Code: |
trace("Item "+i+" is file "+itemlist[i]["thumb"]);
// create a placeholder for the new photo
this.strip.createEmptyMovieClip("photo"+i, this.strip.getNextHighestDepth());
// now load in the photo
this.strip["photo"+i]._alpha = 0;
this.strip["photo"+i].loadMovie("photos/"+itemlist[i]["thumb"]);
|
Next Keyframe:
| Code: |
if (this.strip["photo"+i].getBytesLoaded() != this.strip["photo"+i].getBytesTotal()) {
gotoAndPlay(_currentframe-1);
}
|
Next Keyframe:
| Code: |
this.strip["photo"+i]._x = w;
this.strip["photo"+i]._y = 0;
this.strip["photo"+i]._alpha = 100;
w = w+this.strip["photo"+i]._width;
i++;
if (i<itemlist.length) {
gotoAndPlay("loadimage");
}
|
Next Keyframe:
| Code: |
this.strip.onEnterFrame = function() {
if ((_level0._ymouse>0) and (_level0._ymouse<447)) {
// work out how far to move strip from mouse's x position
dx = (_level0._xmouse-358)/-30;
// get the strips position, and put it temporarily into 'cx'
cx = this._x;
// now add on how much to move it by
cx = cx+dx;
// check it hasnt gone too far to the right
if (cx>0) {
cx = 0;
}
// or the left ( 'this._width' is the strip or 'this objects' width )
if (cx<(716-this._width)) {
cx = 716-this._width;
}
// temporary position cx is okay, so move the strip to that new position
this._x = cx;
}
};
stop();
|
Thank you very much again for your help and hope this is not too confusing. If it would be easier to see the flash file i can upload it, just let me know
cheers! |
|
| Back to top |
|
 |
|