Tags: flash cs5


I have finally lost my battle with a client and am conforming to their request: "I want the text content to be stored in an external .xml file so we can edit easily."

I'm happy for the many tutorials out on the web that helped me to learn this stuff, but I was surprised that I didn't find a single one that did EXACTLY what I wanted. So, I banged it out and am sharing it so you can shorten your development cycle.

Goal: From an external XML file, load a page header and content into two separate dynamic boxes, and then have those boxes update as you move from page to page.

Sounds easy right? Here is what I did to create and test my solution.

1) I created a Flash CS4/AS 3.0 document with four layers: Actions, Buttons, Dynamic Text and Background
2) On the background layer, I created a color gradient background
3) On the buttons layer, I created a simple back and next button
4) On the Dynamic Text layer, I created two dynamic text boxes. I called the smaller one at the top titleText and the larger one for the content descText.

Ok...pretty straight forward.

I then created my button listeners for the back and next buttons and put this code on the Actions layer:

nextBut.addEventListener(MouseEvent.CLICK, goNext);
backBut.addEventListener(MouseEvent.CLICK, goBack);

function goNext(event:MouseEvent):void {

function goBack(event:MouseEvent):void {

From there, I wrote some sample XML and called it "course.xml":

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page pTitle="Welcome">Welcome to dynamically loaded text.</page>
<page pTitle="How to Do It">Here is how it works.</page>
<page pTitle="Simple">Once you have it figured out, its easy.</page>
<page pTitle="Final Page">No really...its pretty easy</page>

This is a simple set of four pages. In each page tag, I included an attribute called "pTitle" which is the page title. The content is between the page tags. So, page 1 is "Welcome" with the content "Welcome to dynamically loaded text".

Now, here is the AS 3.0 to load and parse the XML.

var myXML:XML = new XML();
var XMLURL:String = "course.xml";
var myXMLURL:URLRequest = new URLRequest(XMLURL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(event:Event):void
myXML = XML(event.target.data);

The first line sets up a variable container for the XML file. The second line sets up the call to the .xml path. The third and forth line loads the XML and the fifth line waits for it to load. When it does, it loads the XML content into the variable myXML.

The next two lines of the function pick out the individual XML elements we want to use. In this case. the text field titleText gets the XML field page's first child's pTitle variable, and the descText gets the XML field page's first content.

But WAIT! Why are we calling string [0] instead of string [1]? Well, XML starts it count from 0...nuff said. When you want page 3's content, you look at the XML child[2]. Don't let it mess with you like it did with me...Accept it and move quietly on...

Now, if you want to add more pages, you add more frames. If you want to load the newer content into the subsequent text fields, you use the following code:


on the Actions layer of frame/page 2...


on page 3 and so on...

What happens is this...as the user advances to the next frame, the text box content changes to the new XML content. You have to change the string attribute, but as long as you do, the correct content will display.

And, if you want to digest this in some working files, all the code and .fla are available here. This zip file includes the final .fla, .swf and the .xml file.

I hope this saves you time as you develop your own XML driven eLearning projects.


ASTDWe are about a month away from my Essentials of Adobe Flash for E-Learning Designers online workshop series for ASTD. We are already getting good enrollment, but I wanted to give my readers a "head's up". The biggest page views on this blog are Flash related, and most of the questions I get from my readers are Flash related, so I figured I'd drop a note.

Here are some key points that you may want to know before enrolling:

  • I will be using Flash CS5
  • I will have about 10 minutes of presentation, following by 80 minutes of application sharing - this isn't going to be PPT driven, it will be driven by demonstration of Flash CS5
  • If you've used Flash in the past, this will be an intro to the software. If you have built more than a few projects in Flash, it may not be for you. However, Day 3 is going to rock, so maybe you should sign up for that...
  • Day 1 is all about the interface, drawing, symbols and tweening
  • Day 2 is all about ActionScript 3 - sorry, no AS2 will show up
  • Day 3 walks through an entire project, start to finish, the way I would build for a customer. It's really pulling back the curtain on the mad scientist and I'll share my methodologies for building eLearning with Flash
  • I'll be giving out a TON of code each week. I'll be writing it in Flash CS5, but will offer CS4 and CS3 versions as well.

If you are already an ASTD member, then the price is 1/2 off. It's going to be a blast! I hope you can make it:

ASTD Essentials of Adobe Flash for Elearning Designers
June 9, 16, 23
1:30 - 3:00 EST
Online Workshop format using Cisco WebEx


Heads up! The Adobe CS5 Suite is shipping! I have downloaded the trial versions of the CS5 suite for my Mac (reviews coming soon), and am going to be upgrading my client machine to the newly released eLearning Suite 2! (NOTE: It will be released mid-June. I got a little too excited!) Yes, during this last round of upgrades, they created another eLearning Suite and an upgrade to Captivate.

The eLearning Suite 2 contains:

  • Captivate 5
  • Flash CS5
  • Photoshop CS5 Extended
  • Dreamweaver CS5
  • Presenter 7
  • Soundbooth CS5
  • Acrobat 9

Interesting that Soundbooth isn't included in the Web suite now, and that Presenter is still version 7. I have a love/hate thing with PowerPoint and eLearning (don't get me started), but I recently created an interactive PDF with Presenter that my client loved so I can't totally hate it.

It's interesting that Adobe didn't upgrade Presenter this round. Makes me wonder if they are going to drop the tool, or more likely, integrate Captivate tools into PPT. Makes you think though...

However, something that I cannot wait to try, is Captivate 5 ON THE MAC. Yes, this is the first iteration of Captivate that runs on a Mac! I really like Captivate and what it can do for certain eLearning projects, and now that it runs on the Mac, it makes me very happy. I'll let you know my opinions of the new Captivate 5 on both the PC and the Mac this month.

Thanks to Adobe for releasing upgrades to products I love to use! Now, if we can just figure out a way to get Apple and Adobe to play nice, my world will be a better place!


Permalink 12:00:11 pm, Categories: News, Software, Adobe, On the web , Tags: adobe cs5, april, cs5, flash cs5, photoshop cs5

There have been reports leaking to the web that hint of an April release date for the Adobe CS5 suite of software. Although Adobe goes out of their way to keep these release dates a secret, reports keep coming out. I'm keeping my fingers crossed. I've had lots of buggy situations with Flash CS4 and with Dreamweaver CS4 on my Mac, so I'm hoping that in addition to those new features which are coming, Adobe has taken the time to clean up the code a bit.

And, because I cannot wait, here are some CS5 Videos and a dedicated CS5 website that should keep you enticed:

Flash CS5 : Export to iPhone
Flash CS5 : New Features

Photoshop CS5 : Sneak Peek
Photoshop CS5 : Patch Match
Photoshop CS5 : Spot Healing

GREAT CS5 Site: http://cs5.org/

Very few people are creating technology exclusively for the online learning developer, so this site attempts to fill that gap. Whether you want ideas on how to use web technologies in your eLearning, or have questions about the what's and how's, this site is for you.

November 2015
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          


XML Feeds

powered by b2evolution