Category Archives: News

Boomshine Flash Game ported to IPhone

Boomshine, my most popular Flash game, has just been released on the Apple ITunes store. You can now download it now on the IPhone or IPod touch.

Jacob Thurman , whose blog current theme is coincidently the same as mine (makes things a bit confusing), is a developer in Chicago who contacted me recently with a prototype. I worked with him to get the game to match the web version as close as possible, and I think he’s done a great job.

As a game designer, I can’t express in words the feeling I get that people will be playing Boomshine on the subway or on the street. It’s funny that the harder I work for opportunities the more they come to me.

Anyway, click here for the download link (will auto-open in ITunes, or if you’re viewing this on your IPhone it’ll launch directly on your IPhone’s store). New features are planned for future versions (global highscores, game modes, etc).

Boomshine will hopefully be the first of many of my game designs to be ported to IPhone.

EventManager Class Update

Hate keeping track of event listeners?

Wish you had removeAllListeners()?  Wish you had removeAllListeners(EventDispatcherWithABunchOfListeners)? Wish you could remove all listeners that targetted a specific function?

A while ago I posted a class I wrote to handle actionscript 3 listeners.

I updated today to by default set weakReference to true and to always add the listener (if you used it before it might break code that didn’t declare the last parameter).

The class has come in handy in so many projects and makes code much nicer. It’s especially useful for destroying all the listeners of an external SWF…

Find the latest version here.

Note that the class doesn’t have full support for listeners with useCapture specified… but who really uses those anyway?

AS3 Primitives

*Edit: I have found that I am wrong about the following (as shown from the comments). In AS3, numbers are in fact placed in their wrapper classes. My interpretation are wrong. You can keep read the following if you want to know how it DOESN’T work. Basically what I describe is how Java works. AVM2 doesn’t do this, it wraps everything as an object… Sort of strange as there are performence gains using primitives.

I read a post recently that asked whether AS3 Number objects are actually treated as objects in AS3.

Number, int, etc are primitives. Just like in Java, these types have their Object class associations in case you want to create instances and call various methods that come with the Number class. For example, the Number class has functions like toFixed for number precison and accuracy.

The concept of primitives are sort of confusing to newer programming as they go against object oriented programming. In fact, in Smalltalk, one of the first OOP languages, EVERYTHING is an object. The +, -, *, etc are treated as “messages”.

In Smalltalk, since everything is an object and has messages passed, you have to specify the function for “+” and “-“. Primitives in higher level languages don’t have that just for this reason. You don’t want to have to write the code to add two numbers together do you? The concatanation syntax for Strings is also “+”. Notice how “-” is not properly handled with Strings while it is with Numbers… 

Also, in terms of an ideological argument, Number can be said to be the lowest form to describe an object. Think of the composition property of object oriented design. Everything is made of objects that are made of objects that are made of objects… There are theoretically an infinite amount of layers in-between.  Object oriented design is the practice of selecting certain layers and abstracting the rest. But at the very core, every object has to be made up of primatives (more specifically, since Strings can be represented as numbers). Think of any class you’ve ever programmed. The properties will always have either primatives or other objects. If you recurisvely loop through other objects they will all also be made up of primatives (unless they have no properties at all… that’s sort of an anomoly and bad programming design dependant on “isA” relationships… so I’m going to avoid that tangent).

Primitive types are the building blocks. Just like materials are made from atoms… you can’t really go lower than Numbers in describing an object. Additionally, primitives are passed by VALUE rather by reference.

Here’s another post I wrote a while back that went a little deeper into this concept.

Google Chrome Doesn’t Always Seperate Each Tab to Different Threads

I’m using Google Chrome right now, and I have to say that it’s blazing fast. Based on Javascript benchmarks I’ve ran from around the web, I found it to be way faster than IE7, way faster than Firefox 2, much faster than Firefox 3, and even faster than Opera. Chrome’s new Javascript engine is awesome, but I just wanted to clarify that tabs do not always run as a seperate process.

Google mentions on their in one of their Chrome FAQs that it’s up to the web developer to decide if a new link opens as a seperate process or not.

