iD NEWS & BLOG
Making a Flex MP3 Player
This entry I’ll be showcasing a simple MP3 player written in Adobe Flex. Full source code is available here.
Also included in this project is a wonderful Flex visualizer written by Ben Stucki. The player loads an MP3, either local or remote. An event listener then calls a function when loading is complete that will pull ID3 tag information. In this project I’m only pulling the Title, Artist, and Album tags, but you can pull any associated tag you need. We also create a visualizer component and link it to a playing sound channel, which produces the lovely visualizer.
You can also load remote MP3s just as easily (the default MP3 is local). Simply paste the URL for an mp3 into the text box and then hit the play button.
In addition I’ve incorporated a rather hackish Flex ProgressBar as a “seek” bar. The percentage of play progress is calculated and then applied to the progress bar regularly, and a MouseListener is placed on the progress bar that allows the user to click at various points along the bar. The coordinates of the mouse click are then translated into a percentage of the song length. The song is then stopped and play is started from the new location.
The music sample used is from Wired’s Creative Commons CD. Tracks from this album can also be used to test the remote playing functionality.
Tags: Actionscript, Adobe, event listener, flex, mouselistener, mp3 player, mp3s, progress bar, progressbar, simple mp3, source code, visualizer
Posted in iD Tech Bloggers | 8 Comments »
Changing the default Flash cursor
Ever wanted to use a custom animated cursor in your Flash project? This video tutorial will show you how to do so via Actionscript. Click here for the source code.
Tags: Actionscript, code, Flash, tutorial, video
Posted in iD Tech Bloggers | No Comments »
WhackIt: Flash Game Video Tutorial
Here’s another Flash video tutorial. This time we’ll be focusing on a “Whack-a-mole” type Flash game. Click here to download the accompanying source code.
Tags: Actionscript, Flash, game, video tutorial, whack-a-mole
Posted in iD Tech Bloggers | No Comments »
Video Tutorial: Creating a Defender Flash Game
I’ve created a video tutorial breaking down in 10 minutes how to make a Flash defender game. If you’d like to check out the game and source, they are also available.
Play the game: http://forum.internaldrive.com/files/vlog/Yadder.swf
Download the source: http://forum.internaldrive.com/files/vlog/VLog1Yadder_src.zip
Tags: Actionscript, defender, Flash, game, tutorial, video
Posted in iD Tech Bloggers | 2 Comments »
The Ternary Operator in Flash (if-else shorthand)
Most people fluent in Flash Actionscript are familiar with unary and binary operators, but there is also a ternary operator that can be quite useful. First, a refresh on operators:
Unary: count++;
Binary: count = count * 2;
Ternary: var result:String = (count == 0) ? “Empty” : “Not Empty”);
So what does this mean? You can use the ternary form of the if statement as a shorthand. Let’s look at the equivalent full if-else statement:
var result:String;
if (count == 0) result = “Empty”;
else result = “Not Empty”;
Of course, using the ternary operator cuts down on code readability, but three lines can effectively be cut down to one. Remember, the form is this:
(condition) ? ifTrueDoThis : ifFalseDoThis;
Tags: Actionscript, code, conditionals, CS4, Flash, programming, ternary operations
Posted in iD Tech Bloggers | No Comments »





