You are currently browsing the category archive for the ‘Uncategorized’ category.

S 3.0 uses a new method for parsing XML that follows the E4X (ECMAScript for XML) standard. This new method of working with XML in Actionscript is more streamlined and straightforward. XML is a way to store data that is very descriptive because the data describes itself. Using XML allows you to use Flash with dynamic data in a standardized way.

There are some key features of and XML document.

  • root node – first and last node of the document, sometimes referred to as document node
  • elements – unit of XML data delimited by tags
  • attributes – data element within and opening element tag
  • text node
    • textual content placed within an opening and closing tag
    • CDATA is used to escape characters that my be problematic within a text node

(Please refer to Ch. 11 of Foundations in Actionscript 3.0 for more details on E4X and XML).

The classes used to load external XML are similar to those used for loading external content, but there is a new XML class that allows for E4X parsing.

One nice feature of E4X is the ability to create different search criteria to quickly scan your loaded XML document and retrieve the nodes or elements that you want to work with at run time. Selecting XML objects in this way returns an XMLList, which may be thought of as an array of XML Objects.

Adobe shows an example of how one might select the books by specific publisher with this technique.

These are some additional tutorials on parsing XML in AS 3.0.

Download: week 10 sample code


1.) Work with XML and parsing XML

  • you may take an existing project
  • you may start a new project
    • if you can’t think if a project, expand upon the flv example to build a grid of thumbnails that can launch a video or enlarged image
      • you may think of this as a basic boiler plate for a portfolio site
      • reference the solution (either mine or another students’) for week 6 if you want a refresher on laying out a grid

2.) Check that your A Server is up and running

  • PHP working
  • MySQL working
  • We will working calling server-side code in class, and you may want to be working with your own accounts
  • If you use another provider for hosting, that’s fine, too.

3.) Prepare a brief proposal for your final project

  • brief description (visuals, if necessary)
  • wireframes (if appropriate)
  • precedents (other sites or projects that you are looking to as inspiration, especially if flash)
    • this is especially important if you think you want to do something that has not yet been covered in class
  • note: if you want to combine this project with a final project for another class, that is fine, but I will be evaluating your use and execution of Flash and Actionscript

Here’s a quick re-hash of the sample code for a few projects from my computation studio last year…


For final, I’m hoping to making something like this as a part of my thesis… we’ll see how it goes.



Similar to embedded video, sound may be placed directly on the timeline as well.
Doing so allows you to sync animation or actionscript code to specific keyframes of the sound. Like embedded video, placing sound on the timeline will increase the filesize of your project.

It is also possible to use actionscript to handle sound and loading external sound through the Sound class.

new Sound(urlRequest)
first set up the URLRequest to the mp3 file
play() – play the sound from a particular starting point and indicate looping
manipulate the sound (volume, panning, etc)
New with Flash 9 is the ability to analyze sound. This is done through the SoundMixer class. Mike Chambers has an excellent example on how to visualize sound using this class. At this time, it appears that it is not possible to analyze sound with the SoundMixer class with the microphone.

Sound may also be created and manipulated in Flash 9. This is an example of an 8-bit Amiga Modplayer, and the developers have source code available here.


This week we will look at manipulating bitmapdata for drawing at pixel level. In addition, we will cover some simple drag and drop interactivity as well as collision detection. When combined with the mouse and keyboard event listeners that we worked with before, we may start to conceive of putting together prototypes for games and interfaces.


Bitmap is a display object that represents a bitmap image. It may be added as a child to a DisplayObjectContainer just like other DisplayObjects. BitmapData allows you to work with the pixels of a Bitmap object. Some methods that are fun for working with pixels include:

Rendering with pixels can be much faster in Flash than working with vectors.

Drag and Drop

The easiest way to create a draggable object in actionscript is through the startDrag and stopDrag methods of a Sprite or Movieclip:

It’s common to use these methods in combination with MouseDownMouseMove, and MouseUp.

Collision Detection

