ActionScript 3.0, Flash CS3, Image Slide Show, Music Juke Box, News Reader, XML

XML with ActionScript 3.0 Examples
Post on December 29th, 2008
On a previous post I talked about the basics of XML so I thought I’d show some examples of how to incorporate XML with Flash.
Since XML is primarily used to store and transfer data, it makes for a nice flexible way to store data that Flash applications can use. Since it’s external to your SWF file, it can be easily updated. So whether your Flash application pulls in data for a News Reader or a Slide Show or Music Juke Box, any change will be dynamic and ready to go.
These examples use ActionScript 3.0, which allows for easier manipulation of XML data compared to previous versions of AS. I broke up the three examples into three parts so you can see the evolution of each example and can follow it better with a gradual change in the AS code (saved as Flash CS3).
News Reader
In this Flash example (like the other two as well), I show you how to pull information into Flash and parse the information needed into an text field, dynamically loop through the XML file, and add HTML and CSS styling to the text field.
Here is the finished version and the source files (.zip).
Slide Show
There are so many Flash slide shows on the web and most use an XML file to store the image properties (url, title, description, etc) of each. This way updating is separate from the re-publishing the FLA and anyone can do it.
This application not only uses the XMLList object, but the UILoader component and the Timer class (rotate image every 3 seconds).
note: You could create a custom loader for the loading of the images by either using the Progress Bar component or creating your own.
In AS 3.0, a simple pre-loader would look something like this:
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
loaderInfo.addEventListener(Event.COMPLETE, onComplete);
 
function onProgress(e:ProgressEvent):void
{
var loaded:Number = e.target.bytesLoaded;
var total:Number = e.target.bytesTotal;
var pct:Number = loaded/total;
loader_mc.scaleX = pct;
loaded_txt.text = “Loading… “;
loaded_txt += (Math.round(pct * 100)) + “%”;
}
 
function onComplete(e:Event):void
{
// show something
}
Here is the finished version and the source files (.zip).
Music Juke Box
Finally another use of XML would be to create a song Juke Box to play different MP3 files. This project uses previous techniques of the first two projects plus the Sound and SoundChannel class.
This project focuses a little more on programming since how to load and parse and XML file have been already covered in the first two projects so it’s a nice finishing project on how to create a simple Flash application.
Here is the finished version and the source files (.zip).
note: If you want a more robust example of a Music Juke Box (pause, volume slider, etc), then take a look at this example and source code (.zip) created by Craig Campbell.
From Adobe Flash

Leave a Reply
Name (required): Email (required): Website: Comment:
Note: XHTML is allowed. Your email address will never be published.
ActionScript 3.0 Basics for Designers
Understanding T-SQL using SQL Server
jQuery: Enhancing Web Development
Introduction to ASP.NET Web Development
JavaScript Programming: From Basics to DOM

All online classes are available for download via PayPal. All lessons (.pdf) are emailed by instructor within 48 hours of purchase. Questions can be posted on the site or emailed directly via the contact page.
The Understanding WordPress and Learning Drupal courses run continuously and is paid through this site, so you can register at any time.
Recent Posts
·Best Link to Design and Development Web Sites
·Drupal Speak
·What do search engines see on your blog?
·Top Ten Search Engine Optimization Tips
·Tips for Building Blog Content
·How to Install the Drupal AMP Stack from Acquia
·Lost Drupal Login Box ” oops!
·Learning Drupal Online Courses
·What’s New in Drupal 7
·WordPress as a Content Management System
·Monetizing Directly with Advertising
·Importing a Live Blog’s Content Locally
·20 Types of Blog Posts
·What is a WordCamp?
·Tips on Blog Administration and Management
Categories
·Adobe Flash (9)
·Ajax (4)
·ASP (2)
·ASP.NET (8)
·Closed Online classes (4)
·CSS (10)
·Dreamweaver (2)
·Drupal (3)
·Fun (1)
·HTML (3)
·Interviews (6)
·JavaScript language (1)
·JavaScript topics (25)
·jQuery (6)
·Online classes (7)
·PHP (8)
·Podcasts (9)
·SEO (2)
·SQL (2)
·Video tutorials (7)
·Web conferences (2)
·Web references (1)
·Web stuff (15)
·WordPress (10)
Popular tags
ActionScript 3.0 Adobe Flash Ajax Apache ASP ASP.NET blogging C# Christian Heilmann Class Classes and Training CSS Database databases DOM Dreamweaver Flash CS3 Functions Hover Effect Interview JavaScript topics Jeremy Keith jQuery Learning libraries LVSOnline MySQL Online classes PHP Podcast Presentational Markup presentations SEO SQL Server Styling tutorials video tutorials Web conferences Web Design Web Development WordPress XHTML XML XSLT Yahoo
Notable Blogs
·Aaron Newton
·Airtight Interactive
·Ajaxian
·Alex King
·Andy Budd
·Andy Clarke
·Andy Rutledge
·Bob Easton
·Brian Goldfarb
·Cameron Adams
·Cameron Moll
·CartoonSmart
·Chris Heilmann
·Dan Simard
·Dan Wahlin
·David Stiller
·Dustin Diaz
·Eric Meyer
·Geoff Stearns
·Independents Hall
·Jacob Seidelin
·James Edwards
·Jeremy Keith
·John Musser
·John Resig
·Jonathan Christopher
·Jonathan Snook
·JSMag
·Justin Palmer
·Matt Snider
·Michael Mahemoff
·Milan Negovan
·Molly Holzschlag
·Nate Koechley
·Paul Boag
·Peter-Paul Koch
·Robert Nyman
·Roger Johansson
·Samuel Ryan
·Sarah Lacy
·Saul Rosenbaum
·School of Flash
·Scott Andrew LePera
·Scott Guthrie
·Scott Mitchell
·Scott Schiller
·Shaun Inman
·Steve Sharrock
·Tina Su
·WebAppers
About
This site started back in September 2005 as an online resource for my training at a local computer club. The material was based upon taching people how to do web programming with JavaScript.
It then expanded over the years to offer online classes (in JavaScript and ASP.NET) to anybody as well as more of a wider range of topics inlcuding HTML, CSS, PHP, ASP.NET, Flash, etc.
Feel free to contact me if you have any question on the online classes I offer or material covered.
Flickr

Search

Aly Chiman

Aly Chiman is a Blogger & Reporter at AlyChiTech.com which covers a wide variety of topics from local news from digital world fashion and beauty . AlyChiTech covers the top notch content from the around the world covering a wide variety of topics. Aly is currently studying BS Mass Communication at University.

Leave a Reply

Your email address will not be published.