Archive for the 'Flash' Category

Trimming in ActionScript jQuery-style

Sometimes we want to remove whitespace from the ends of our strings. In fact, this task is so common on the web that the ubiquitous jQuery library includes a utility method for that purpose.

What about in ActionScript 3? Well, not so much. The String class in AS3 is, in my opinion, a bit lacking compared to languages like C# and Scala. What’s worse, you can’t augment prototypes easily like you can in JavaScript to add missing methods (see update at the end for more information on this).

Read more »

SpriteFactory — an AS3 library for creating multiple sprites using the same bitmap

While working on Flash sidescroller stuff I noticed that there was no easy way (that I could find) to create multiple sprites from a single bitmap (something you’d do when doing a tile-based graphics layout).

Sooo… I made my own simple library called SpriteFactory.

Here’s some example usage:

var factory:SpriteFactory = new SpriteFactory("assets/sprites");
factory.loadBitmap("grass", "block-grass.png");
var grass1:Sprite = factory.newSprite("grass");
var grass2:Sprite = factory.newSprite("grass");

Check out the project page for more information.

YouTube Basic Sidescroller Tutorial in FlashDevelop

As I’ve made up my mind to learn Flash, and don’t want to pay a honkin’ amount of cash, I decided to go with a free Flash IDE called FlashDevelop.

Since I’m toying around with the idea of sidescrollers, I did a search for “Flash sidescroller tutorial” and found this excellent 3-parter by  Unfortunately (for me), the tutorial expects that you’re using Adobe’s Flash IDE.  Thus, as a contribution to the web (and myself… mostly myself), I translated the tutorial to work with FlashDevelop.  Read on to see how I did it, or just grab the source here.

Read more »