API

What I’ve been working on

Posted in Algorithms, API, Experiments, Flash on May 10th, 2011 by Ian Ford – Be the first to comment

I’ve been working on building a library for bezier curves and editable paths. I’ll share more results later.

The Power of Free Data

Posted in API, Data, Links, Visualization on January 18th, 2011 by Ian Ford – Be the first to comment

If you haven’t yet, check out freebase.com. It’s an awesome repository of free data with an api you can use to access it. Dig it. I found a great example of its use in the form of an interactive map that allows you to browse military conflicts around the world by time range.

What is an API?

Posted in API, Article on October 28th, 2010 by Ian Ford – Be the first to comment

A while back I sent a video around the office (this one about Molehill) and received a confused response from a coworker:

You might think I’m completely stupid, but what is an API?  I was at the Flash in the Can Conference a few months ago and have been hearing that term ever since.  I assume it’s an AS3 thing?

I explained it as follows:

API means Application Programming Interface. It basically refers to a set of procedures and protocols for getting things done. For example, you could say that things like waving hello, handshakes, speech, and meetings are part of a human communication API. When we talk about new APIs, we mean that either the set of things we can do in a specific sphere has expanded or become more powerful. If you can imagine people who are only able to do things like wave and shake hands, an API upgrade might then allow them to truly speak, or maybe shake hands more vigorously.

It’s often challenging to explain things like this to non-programmers, but this seemed like a very useful metaphor to me. Would you agree?

YouTube AS3 Updated

Posted in Announcements, API, Article, Documentation, Flash, YouTube on October 3rd, 2010 by Ian Ford – Be the first to comment

I’ve updated the YouTube AS3 wrapper classes to include full ASDoc style documentation. Check out the project page for the latest files.

The Capabilities Class

Posted in Actionscript 3, API, Article, Documentation, Downloads, Flash, Tips on August 5th, 2010 by Ian Ford – 1 Comment

I’d like to take a moment to draw your attention to a very useful class that’s been around for some time, but that I’ve never really bothered to use: flash.system.Capabilities. It gives you all kinds of useful information about the environment your SWF currently resides in. I’ve got an example below.

The SWF above (with any luck) should tell you whether or not you’re running a debug version of flashplayer, who the manufacturer of your flash plugin is, what operating system you’re running, what player type you’re using (should be plugin on this page), and what version of the flash player you’re running.

The code for the demo is as follows:


field_version.text = Capabilities.version;
field_player.text = Capabilities.playerType;
field_os.text = Capabilities.os;
field_manufacturer.text = Capabilities.manufacturer;
field_debugger.text = Capabilities.isDebugger.toString();

If you download the files for this demo here and run the SWF on your local machine, you should see a different value in the player type field.

The player type is the most useful piece of information to me. In theory you could use it to load different data or behave differently in general depending on whether you’re viewing your SWF in the Flash IDE or on a webpage, without having to add your own obnoxious boolean “debug” flags.

API Madness

Posted in Actionscript 3, API, Article on May 11th, 2010 by Ian Ford – Be the first to comment

Today I was trying to clear lingering video from a finicky NetStream and having little luck. I decided to swing by Adobe’s LiveDocs for the NetStream class and saw what you’re looking at in the image below.

Play2?

“play2?” Really? Could Adobe not come up with a better name for this alternative play method than “play2?” At least this is the only example of such an awful naming convention. Oh, wait. Nope. Nevermind.

That’s right. I must have forgotten about “atan2.” Seriously Adobe, WTF?

Vidiot – A Wrapper for Adobe’s OSMF

Posted in API, Downloads, Flash, OSMF, Video, Vidiot on March 6th, 2010 by Ian Ford – 3 Comments

I’ve been working, over the last few weeks, with Adobe’s Open Source Media Framework. The OSMF is Adobe’s initiative to provide a standard set of tools and interfaces for deploying video content on the Flash Platform.

The framework is built loosely according to a MVC pattern, in which the Model consists of various MediaElements, the View consists of a MediaContainer, and the Controller consists of a non-displayable MediaPlayer class. As of its current release (Sprint 9), methods of implementation are so varied that it’s hard to find reliable documentation or concrete examples of how to use many of the components of the framework. This makes it difficult to work with so far, but the capabilities being planned and exposed for the project make it very exciting to jump in and start coding.

Today I connected to the project SVN, updated to the latest revision, and jumped back into developing a wrapper that I originally began planning for Sprint 8. I’ve implemented a very simple class based on the latest revision of Sprint 9 which I’m offering you today. I’m calling the project Vidiot to reflect my hope that it will be so easy to use, even an idiot will be able to display video in Flash.