I found this out first hand by going to W3 School’s html samples page and clicking on one of the links. Instead of opening on the same tab, the link opens on a new tab. So now I had open in a tab. I edited the html source code on the left frame and put in a simple infinite loop with Javascript then hit run. As expected, the tab, instead of the entire browser, hung.

However, when I clicked on the W3 School’s html sample tab (which launched the now frozen tab), I noticed it was also frozen. My other tabs, such as Gmail, Google Calendar, etc were fine.

Google answered why: 

New tabs spawned from a web page, however, are usually opened in the same process, so that the original page can access the new tab using JavaScript.

Makes sense. In fact, that is one of the reasons why current web browsers run in a single thread. No big deal. Most of the time I have multiple “sessions” of browsing and I don’t mind if a few tabs share the same process thread.

Anyway, if you don’t have Google Chrome, get it. Finally multi-core machines will see benefits in browsing the web. I can have 10 tabs open without seeing a slowdown.

Web Standards

As many Flash Developers have heard, ECMAScript 4 has died. I’m not going to go into the details of the decision, although you can most likely blame Microsoft and their 80% browser stronghold on the web.

Nevertheless, the decision has raised significant issues around the web regarding web standards, and whether or not they have worked in the past or not.

Take for example IE and Firefox. Every web developer has experienced the browser compatibility problem. 90% of forum posts start with “Strange CSS bug, works in IE but not in FF” or “Script works in FF but not in IE” etc. Ironically, Adobe Flash’s success has largely come from this problem as Flash runs ubiquitously on every browser. While the W3C has made progress on creating web standards, in general it’s been a failure. Even newer browsers, aware of the recommended standards while in development still don’t pass Acid2. But why has this failed?

I think it’s by choice. Microsoft, Firefox, Safari, and Opera fight for the larger share in browser usage. If coders create a site that fits their browser, the idea is that more users will download that browser. For a long time, IE was the standard. Whenever a site didn’t work in IE, as a developer, you MADE it work on there knowing that 90% of the visitors to your site would have IE.

But a phenomenon happened: the open source movement. Firefox arrived as an open source competitor. It’s not that Firefox was better than competitors (it wasn’t). But because of the nature of Firefox just being open source, the browser had more power than other competitors to browser dominating Internet Explorer. Firefox complies with the web rather than the web complies with Firefox. This development strategy could have only existed on an open source project, as the developers of the project did not have the authority or mindset to take over the web.

But as mentioned earlier, Firefox has led to major problems to web designers and coders. It’s a pain to create stuff! Everyone wants a page to look the same on every browser and on every computer. Only a dream… and will stay a dream.

Having standards would fix this problem; however, how would the actual products react? How will innovation be affected? There are many parallels to government oversight in the economy and web standards… but we don’t have to go into that.

A fleet only goes as fast as its slowest ship. When Mozilla, Firefox, and Apple vote on a particular feature to be a standard, some will have to pick up the pace while others will have to slow down. And that is what has been happening at the W3C and ECMA. Adobe has included a bunch of features that it would have probably had to remove in order to comply with ECMA 4. Now that ECMA 4 is dead, Adobe can keep those features… and even develop new ones without having to wait for ECMA to accept or reject revisions.

Of course, the downside is that we developers will have to work extra hard to make our products work on multiple software. Meaning more browser specific pages and more time researching what works on a particular browser and what doesn’t.

But here is where I disagree. At this level, the benefit isn’t that someone with IE may see an awesome Javascript menu while someone on FF may see a image mapped navigation. The biggest misconception I have found is that coding standards are susceptible to the same criticism as software standards (Browsers, GUIs, colors). But it ain’t.

Here’s why: the standards proposed in ECMA 4 were in coding syntax rather than in any product output. At today’s high level coding languages, we can basically do anything we want with Javascript, Flex, and Actionscript; however, the syntax is different. And THIS is something that NEEDS standardization. Just because the experience of writing the literature of source code may be better and more intuitive on one platform than another doesn’t change the actual output of the product. This is why I think the dump of the ECMA standard is a BAD thing. The ECMA was a scripting standard. So Actionscript may get private constructors now, whooped-dee-do.

