Flash Games

 FAQ   Search   Members   Groups   Register  User Control Panel      Login 

Your time now:
Mon Nov 23, 2009 10:41 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ]  Bookmark and Share
Author Message
 Post subject: Make an image a hyperlink
PostPosted: Sat Apr 05, 2008 4:37 pm 
Offline

Joined: Mon Oct 01, 2007 6:05 pm
Posts: 8
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 :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 06, 2008 10:28 am 
Online
Site Admin
User avatar

Joined: Tue Aug 17, 2004 2:07 pm
Posts: 2554
Location: Sweden
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 06, 2008 10:38 am 
Offline

Joined: Mon Oct 01, 2007 6:05 pm
Posts: 8
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review


Webmaster - Excruciating - Johnathan - Kotik - Ash - Tomi - rangana - Phate - dflynn - Medley