What’s next for dispatchEvent() Blog?

Dear readers,

First, I’d like to say thanks to all of you who have read and commented and shared this blog over the past 6 years or so. Despite the infrequent posts, it’s been a huge source of pleasure for all of us to be able to share helpful info (and a few personal rants) with the flash community.

For a while now we’ve been living in a world where a lot of what we cover on a blog like this is competing with Twitter, Google+, StackExchange, screencasts, Tumblr, Facebook, &c. for the reader’s attention. I often wonder if blogs are even relevant anymore. I certainly struggle to keep up with everything and blogs are usually at the bottom of the list.

Furthermore, the three of us, Mims, Roger, and Caleb have changed a lot in the last couple of years. For example, only one of us lives in NYC, and none of us work exclusively on the flash platform anymore.

We’re not necessarily going to stop posting, however, it may be time to change up the format. I would really appreciate some feedback on what and how you’d like to hear from us in the future. If you’ve got a blog or twitter account that you think is reaching people, tell us how! Comment, email, tweet me, or whatever.

Some things I’ve been thinking about…

  • Should we keep blogging or spend that time being more active on Twitter? How do Twitter and blogs work together?
  • How do we keep it fun and frequent?
  • What posts do people like the best? Who’s visiting the site?
  • Should we stay Flash-focused or go more broad with programming and interactive design in general?
  • Does it work better having multiple authors or is it confusing? Maybe three more specialized blogs would be better.

Thank you!

Posted in Discussion | 4 Comments

SnippetSaturday: Number to String

This is some code I wrote a long time ago back when AS3 was just starting to show up on the scene (I updated it some to work on its own and to use crazy nested Vectors). I’m sure it’s not terribly useful, it probably could be optimized quite a lot, but hey, it is what it is. I think it could be informative as one crazy possible solution to a kind of difficult problem. Comments away!

numberToString – wonderfl build flash online

Posted in Snippets | Tagged , , , | Leave a comment

Snippet Saturday: quick random choice

Today’s Snippet Saturday (actually, Sunday) is a quick shortcut for choosing one of several strings, objects, etc. randomly.

Now, I wouldn’t really recommend using this code in a project. There are ways to do the same thing that are much more readable and less error prone. Instead, I thought it was an interesting experiment to show off some of how AS3′s syntax works for those of you who may not have seen something like this.

What’s happening here? Let’s break it down.

  • ["Alpha", "Bravo", "Charlie"] – Here we are instantiating a new array and populating it with three strings. This is essentially the same as:
    var a:Array = new Array();
    a[0] = "Alpha";
    a[1] = "Bravo";
    a[2] = "Charlie";
    
  • [...] – next is another pair of square brackets. This is an array access operator. In other words, everything between the two brackets will be evaluated as the index of the array to retrieve.
  • int(...) – This is an explicit type-cast to an int. That means that everything inside those parentheses is evaluated and flash attempts to convert from whatever data type it is to an integer. In the case of decimal numbers, they are rounded down so this is similar to using Math.floor().
  • Math.random() * 3 – random() of course produces a random floating point (decimal) number between 0.0 and (almost but not quite) 1.0. Multiplying that number by 3 (the length of the array) produces a number between 0.0 and 3.0 (technically, between 0 and 2.99999999etc).

The result, an array is created with three strings, a random number between 0.0 and (almost) 3.0 is generated, it is rounded down to an int between 0 and 2, that number is used as the index of the array to look up. The result will be randomly one of the three strings.

I hope you found this interesting!

Posted in AS3, Snippets, Tips, Tricks, and Hacks | Tagged , | 2 Comments

Snippet Saturday: isRoughlyEqual() PLUS: as3-utils

Last week, I started a (hopefully) weekly post where I throw out a (hopefully) useful piece of code for people to (hopefully) use in their projects. I’m calling this #SnippetSaturday.

John Lindquist commented almost immediately that there is a project on github designed to collect these sorts of useful little snippets of code. It’s called as3-utils. Check it out!

This week’s snippet, isRoughlyEqual(), provides a simple way to find out if two numbers are in the ballpark of each other.

I’ve added it to the as3-utils project too.
http://github.com/mimshwright/as3-utils/blob/master/src/utils/number/isRoughlyEqual.as

Posted in AS3, Snippets | Tagged , , | Leave a comment

Snippet Saturday: limit() function

So I’m sitting on a bunch of pretty useful code and I’m not sure how to share it with people. I could create a massive library that combines all the miscellaneous bits into a single, poorly documented library, but after looking at the Flash Game Dojo’s wiki, I’m starting to believe more strongly in the idea of releasing code in smaller pieces that achieve a particular function. So, I’m going to try to kick off this idea of #SnippetSaturday. I’m sure I won’t manage to post something every week but I’ll do my best. If you’ve got a blog or just twitter, I’d encourage you to join in too!

Anyway, here’s my first contribution. It’s a simple little function that limits a number between an upper and lower limit.

BTW, I used gist.github.com for this but snipplr is good too. If you know of others, leave a comment!

Posted in AS3, Snippets | Tagged , , , | 3 Comments