Posts Tagged ‘application’

Optimizing Animations

Posted in Actionscript 3, Animation, Article, Experiments, Flex on December 11th, 2010 by Ian Ford – Be the first to comment

I was working recently on a project that called for a certain special effect. Perhaps you’re all familiar with the classic page curl?

There’s an excellent tutorial available for free online at O’Reilly. I followed it in a misguided attempt to create my own page curl in AS3. Unfortunately, AS3 seems to have some trouble rendering complex masking effects correctly, and I was unwilling to drop the project to AS2 to accommodate one pushy art director so we needed another option.

The art director suggested we do the animation manually in InDesign and export a series of still frames that we could use in Flash. It sounded simple enough, so we produced a 50 frame sequence to use for our page curl.

Looks nice, right? Well, we can do better. How? We don’t need to use every frame! We certainly can’t expect visitors to this site to download all 50 frames, especially since there are 4 images total that will need to page flip. But how many frames should we use, and which ones?

Because the art director on this was picky, and because I have no interest in the publish->phone call->debate->repeat cycle, I decided to dump responsibility in his hands in the most explicit way possible: I wrote an app that would let him pick all the parameters for the animation.

What the application does is present every frame available to the animation in the left column. When an item in the list is selected, a preview loads in the top left frame.

The right column shows every frame currently being used in the animation. Users can drag frames from the left column to the right column and back, and a preview animation is updated and played in the top right frame. The speed of the animation can be adjusted by a multiplier of the frame rate of the anticipated swf using a numeric stepper below the animation.

Every frame is numbered and automatically sorted based on its index so that the user doesn’t accidentally produce something worthless.

As I write this I’m waiting to be told which frames to use and how long to display them. I’m not sure how long it will take to get a response, but I know in the time between now and then what I won’t be working on. :)

Try out the Animation Optimizer or Download the Project File

Bugs and Quirks: Uninitialized Properties

Posted in Actionscript 3, Article, Best Practices, Tips on December 7th, 2010 by Ian Ford – Be the first to comment

Until you refer to the 3D properties of a DisplayObject, the matrix3D property of its transform object will return null.

The same is true of the DisplayObject’s transform property itself.

This seems, on the one hand to be silly, and on the other hand to be a source of potential bugs and confusion during development. Generally speaking I expect things like this to have a default value other than null or undefined.

Perhaps it’s meant to control memory usage? A noble cause, undoubtedly, but perhaps misguided in its application. You have to assume that people are going to misuse classes, but when they do hopefully the class either fails gracefully or adapts.

In the case of this issue, I would resolve it by rewriting the accessors for both properties like so:

public function get transform():Transform {
     if (transform == null)
          return new Transform();
     return transform;
}

This way, the transform property isn’t instantiated until it’s needed, but at the same time when it’s requested there’s something there. Isn’t that nice?

Theory: Rules and Scale

Posted in Article, Theory on November 21st, 2010 by Ian Ford – Be the first to comment

The larger and more complex an application is, the more important it is that functional rules be strongly enforced.

It’s easiest to enforce functional rules (and to make a case for their enforcement) when they’ve been clearly defined from day one.

Exceptions break patterns. Without patterns to act on, you’re not really programming.

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?

Getting into Mobile Application Development

Posted in Android, Announcements, Documentation, Java, Mobile on October 24th, 2010 by Ian Ford – 2 Comments

I just thought I’d announce that I’m formally taking the plunge into mobile application development. It seems more and more (though I should have figured this out by now) that mobile is the future, and I hope to get on board.

As you know if you read this blog, I have extensive experience with ActionScript and the Flash Platform. You may also know that Apple recently lifted the ban on applications developed with Flash (and other platforms) for its iPhone. You may know (furthermore) that Android 2.2 (aka Froyo) has support for running applications targeting Adobe AIR.

You might naturally assume, then, that I’ll simply be developing the way I always have and porting to both platforms.

Nope. Not right now at least.

If you knew me personally, you’d know that I take a comprehensive approach to life. I like to do things from start to finish in their entirety. When I pick up a book or film, I finish it (whether I like it or not). I do perhaps 90% of my cooking from scratch (including growing my own herbs at this point).

We all know what happens when you take shortcuts. Sometimes it’s fine, but other times what you get is cheapened, incomplete, or unsatisfying. In other words you get what you pay for.

I’m currently studying the android platform and learning how to write applications for it in Java. I already have a little bit of experience with Java, and this is as good a reason as any to pick it back up.

I have no intention of developing for the iPhone (at least for the time being). Their behavior towards consumers and developers, frankly, frightens me at times.

Because this is a new journey for me I’m digging up as many resources as I can to help me learn this stuff. Here are a few that I can point to right now:

  1. The Android Developer Page: This should definitely be your first stop if you want to develop for Android. Everything you need to begin can be found here. I particularly recommend the Quick Start Guide and the various tutorials available in the Resources section.
  2. My first android app: I just found this blog post today, and it applies more to people with a background in Java, but it’s nice when somebody takes the time to make notes about bugs, quirks, and other potholes on the road to developer nirvana.

This is just a start, but I’ll definitely post more resources in the future as I stumble upon and use them.

Vidiot: Now With Sprint 10, Edgecast Support

Posted in Announcements, Downloads, FLV, Frameworks, OSMF, Sprint 10, Video on May 4th, 2010 by Ian Ford – 1 Comment

I’ve just updated Vidiot to use the Sprint 10 release of Adobe’s OSMF, and I’ve added a bug fix that will allow streaming video from Edgecast.

To view a demo, check out my original post. The latest files, along with a sample application, can be found by clicking here.

Just a teaser

Posted in Air, Digital Art on April 3rd, 2010 by Ian Ford – Be the first to comment

My App Icon

I spent a little bit of time developing the icon for my first publicly released AIR application. I’m not telling what it does yet, but hopefully I’ll be offering up the first version of it some time soon. What do you think?