What would have happened if RSS standards weren’t introduced? Sure, maybe one RSS format would have “extra features”, but we wouldn’t have the RSS readers that we do today. The Google Reader team can focus on making their product better and not on how to read hundreds of different XML formats.

I’m not saying that ECMAScript is comparable to XML; however, I am trying to address the criticsm I have been reading trying to say that web standards hinder innovation and are always a bad thing.

The reason ECMA failed was because companies want to control the market. The excuse Microsoft and others use is that, in practical terms, the web doesn’t need certain coding features. But that’s just an excuse. Web applications are getting more and more advanced. A standard like ECMA 4, which would last for many years, needs to support the most advanced coding syntax as possible. Sure maybe most products are not big enough to really benefit from abstract classes, but in 2 or 3 years, when ECMA 4 was scheduled to be adopted and shipped with products, who knows? And what about in 5-6 years?

In other words, in the short term and for companies that have the capacity to advance their languages more than others (like Adobe) , and since AS4 may come out sooner, this decision is ultimately good in the short term and bad in the long term.

AS3 EventManager Class: removeAllListeners

I heard about a class that Grant Skinner wrote called Janitor that was supposed to help keep track of listeners, but I couldn’t find it. Consequently, I wrote my own “EventManager” class for a gaming project I’m working on which keeps track of Event listeners in a project.

As all Actionscript 3 developers know, one of the biggest annoyances is keeping track of listeners and ensuring objects are collected in memory. This class does a lot of that for you, and even has a method removeAllListeners which has different filters. So let’s say some listener keeps calling a function, you can remove all listeners that point to that function. Or let’s say you want to remove ALL key listeners.

Here it is:

*EDIT 9/30/08: EventManager Updated. Click here to get it.

For example, let’s say you have something like so:

var obj:MovieClip = new MovieClip();
var obj2:MovieClip = new MovieClip();
obj = obj2; obj.removeEventListener(Event.ENTER_FRAME,Test); // Does NOTHING!

Test will still be called every frame! Even though weak reference is set to true and there are no more references to obj! This is not good! But with EventManager…

var obj:MovieClip = new MovieClip();
var obj2:MovieClip = new MovieClip();
EventManager.addEventListener(obj,Event.ENTER_FRAME,Test,false,0,true,true); // last parameter actually adds the listener, see documentation in class of why this last parameter exists.
obj = obj2; // Now we have a bunch of options, any of the bottom lines would work EventManager.removeAllListeners(null,Event.ENTER_FRAME); // will remove all Event.ENTER_FRAME listeners
EventManager.removeAllListeners(null,Event.ENTER_FRAME, Test); // will remove all Event.ENTER_FRAME listeners that call Test
EventManager.removeAllListeners(null,null, Test); // will remove all listeners that call Test EventManager.removeAllListeners(); // will remove all listeners

The only problem with the class is that this version does not distinguish useCapture events… But big deal. Maybe I’m naive, but how often does anyone actually set useCapture to true?

Anyway, if this class gets a lot of attention I’ll put it as open source on Google Code. Then someone else can add in functionality for useCapture.

This class was such a pain to code. AS3’s Dictionary is the only sure fire way to index objects as objects (as Array uses the result of toString() for indexes), but because (for some reason that’s beyond me), Adobe decided not to have a length property in Dictionary, my life was made very difficult. There might be some bugs, but based on my initial tests everything seems to be working fine. I wonder how Grant’s Janitor class is compared to mine. I really couldn’t figure out any other way to write the function definitions for EventManager.addEventListener and EventManager.removeEventListener (having actuallyAddListener and actuallyRemoveListener as the last parameter). I wish AS3 had a way to get the memory location value of an object. Something like Object.toMemoryString or something. That way Arrays could be used and the Object.toMemoryString value (which would be unique for every single object) could be used as keys.