The demo above uses the Vidiot class to play a sample streaming video hosted by Akamai. Layout and playback controls are separate from the Vidiot class. The simplest use case for Vidiot looks like this:

var vidiot:Vidiot = new Vidiot();
addChild(vidiot);
vidiot.load("video path");

At this stage, it doesn’t really get any more complicated than that. You can use Vidiot to play either progressive or streaming video (though thus far I’ve been unable to stream from Edgecast. Hmm….), and in theory this thing is also set up to play audio or still images as well, though I’ll have to test that out and probably update some of the code.

I hope to continue to release new versions of Vidiot and keep it up to date with the latest builds of OSMF. If all goes well you’ll see more posts about this in the future.

Download sample video player and Vidiot source code

UPDATE: Vidiot has been updated. Check out the most recent post.

AS3 Developer? Android User?

Posted in API, Documentation, Flash, Flex, Mobile on January 27th, 2010 by Ian Ford – Be the first to comment

For those of you carrying Android phones that spend far too much time thinking about flash/flex development, I’ve found a very handy little app.

From the publisher’s website:

After seeing that someone wrote an ActionScript reference application for the iPhone called ActionScript 3 API Reference for iPhone, I decided to take matters into my own hands and make the same application for the Android platform which the t-mobile G1 works on.

Displaying YouTube Content in AS3

Posted in API, Downloads, Flash, Uncategorized on January 14th, 2010 by Ian Ford – 12 Comments

UPDATE: This content has been migrated to a permanent page of the blog. Please direct any comments or questions to the new page.

Recently, while working on my portfolio, I was presented with the problem of displaying YouTube content extracted from an RSS feed in Flash. On the one hand there was the difficulty of parsing embed and object tags and extracting relevant data from the mess I was given, and on the other hand there was the problem of displaying the content itself.

YouTube provides documentation for their api, but after digging around online I was surprised to find that nobody had gone through with packaging it in a format I was willing to work with. There is an ActionScript 3 YouTube Wrapper available online, but it presumes that the Chromeless YouTube Player (http://www.youtube.com/apiplayer?version=3) you download to play videos with will be accessed using a combination of the static ExternalInterface class and external JavaScripts.

This seems, to me, to be unnecessarily complicated.

I’ve gone through the trouble of picking through the API and creating a simple class that loads a chromeless player and exposes methods you can use to manipulate it and display content from YouTube, without requiring any external javascript.

The application above is written in Actionscript 3. Basic usage is as follows:

import com.agitcraft.youtube.YouTube;
import com.agitcraft.youtube.YouTubeEvent;
_tube = new YouTube();
_tube.cueURL("http://www.youtube.com/v/-CsA1CcA4Z8", 0);
addChildAt(_tube, 0);

Each of the methods made available in the official YouTube API is available in some form or another via this set of classes. When I have a little more time I’ll follow up with official documentation and availability via google code.

Download AS3 YouTube Classes

A Solution to the No-Design Cycle

Posted in API, Flash, Flex, Frameworks, Links, PureMVC on January 5th, 2010 by Ian Ford – Be the first to comment

For well over a year now, I’ve been engaged in the process of moving and redesigning my professional portfolio. The current (a term I use loosely…) version is over 3 years old, and it’s sitting at a domain I don’t really use anymore. I initially began work on a relaunch almost immediately after my portfolio landed me a permanent job, but over the years I’ve been indecisive, full of excuses, and just generally unable to commit to any planned redesign.

I’m sure you know the cycle: You come up with a great design concept, plan about 80% of it, and jump excitedly into development. You make rapid progress initially, but as you delve deeper into the project you come across roadblocks and development stalls. After hammering away for weeks at a time on bugs that seem to multiply faster than you can fix them, you eventually come to consider the project too flawed to complete and scrap it.

Where do these flaws come from? In my case the culprits are poor planning, over-ambitious development goals, and lack of a consistent process for developing large scale applications.

What I once considered the “Redesign Cycle,” I will now be calling the “No-Design Cycle,” as the use of the prefix “re-” vaguely implies that eventually some new design is produced and launched.

This post, however, is not just about my failure to produce a new portfolio in several years, or about my enthusiasm for the current draft I’m working on. It’s about what, thus far, is proving an effective solution to this terrible problem. It’s called PureMVC. Perhaps you’ve heard of it?

The claim made by proponents of PureMVC is that it allows you to program “at the speed of thought.” Outrageous, right? After picking the framework up several weeks ago and developing with it in the time since, I can mostly agree.

If you’d like to start working in PureMVC, you can download the AS3 port, check out the full API documentation, and follow the tutorial I used to get started learning the framework, courtesy of Ahmed Nuaman.