Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

Flash / AS

Silverlight

WPF

ASP.net / PHP

Photoshop

Forums

Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

 

 

 
Photo Gallery
Using XML and Flash
        by kirupa  |  2 September 2004

This is page nine of this tutorial, so if you stumbled here without having completed the previous page, click here to catch up on all the exciting stuff that you missed in the previous page. If you  haven't even started this tutorial, then head on over to the first page. I'll be waiting here until you finish.


Summary
This tutorial is about 9 pages long, and it is easy to get lost in all the technical jargon, or worse, miss the grand unifying theme of this tutorial. I'm going to try to explain the big picture in a more human-understandable way.

Let's get back to the ladder, for I have used the ladder example several times in this tutorial. The XML file, like I mentioned earlier, is the ladder. Each pic node is the rung on the ladder. If you have a lot of pictures specified in your XML file, your ladder is increasingly taller because you now have more rungs/nodes. Then, there is you - the explorer who is climbing the ladder to see a bit further than what was visible before.

Each time you press the Next Image button, you are simply climbing up the ladder - seeing more of your surrounding that you had not seen earlier. Being ever careful, you check to make sure that you haven't reached the end of the ladder, for it is tough to climb when you have nothing to climb up on. Similarly, your photo gallery code checks to make sure that it isn't the last image in the list. After all, conventional wisdom is that you can't display what does not exist.

You decide that you want to go back down. For obvious reasons, you check to make sure that you are not already at the bottom of the ladder. That is similar to how Flash checks to make sure that it is not trying to load a previous image that does not exist because it is currently on the first image itself.

Of course, when you go up and down on the ladder, you don't suddenly jolt to your new elevation. You move smoothly from one rung to another rung on your ladder. In Flash, when you switch images, you don't just display your next image. You fade your new image into view in the form of a simple transition that takes advantage of the _alpha property.

Hopefully you don't preload data while climbing a ladder, but you did tell Flash to preload your new images before loading them into view. You accomplish that by checking to make sure that the total file size of the image is the same size as the the image that is currently being loaded. If the two file size checks are not equal, you display a small progress bar that informs your visitors about the progress. If the amount loaded equals the total file size, that means the image is fully loaded and ready for display.

Phew - this tutorial went a little longer than I had expected! I have provided the source files for you to use in MX 2004 and MX format:

Download Source MX 2004
Download Source MX

I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.

The following is a list of related tutorial and help resources that you may find useful:

How to use the Forums
New, Upcoming, and In-Progress Tutorials
How to Help out kirupa.com
Writing Tutorials
 
Cheers!
Kirupa Chinnathambi
kirupaBlog

 


page 9 of 9

 

 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components

Flash Templates
CSS Templates
Dreamweaver Templates

flash menus, buttons and components
Digicrafts Components The best flash components ever!
Entheos Flash Website Templates Buy and sell FLAs at Ultrashock!
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Purchase & Download Flash Components
flash components Learn how to advertise on kirupa.com