If you decide to use this class, please let me know so I know my work hasn’t been in vain!

My Thoughts on Google and Yahoo Indexing Flash Content

Today Google reported that they’ve developed an algorithm to index Flash content (only text, not video or images). This news is clearly dominating Flash news sources around the web, with mostly mixed reviews.

Many bloggers are criticizing Google claiming that it’s impossible for any algorithm to figure out the text information of SWF files which load text from external sources (such as XML) because it’s impossible to know the format of the XML documents being transferred over. But who cares? I still don’t get why people are saying that that’s how the algorithm works. Google has stated that it’s able to crawl externally loaded SWFs (although they don’t couple it with the original SWF when indexing, which is a significant problem for sites that load multiple SWFs for navigation); consequently, they must be monitoring HTTP requests made by the SWF and can do the same with XML files. Google doesn’t need to know how the XML file is parsed… the Flash document will do that for them. They can just have the Flash load the XML file and monitor the text fields and see the value. That’s probably why they say, “To protect your material from being crawled, convert your text to images when possible”.

The only problem I see is if text fields are very dynamic. Maybe the algorithm only goes through static text fields? Because I see no way how a text field that displays random letters (for visual effect) being able to be indexed by any algorithm.

Here’s my prediction: Community tagging. Just like the Google Image Labler game, Google will ask users to tag/label Flash documents that their parser can’t index correctly. Humans would be the perfect computational tool to solve this kind of problem. Yes, there are millions of SWFs out there needing to be indexed, but we really just want the major ones parsed.

Firefox 3 Release: World Record? What world record?

The Mozilla team has announced that they are attempting to set a (Guinness Book) of World Record of number of downloads for a piece of software in 24 hours… A record never set before.

The first thought that came to me was… huh? How can this number not be set already – by Adobe (or back in the day Macromedia) Flash! Isn’t the Flash plugin downloaded millions of times per day? Flash is on more computers than any other software (including any operating system). Macromedia never and Adobe doesn’t really release any download statistics other than averages. I’m sure Flash 8 or 9 when they first went public shattered records. Adobe should release the results so Mozilla has a number to beat.

Just think back to the day YouTube decided to switch to Flash 9 and how many users downloaded then.

Mozilla may set the record, but by no means will they have broken one.


I love FF3 (although I am shocked that they won’t fix a critical Flash bug that happens with RC1 for the final release). The search bar is great, and I don’t experience the slowdowns I did with FF2. But still, there seems to be a disconnect with FF and the web… Just look at this huge bugzilla thread about the Flash bug.

Astro (Flash Player 10) Beta Released!

Here are some highlighted features of the new player (a list by Adobe can be found on their labs page)

  • Adobe has finally made noise (read introduction material parts 1, 2, 3 by Adobe Engineer Tinic Uro). Keith Peters (who is one of the lucky few to have a version of Adobe’s upcoming authoring tool) has posted a sample application showing dynamic sound.
  • Native 3D effects! Interesting to see how Away3D and Papervision will react. While the native 3D addition will be great for vector graphics, Astro doesn’t support texture mapping or 3D model importing from 3rd party software while current open source projects like Away3D and Papervision do.
  • Multi-column layouts/tables for textfields.
  • Ability to change bitrates for streaming video on the fly.

Here are some demos by Adobe.

My reaction: After a survey showed some astronomical 98% of online videos use the Flash Player, Adobe seems like they are trying to cater to those needs. There are HUGE additions to video with Astro, and while I don’t see video portals such as YouTube or Google Video using the native 3D engine (unless it’s for some visualization), I do see web designers smiling as they can now deliever unique features for their clients. It’s only a matter of time before a 3D navigation using video is released by some design firm for a client.

There are also some… somewhat random… additions to the Flash Player. For example, inverse kinematic support with a new “Bones” tool. Is this feature really necessary? What was wrong with just using one of the many 2D physics engines?

Unfortunately, Adobe hasn’t released LiveDocs yet… But that will come soon. Understandable since much of the syntax is subject to change.

I wonder how long now before AS4 and the new ECMA features…