SoundObject

Here’s a sound utility class to make playing sound in Flash a little easier. The example files show some basic features and usage of the class.

http://code.google.com/p/webdevils/downloads/list

The SoundObject Class is basically a wrapper for the Sound and SoundChannel classes. These can be a little tricky or confusing to work with in their raw forms. The SoundObject Class strives to provide all of the expected functionality in an intuitive package.

Usage is simple, make an instance of the Class pass along the URL to an mp3 file. Call the play method to play() the sound, stop() the sound or pause() to pause the sound. Much simpler than using Sound and SoundChannel.

This has a few other methods and could use a few more. This could definitely see an update in the near future.

Iterator

Here’s a Design Pattern from ActionScript 3.0 with Design Patterns. I find myself using this utility class more and more, so I thought I’d post an example. http://code.google.com/p/webdevils/downloads/list

The Iterator pattern handles looping through lists of data. These types of tasks are very common. I find myself working on this type of thing all the time.The obvious choice is to make an Array. But this leaves you writing code each time to handle every situation that might arise. Not to mention that making these systems around an Array doesn’t provide any of the OOP goodness that makes your work easier, more reliable and easier to update.

When would use the Iterator and why? You could use the Iterator any time you had lists of things that you need to cycle through. This could be groups of MovieClips. It could be data received from the server. Dynamic gallery. It’s good any time you find yourself looping through an Array and working with all it’s elements.

The Iterator pattern is based around two classes: Collection and Iterator. The Collection class holds the data and the Iterator class access the data. Collections can be written to hold any type of data. Iterators can be written to access data in various ways from the Collection. Basic types of Iterators might access data from first to last, reverse or randomly.

The Collection class is a simple class that acts like an Array. It contains an Array as a private property to store data. The Collection provides public methods to access elements of it’s Array and a method to set the Iterator to use with the data.The Collection class must define a function to set the Iterator.

The Iterators must define the following public methods, next, hasNext and reset. The next method returns the item out of the Collection. The hasNext method returns false if you have reached the last item in your Collection. And, the reset method starts the Iterator over again.

The easiest way to work with the Collection for myself is to store Objects.Object are flexible can store any amount of data.

Just finished a small job for Level Three

http://www.level-3.com/website/

I just created this Flash banner. The idea here was to create a flexible banner that could display example work. Work needed to be updated periodically. XML to the rescue. The SWF loads an XML file that describes everything displayed in the banner. The motion was handled with Tweener.

Drupal and Flash?

This looks like a very interesting article on interfacing Flash with Drupal.

http://www.travistidwell.com/drupal_flash_interface

Updated Class library

I have recently updated the class library and improved the SimpleScrollbar and SimpleScrollText classes. These are now much more reliable and useful.

http://code.google.com/p/webdevils/downloads/list