Ultrashock Tutorials > Flash 8 > XML Portfolio Viewer  
 
by Jim Armstrong, 2112 FX::Singularity
Download Source Files 
 
XML Portfolio Viewer
 
Introduction and Code Requirements 
Section 01: Layout XML  
Section 02: Portfolio XML  
Section 03: Architecture  
Section 04: Preloading  
Section 05: Error Handling  
Section 06: pair & triple classes 
Section 07: Observer-Observable Utility 

 Section 08: Style Manager 
 Section 09: Layout Items  
 Section 10: Custom Layout Classes  
 Section 11: Glyph Class  
 Section 12: Multi-dimensional Thumbnailer  
 Section 13: Model 
 Section 14: View 
 Section 15: Controller 
 Section 16: Suggestions for Improvement 

Portfolio XML

The portfolio.xml file contains a description of all portfolio data. Individual portfolio items are associated with a single thumbnail image and are described inside <image> tags, such as

<image id="0">
<url>http://www.2112fx.com/bullettime.html</url>
<thumb>browser1.jpg</thumb>
<title>BULLET TIME</title>
<width>640</width>
<height>480</height>
<size>3.1</size>
<time>00:58</time>
<synopsis>Bullet Time is a Flash movie re-creating one of my favorite scenes from my favorite movie. It was one of my first efforts to work with compositing in Flash. The animation was divided across four MAX scenes with cameras matched in each scene. Individual renders with different shading types were composited in Flash to create the final movie, resulting in significantly reduced file size.</synopsis>
</image>

So, why did I not use an <item> tag? That's a good question. In the very first implementation of the portfolio viewer, there were only three items associated with a thumbnail image; a title, url of the thumbnail, and url of the portfolio sample. For some reason, an <image> tag made sense at the time. It has not been changed since the first version of this application.

There was a time when I used the 'id' attribute in the <image> tag. That is no longer the case, however, I left it in the file (and the parser) in case your application needs to associate a unique ID with each portfolio item.

Tags

Following is a description of each tag and how its data is used in the application.

url - URL of the portfolio item. This url is opened in a new browser window whenever the user clicks on the PLAY button.

thumb - URL of the thumbnail image, relative to the location of the application .SWF file. This url is used by the thumbnailer to load .jpg thumbnail images

title - Title of the portfolio item. This title is displayed in the STATUS component whenever the viewer rolls over a thumbnail image.

width - Width of the item in pixels. Width is displayed in the SYNOPSIS component after the viewer clicks on a thumbnail image.

height - Height of the item in pixels. Height is displayed in the SYNOPSIS component after the viewer clicks on a thumbnail image.

size - File size of the portfolio item in MB, if applicable. Size is displayed in the SYNOPSIS component after the viewer clicks on a thumbnail image.

time - Run time of the portfolio item, if applicable. Time is displayed in the SYNOPSIS component after the viewer clicks on a thumbnail image.

synopsis - A brief synopsis of the portfolio item. This information is also displayed in the SYNOPSIS component. This gives the viewer detailed information on the portfolio item.

It is frustrating to see a collection of small thumbnail images, then load the corresponding image or animation only to find out that you did not want to view that item in the first place. By displaying summary information first, including file size and run time, the user can decide to display the portfolio item by clicking on the PLAY button.

Now that the application and its data have been summarized, it's time to think about application architecture.

 
©2006 Ultrashock.com - All rights reserved