473,563 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Flash8] Image MouseOver in XML Gallery

2 New Member
Hi,

I am currently working on an XML Gallery for my girlfriend's brother who is a photographer. I have created a flash front end template and am using an XML database to load the images and accompanying captions.

The gallery has more than one image and the user can navigate the gallery by clicking forward and backward buttons to take then through the images:
Expand|Select|Wrap|Line Numbers
  1. var galleryXML = new XML();
  2. galleryXML.ignoreWhite = true;
  3. galleryXML.load("gallery.xml");
  4. var currentIndex:Number = 0;
  5. galleryXML.onLoad = function(success) {
  6.     if (success) {
  7.         total = galleryXML.firstChild.childNodes.length;
  8.         var galleryXML:Array = galleryXML.firstChild.childNodes;
  9.         //For creating the block-thumbnails to link to the pictures in the gallery
  10.         for (var i:Number = total; i>0; i--) {
  11.             myClip.duplicateMovieClip("thumbnail_mc"+i, i, {_x:i*20, _y:i*20});
  12.         }
  13.         image_holder1_mc.loadMovie("images/"+galleryXML[currentIndex].attributes.filename1);
  14.         image_holder2_mc.loadMovie("images/"+galleryXML[currentIndex].attributes.filename1);
  15.         caption1_txt.text = galleryXML[currentIndex].attributes.caption1;
  16.         caption2_txt.text = galleryXML[currentIndex].attributes.caption2;
  17.         //testing to see if it is grabbing the correct template/scene in the XML file
  18.         template_txt.text = galleryXML[currentIndex].attributes.template;
  19.         //testing to see if it is calculating the correct number of entries in the XML file
  20.         total_txt.text = total;
  21.     }
  22. };
  23. listen = new Object();
  24. listen.onKeyDown = function() {
  25.     if (Key.getCode() == Key.LEFT) {
  26.         prevImage();
  27.     } else if (Key.getCode() == Key.RIGHT) {
  28.         nextImage();
  29.     }
  30. };
  31. Key.addListener(listen);
  32. previous_btn.onRelease = function() {
  33.     prevImage();
  34. };
  35. next_btn.onRelease = function() {
  36.     nextImage();
  37. };
  38. function nextImage() {
  39.     if (currentIndex<(total-1)) {
  40.         currentIndex++;
  41.         var currentNode = galleryXML.firstChild.childNodes[currentIndex];
  42.         trace(currentNode);
  43.         current_pos = currentIndex+1;
  44.         image_holder1_mc.loadMovie("images/"+currentNode.attributes.filename1);
  45.         image_holder2_mc.loadMovie("images/"+currentNode.attributes.filename2);
  46.         caption1_txt.text = currentNode.attributes.caption1;
  47.         caption2_txt.text = currentNode.attributes.caption2;
  48.         next_imageNumber();
  49.     }
  50. }
  51. function prevImage() {
  52.     if (currentIndex>0) {
  53.         currentIndex--;
  54.         var currentNode = galleryXML.firstChild.childNodes[currentIndex];
  55.         trace(currentNode);
  56.         image_holder1_mc.loadMovie("images/"+currentNode.attributes.filename1);
  57.         image_holder2_mc.loadMovie("images/"+currentNode.attributes.filename2);
  58.         caption1_txt.text = currentNode.attributes.caption1;
  59.         caption2_txt.text = currentNode.attributes.caption2;
  60.         previous_imageNumber();
  61.     }
  62. }
  63. function next_imageNumber() { 
  64. current_pos = currentIndex+1; 
  65. nextImageOfX.text = current_pos+" / "+total;
  66. //caption2_txt.text = current_pos;
  67. }
  68. function previous_imageNumber() { 
  69. current_pos = currentIndex+1; 
  70. nextImageOfX.text = current_pos+" / "+total;
Everything is working so far except the following: The effect that I want to achieve is when the user mouses over the image, the image shades (I am just going to use a simple rectangle the size of the photo and put it at a 30% alpha transparency) and the caption appears over the image. When the user's mouse leaves the photo, the shade and caption disappears.

The code that I am using (that's not working on any dynamic images loaded from the XML file) is as follows:

In the main actionScript in frame 1 of the timeline I have:

Expand|Select|Wrap|Line Numbers
  1. _root.image_holder1_mc.onEnterFrame = function() {
  2. if (mouse_over_image_holder1_mc) {
  3. _root.image_holder1_mc.nextFrame();
  4. } else {
  5. _root.image_holder1_mc.prevFrame();
  6. }
  7. };
On the invisible button over the image I have:
Expand|Select|Wrap|Line Numbers
  1. on (rollOver) {
  2. _root.mouse_over_image_holder1_mc = true;
  3. }
  4. on (rollOut) {
  5. _root.mouse_over_image_holder1_mc = false;
  6. }
In image_holder1_m c (where the image is loaded into), the first frame does not have the shaded rectangle nor the caption but frame 2 has both. When the user mouses over the invisible button in the root timeline, frame 2 of the image_holder1_m c movie clip SHOULD be played but it does not. I have been able to make it work with just a static image not loaded from XML but as soon as I use the dynamically loaded image, the feature does not work (it also does not grab the captions that's associated with the image).

Is this a case of image_holder1_m c being changed due to the file name of the image that gets loaded or is image_holder1_m c always going to be image_holder1_m c regardless of the image name?

This seemed like it would be a simple thing to do but it isn't turning out that way.

Thank you in advance for your time and patience.
Brent a.k.a. numbnutz
Jul 16 '07 #1
0 4188

Sign in to post your reply or Sign up for a free account.

Similar topics

0
502
by: Perttu Pulkkinen | last post by:
Does anybody know a php-based image gallery, where final looks of the actual site would not be determined by the application? I mean that there would only be a php-library of objects/functions that could be used to incorporate folders and images to any kind of website with personal appearance. (Of course administration application should be...
5
1425
by: Deepster | last post by:
Hi all, I have searched the internet for this but havent found what I am looking for exactly, found similar items but I am not that familiar with asp to go and do this myself. So here I am .... I want a page where I will have an image gallery. The page when loaded goes and grabs all the picutres in the directory and puts them into an...
8
4796
by: Chris Dewin | last post by:
Hi. I run a website for my band, and the other guys want an image gallery. I'm thinking it would be nice and easy, if we could just upload a jpg into a dir called "gallery/". When the client clicks the "gallery" link, a cgi script could search the gallery/ dir, and create thumbnails of any jpeg images that don't already have a thumbnail...
4
1787
by: RE Kochanski | last post by:
I have attempted to use the CSS techniques from two or three sites to create a CSS only image gallery. I am muddling the affair by placing the thumbnails in one float, the page text in another float, then using absolute positioning (and z-index) to display the image over the second float. The CSS for the thumbnails is from "Web...
3
19492
by: Annette Acquaire | last post by:
I have and image map with a dozen hotspot links on it that I'm trying to get to open a new image over existing one on mouseover of each COORD. The only thing I was able to do was swap image on mouseover entire image, I want it on each hotspot only, so an image pertaining to each link shows up. I have done it in JavaScript, but the website I'm...
1
2291
by: gescom | last post by:
My goal is to create essentially two galleries on a single page, in which the first gallery determines what the second gallery displays. For instance, the first gallery refers to the contents of the main image folder. The second gallery would be a folder inside the main image folder. Depending on which image is displayed, the first gallery's...
5
2106
by: dabhand | last post by:
Hi This page http://www.dabhand.co.nz/ayupdev/gallery-riders.html works great in IE but not in Firefox... any help would be appreciated. It refers to an external javascript file which I have included the code to below: The file name is imgriders.js - as referred to in source of the html file above. if (document.images) { image1 = new...
10
6744
by: cjparis | last post by:
Hello everyone. If anyone can give me a hand I would be gratefull Am doing a site which requires a moving element and have used DHTML to do it. Have a simple Browser detect script to sort IE from Netscape. IE is ok but the Netscape browser including Firefox and Safari are not working now. Not sure why. The idea is that when you mouseover...
11
3001
by: Evolution445 | last post by:
I got this code, and it somehow doesnt work. <TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center"> <TR> <TD background="{image-path}navfiller.gif" HEIGHT=40 width="50%"></TD> <TD width="110"><a href="index.php"><IMG SRC="{image-path}matrix_03.gif" WIDTH=110 HEIGHT=40 ALT="Homepage" border="0"...
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.