Beatport Downloader AIR Application

[hana-code-insert name=’beatport-ads’ /]
We’ve been working with for the last month on a downloader for their music.

The downloader is build in Flex with the Adobe Integrated Runtime. Lots of custom skinning and some cool File API stuff going on behind the scenes, as well as custom settings. Here are a couple of screen shots:

Welcome Screen:

Preferences Screen:


You can download the AIR app at and sign up to download tracks at the beatport site.

Bought a house!

So I finally bought a house! Got the shiny new keys yesterday!

I’m just really excited about it. So I thought I show everyone the keys that I’m going into debt for 30 years for!

More Flexible Code – Programming to an Interface

Keep your code flexible – program to interfaces. What does this mean? Well there are a few things that we need to discuss before we can really answer that question. For this discussion you’ll need a decent understanding of Object Oriented programming…but, hey if you don’t have that it still may make some sense anyhow and you might even get something that you don’t understand explained for you as we go along.

First things first, Polymorphism – The ability for one class to stand in for another, kind of. By “kind of” I mean that by programming to an interface, a variable or property’s value can be assigned to an object that conforms to a “formal interface”, more on that in a second. This means that if you crate a property or variable that is typed to an interface – myPet:IAnimal; – (where IAnimal is the interface) that item can be any number of classes that follow the “interface” defined by IAnimal .

public var myPet:IAnimal = new Dog();
public var yourPet:IAnimal = new Fish();
public var hirPet:IAnimal = new Camel();
public var herPet:IAnimal = new Giraffe ();


Each of the classes, Dog, Fish, Camel, Giraffe must “implement” the IAnimal interface.

Okay, so what is a formal interface you say?
First off, a formal interface is a definition, some might say a contract, but I think that is confusing, of what a class’s publically accessible methods should be and what they should look like. ActionScript 3 provides a construct to create these interfaces that is very similar to classes. Basically you create the public methods, their parameters and their return types, but nothing that has to do with what happens inside the method.

public interface IAnimal
function create(p_name:String):void
function feed(p_food:Object):void
function sleep():void
Notice that there is nothing that tells you what you need to do in the methods, or anything about properties or private methods. That is determined by the needs of the class that implements the interface. This is a good point to take hold of and knock into your head:

A class has an implementation (what the class does ) and an interface (how the outside world interacts with it).

This is what allows your code to be flexible. If you program to interfaces, you can crate objects that are much more flexible and powerful by have the ability to “stand in” for any property or variable.

You can also create an “interface” through inheritance by using something called an “abstract” class. An abstract class isn’t intended for instantiation, so it is up to you to manage that. But abstract classes do allow for a default implementation (what the class does) as well as allowing for the type of interface implementation mentioned above because sub-classes inherit the interface of their parent classes.

So, keep your code flexible, program to interfaces!