473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HELP. My Head is going to pop.

Hello, I am not an expert by any means. I need help. I am making a photogallery in flash and loading an xml file to bring in the images. I also have a caption loading into a dynamic text box. I would like that caption to link to URL's. I've tried everything but nothing is working. I do have an idea though. I would like to make it so that when the next or the previous button is clicked, the dynamic text box loads a button that links to the URL that applies to the picture that is being displayed at that time. If I you think you can help but I haven't made myself clear, or you have any ideas please respond.
Thanks,
Clay
Jul 13 '07 #1
1 1477
Hello, I am not an expert by any means. I need help. I am making a photogallery in flash and loading an xml file to bring in the images. I also have a caption loading into a dynamic text box. I would like that caption to link to URL's. I've tried everything but nothing is working. I do have an idea though. I would like to make it so that when the next or the previous button is clicked, the dynamic text box loads a button that links to the URL that applies to the picture that is being displayed at that time. If I you think you can help but I haven't made myself clear, or you have any ideas please respond.
Thanks,
Clay
Hi Clay, I am doing almost the exact thing and what I have works so far. I am adding functionality to it that I haven't figured out but here's what I have so far:

I have an XML file that will serve as a database. I have structured the file as follows:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?> 
  2. <galleries>
  3. <image filename1="bubba.jpg" filename2="me.jpg" template="1" caption1="page one-caption one" caption2="page one-caption two"/>
  4. <image filename1="stars.png" filename2="it.jpg" template="2" caption1="page two-caption one" caption2="page two-caption two"/>
  5. <image filename1="you.jpg" filename2="her.jpg" template="4" caption1="page three-caption one" caption2="page three-caption two"/>
  6. <image filename1="you.jpg" filename2="stars.png" template="5" caption1="page four-caption one" caption2="page four-caption two"/>
  7. <image filename1="it.jpg" filename2="her.jpg" template="4" caption1="page five-caption one" caption2="page five-caption two"/>
  8. </galleries>
The template part just means what lay-out I am going to use in the flash movie. Sometimes there are two pictures and sometimes one and I am creating templates to use so when the user clicks the next button and the template is "4" it takes the user to the 4th template with the proper images and captions.

In the FLA file, I have an empty movie clips I call image_holder1_mc and image_holder2_mc. I then have dynamic text boxes called caption1_text and caption2_text. Lastly I have my next and previous buttons called next_btn and previous_btn.

The code in the first frame of the flash file is as follows:

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_holder1_mc._xscale = 40;
  15.         image_holder1_mc._yscale = 40;
  16.         image_holder2_mc.loadMovie("images/"+galleryXML[currentIndex].attributes.filename1);
  17.         image_holder2_mc._xscale = 40;
  18.         image_holder2_mc._yscale = 40;
  19.         caption1_txt.text = galleryXML[currentIndex].attributes.caption1;
  20.         caption2_txt.text = galleryXML[currentIndex].attributes.caption2;
  21.         //testing to see if it is grabbing the correct template/scene in the XML file
  22.         template_txt.text = galleryXML[currentIndex].attributes.template;
  23.         //testing to see if it is calculating the correct number of entries in the XML file
  24.         total_txt.text = total;
  25.     }
  26. };
  27. listen = new Object();
  28. listen.onKeyDown = function() {
  29.     if (Key.getCode() == Key.LEFT) {
  30.         prevImage();
  31.     } else if (Key.getCode() == Key.RIGHT) {
  32.         nextImage();
  33.     }
  34. };
  35. Key.addListener(listen);
  36. previous_btn.onRelease = function() {
  37.     prevImage();
  38. };
  39. next_btn.onRelease = function() {
  40.     nextImage();
  41. };
  42. function nextImage() {
  43.     if (currentIndex<(total-1)) {
  44.         currentIndex++;
  45.         var currentNode = galleryXML.firstChild.childNodes[currentIndex];
  46.         trace(currentNode);
  47.         current_pos = currentIndex+1;
  48.         image_holder1_mc.loadMovie("images/"+currentNode.attributes.filename1);
  49.         image_holder2_mc.loadMovie("images/"+currentNode.attributes.filename2);
  50.         caption1_txt.text = currentNode.attributes.caption1;
  51.         caption2_txt.text = currentNode.attributes.caption2;
  52.         next_imageNumber();
  53.     }
  54. }
  55. function prevImage() {
  56.     if (currentIndex>0) {
  57.         currentIndex--;
  58.         var currentNode = galleryXML.firstChild.childNodes[currentIndex];
  59.         trace(currentNode);
  60.         image_holder1_mc.loadMovie("images/"+currentNode.attributes.filename1);
  61.         image_holder2_mc.loadMovie("images/"+currentNode.attributes.filename2);
  62.         caption1_txt.text = currentNode.attributes.caption1;
  63.         caption2_txt.text = currentNode.attributes.caption2;
  64.         previous_imageNumber();
  65.     }
  66. }
  67. function next_imageNumber() { 
  68. current_pos = currentIndex+1; 
  69. nextImageOfX.text = current_pos+" / "+total;
  70. //caption2_txt.text = current_pos;
  71. }
  72. function previous_imageNumber() { 
  73. current_pos = currentIndex+1; 
  74. nextImageOfX.text = current_pos+" / "+total;
Hope this helps.
Brent
Jul 16 '07 #2

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

Similar topics

42
by: John | last post by:
Hello. I am a beginner to PHP and I am currently just going through a book, to create a simple form page. Unfortunately it doesn't work, and there is nothing listed on the books errata page on...
3
by: Buck Turgidson | last post by:
I am trying an example from an O'Reilly book that I just can't get to work. Can someone tell me where I am going wrong. According to the book, I should see the values of the HTTP request echoed by...
8
by: Brent_White_99 | last post by:
I copied the code from another HTML script that someone before me had written. I have no Javascript experience (I'm a VB Programmer/DBA) at all. The code below works to a certain extent. There...
2
by: . . | last post by:
Hi I need some help with java script . I have a ASPX page that is pulling a user message heading from the table on the page . The user message header has message body which suppose to dispay...
1
by: Andrej Hocevar | last post by:
Hello, below I've attached a test program reading data from a file and storing that information in a linked list. First problem is that current->p_name will print only the last item in the file...
13
by: Siegfried Heintze | last post by:
I refered the engineer at my hosting service to http://support.microsoft.com/default.aspx?scid=kb;en-us;825738 where he tried to follow the directions there. He said there was no such file:...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
47
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
3
by: BlueroY | last post by:
hi, I'm working on an exercise, i did a lot of work already and i just can't figure where I'm going wrong, this is what I'm trying to achieve Sample IO...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.