Detecting when two objects collide or overlap can be helpful for interfaces and games. Flash supports two methods in the DisplayObject class for detecting collisions between the object and either another object or a point. Objects in flash have a box around them called the boundingBox. The methods determine if that box overlaps either the box of another object or a point.

This week we will also look at how to tie frames of the timeline to actionscript in an external class. To do so, you will want to make sure that your class extends the Movieclip class so that you may use the following methods:

Labels can help organize sections of your timeline as well as free you from relying on specific frame numbers. Instances within your objects should be declared as public properties of your class.

Please refer to the sample files for this class to see how these concepts are pulled together.

download: week 8 samples


  1. Try working with BitmapData with your drawing application
  2. Use collision detection to develop a prototype for a simple interface or game.
    1. You may extend your drawing application to use some collision detection
    2. You try to prototype something new
  3. Foundation in AS 3 Reading:
    1. Ch. 7 (p. 243 – 272)
    2. Ch. 8 (p. 301 – 321)
    3. Will will be working with video and sound and if time permits, the camera and microphone.


Flash handles listening for events in the following way:

adding a listenersomeObject.addEventListener(type, listener)
handling the event with the listenerfunction methodName(event:EventClass):void {// commands to handle event}
removing a listenersomeObject.removeEventListener(type, listener);
The naming convention that is often used for handler or event listener method is:

on + ObjectType + EventType

Flash offers a number of different events through the package. The packages we will be focusing on this week include:
Sometimes, you may want to render something immediately after the event occurs. You may do so with the method:


Without doing so, rendering will occur when the next frame plays, which could result in a drawing that is not as smooth.

Some events are associated with default actions that may be prevented. One such event is TextEvent.TEXT_INPUT. By calling the following method, you can prevent the default action of this event, which is to put a character in a text field for a given keyboard press.


For some other references on Event Listeners in AS 3.0, you may find the following helpful:

tutorial by Kyle Brekke
Adobe tutorial (covers some more advanced topics with event model)
download: week 7 samples

update: week 6 solution


The Following Reading is optional review. I would encourage you to look over them if you have had trouble synthesizing some of the material thus far:
Cookbook (chapters review what we have covered thus far)
Essential Actionscript 3.0 (more advanced for those who want to dig deeper)
Mid-term assignment:
Create a drawing application
has mouse interactivity
has keyboard interactivity
incorporate previous concepts as appropriate
drawing api
display objects
blend modes
try to be original
Be prepared to present your midterm in class after spring break.


  1. Read Ch. 6 in Foundation AS 3.0
  2. Create a sketch or animation that describes your experience at Parsons. It may be a static sketch or a time-based animation.
    1. This assignment is meant to be interpreted openly. You may describe your mood, a feeling, or a narrative.
      1. For example, code example 6 from class could describe how I might be constantly working on more projects than I can handle. Many near completion (fade off), but many do not…and they keep coming up.
      2. You may use the timeline if you wish, but you must demonstrate the use of Actionscript beyond frame-related actions.
        1. Use sprites or movieclips with Drawing List and property manipulation
          use Drawing API
          A combination of the two
      3. Be prepared to share your assignment in class.
        1. You will be asked to present your concept and your code
        2. I will offer informal critique



  1. Read Ch. 4 (p. 103-150) and Ch. 5
  2. Create a simple application where you are a Dog Trainer (to be completed in teams of 2)
    1. You have 5 dogs
    2. Each dog
      1. has a unique name
      2. responds by barking when called by his/her unique name
      3. can do one of the following tricks:
        1. sit
        2. fetch
    3. Demonstrate that you can
      1. get one of the 5 dogs to respond by name
      2. get all the dog who can sit by issuing the sit command

      dog trainer source

  3. Advanced assignment: Circus Animal Trainer (to be completed in teams of 2)
    1. You now train 5 dogs, 2 tigers, and 2 bears
    2. Each of the 3 animals has
      1. a unique name
      2. can jump
      3. can do a trick
        1. dog can
          1. sit
          2. fetch
        2. tiger can
          1. stand on back paws
          2. embrace human head in jaw
        3. bear can
          1. balance a ball on nose
          2. dance
    3. Demonstrate that you can
      1. call a bear by its unique name
      2. get a tiger to jump
      3. get each animal to do its unique trick
    4. hint1: what do the animals have in common and how do they differ
    5. hint2: create a UML diagram of your classes (scan of hand-drawn diagram is fine) to show relationships
    6. animal circus source

      Some Issues I had with this homework: in the documents, circusBear and circusTiger, I wasn’t able to use “this._name” to call the animals specifically by name for ages. Finally, I realized it was because I’d declared _name as  a private variable… duh.


  1. Read and Review Ch. 3
  2. Review the array solution from week 2 (see link above)
  3. Re-work your animated mad-lib from week 2 if it’s not working:
    1. animation depends on conditionals
    2. loop it through to show how it changes based on the condition
    3. please feel free to reference your classmate’s code, but note where you got it from in your comments
  4. Create a Flash project that uses an external class and custom-defined class
    1. (custom-defined class), has the following properties
      1. type – a string that describes the type of ipod (e.g., “shuffle”, “nano”, “classic”, “touch”, “iPhone”)
      2. color – a string that describes the color of the ipod (e.g., “black”, “white”, “silver”, “red”, “blue”, “yellow”, “purple”)
      3. diskSize – a number that describes the size of the hard drive (e.g., 2, 4, 8, 16, 32, 64, 160)
      4. cost – a number that is the cost of the iPod
    2. Create a document class ( or whatever you want to call it)
      1. within this class, create one of each type of iPod
      2. loop through all your iPods and indicate it’s type, color, and diskSize
      3. assume any type can be any color, have any disk size, and have any cost, but if you want to enforce some rules on that, feel free

      iPod Source


  1. Read Ch. 3.
  2. Make your Mad Lib from Week 1 output over time according to the solution for the advanced assignment from week 1.
    1. Add animation to the timeline so each line of your Mad Lib that is output has a visual association with it (may be literal or abstract)
    2. Experiment with dynamic narrative:
      1. Place at least two conditionals in the code that change the lines that are output.
      2. Get the Mad Lib to loop back on itself once.
      3. Based on the logic of conditions and looping, the corresponding animation should also change.
    3. madLibSource

  3. Create an array of the names of everyone in the class including the teacher heeding the following requirements
    1. create a function that adds one person to the array at a time
      1. the function must take 2 parameters, one for first name and one for last name
      2. the function must announce the addition of the person added with a trace statement
    2. once the array has been created, output the names in a list as the first name, followed by a space, followed by the last name
      1. should be alphabetical by first name
    3. hint: there is more than one solution possible
  4. classArraySource

1. Create a website where you will be uploading assignments completed for the class (I will be adding these sites to the Blogroll). Post a comment to this blog post with a link to your site.


2. On your website, link to a Flash project that you have already done (it is okay if you have not already done one). If you do not wish to show it publicly, you may zip it up and email it to me.

This is my first time playing with flash, so I’ve attached the results of a tutorial I was playing with this week <a href=””>here</a&gt;.

3. On your website, link to a Flash site or project that you like and describe what you like about it.

<a href=””>This</a&gt; is super interesting. I like the creative use of animation and sound. I wish it were interactive, though. I think that would add to it, but even though it’s just an animation, it’s very appealing. It’s such a simple concept.

4. Foundation in Actionscript 3.0 Reading

  • Ch. 1 – p. 3-16
  • Ch. 2


5. Using the example 8_variablesAndConstants as a template, create your own Mad Libs that you can play with your friends by using variables to store the blank nouns, verbs, and adverbs, etc. Your assignment must meet the following requirements:

  • 75-200 words
  • Uses at least 6 variables
  • Involves at least one calculation for a variable of the Number datatype
  • Zip up your assignment and upload to your website

<a href=””>MadLib source</a>

Welcome to This is your first post. Edit or delete it and start blogging!