Thursday, January 29, 2009

Lametarded Firefox Flash Player Crash

http://bugs.adobe.com/jira/browse/FP-17

This is the lamest thing in the history of forever. It will crash Firefox 90% of the time. How does it happen?

Basically the scenario is this: if Flash Player originates a resizing of itself on the page, Firefox will immediately crash and close. Can't be any more clear than that. Why was I trying to get Flash to resize? My current project needed to have a "sidebar" which would expand when necessary, displaying content when it was needed, hidden when it wasn't. I used a really sweet Javascript tween library as well as JQuery to make it all happen, and it worked fine when the animation was triggered by a HTML button tag.

But as soon as I tried doing it with Flash Player, I was presented with more than an hour of crashing Firefox. There's no consistent way to make it work, period.

If you are suffering from this horrible Flash Player plague, I feel your pain. This really sucks.

Friday, January 9, 2009

Yo Dawg...


This is just too funny not to post.

Labels: , ,

Wednesday, January 7, 2009

AS3 IOC Containers: Spring Actionscript (Prana) vs Parsley

Today, I decided to bring some good ol' IOC and dependency injection into my AS3 workflow. I took two of the most popular IOC containers for test drives and compared the features of both, and in this post, I'm going to log my findings.

1. SpiceFactory's Parsley (current version 1.0.2)
Download | Documentation

Learning to use Parsley was really easy. The documentation was very concise and yet complete, it didn't just shove a bunch of examples and ASDocs in your face, it explained in-depth how the various aspects of Parsley work and how they can be extended. It has really interesting features, kind of a little break from just regular IOC and dependency injection.

Some of the things I really liked about Parsley were:
  • The documentation. It rocked. It was so complete and so in-depth that it made it a breeze to get started with Parsley. It showed a lot of examples of how to use Parsley to its fullest, and explained the various API's well.
  • Localization of messages. Parsley makes it really easy to provide localization to your applications. Localization is one of the things that has always been a pain for developers to implement, but Parsley covers this facet extremely well. Localization can be manually set or automatically interpreted by Parsley. You create message bundles for the various strings required by your application (such as a tooltip for a button: "Opens a file for editing.") and you create multiple message bundles (which can go in separate XML files) for each locale you're targeting. It's super easy and though I haven't tried it out just yet, one can see how it makes localization a non-issue for application development. The more you take advantage of IOC in Parsley, the more you can incorporate localization. Awesome feature.
  • Event listener tags in XML contexts. You can easily register event listeners in the context with the "listener" tag. This makes life a heck of a lot easier for me at least. I despise typing out "addEventListener" four to ten times for a complicated object with lots of dependencies.
  • Easy to extend. Fo' sho'.
Some of things I wasn't so fond of in Parsley:
  • Non Spring-like XML definitions. Parsley breaks away from the Spring XML definitions that I like, and am used to. I'm OCD, so this is basically life-and-death for me ;) Plus the Parsley definition structure is a bit more verbose, so you'll end up typing more code in your definition files.
  • Inability to simply invoke methods. For the logging framework I've developed and use, I need to call functions like "registerOutput" on my objects, and Parsley simply can't do that yet. Spring Actionscript (Prana) handles this with the "method-invocation" tag, which I like... a lot.
  • More verbose setup in parsing contexts. You need to instantiate a parser and have that load a context into another object. This extra step is kind of useless, at least to me it is.
All in all, Parsley was ok but I found that I prefer Spring Actionscript (Prana) in the day-to-day stuff. Although Parsley has some really cool API's that I haven't seen yet, I like a more Spring-like IOC container.

2. Spring's "Spring Actionscript", formerly Prana (current version 0.6)
Download | Documentation

Spring Actionscript (Prana) was a bit more difficult to learn because of lack of documentation, but proved to be far more powerful than Parsley, though it lacks some of the cool features that Parsley has. As far as I know, it lacks the cool localization that Parsley offers standard, and it definitely lacks the "listener" tag that Parsley boasts, though you can achieve the same general result with the Spring Actionscript "method-invocation" node. Plus, since Spring has taken charge of the project, it's just like Spring! This, for me, is huge. I love Spring. Spring is amazing and easy to use, and their Actionscript IOC container is such as well.

What I loved about Spring Actionscript:
  • It's just like Spring. \m/
  • The "method-invocation" node. This really helps make the framework a heck of a lot more flexible.
  • XML declaration files are less verbose and AS3 instantiation is a less wordy. And it runs just as you'd expect an IOC container to run. If you've used Spring, the migration to Spring Actionscript is a no brainer.
  • It's a huge framework. I guess this is both good and bad, but I like having a lot versus a little, but maybe that's just me. It has plugins to Cairngorm and PureMVC, which I'm sure a lot of people are grateful for.
What I kind of didn't like about Spring Actionscript:
  • It doesn't have the "listener" tag that Parsley has. It's more of a convenience thing than a lack of a feature, but it's still really nice to have.
  • It doesn't have the localization features of Parsley. The message bundle API of Parsley is genius, really powerful and super easy to use.
  • Lack of documentation. Insert sad face here. It was a bit of a challenge to get up and going with it, but in the end it was worth it.
  • Lack of "init-method" and "destroy-method" and "factory-method" subtags of an "object." It supports the "init-method" and "factory-method" parameters on the "object" tag, but it's nice to just nest those underneath the "object" tag rather than as a parameter to the base "object" tag. The "destroy-method" is completely left out, though I'm not sure how that would apply in AS3, if at all. I'm really missing the "static-factory-method" tag that Parsley supports though. So maybe this aspect of Parsley is more like Spring than, dare I say, Spring Actionscript?
  • Not so easy to extend. There's little documentation beyond the ASDocs, so I wouldn't know if I could implement a preprocessor like in Parsley or anything advanced like that.
Other than that, my choice is pretty much clear: Spring Actionscript takes the TK Cup! Woot! I'm going to start using it in a real-world application and I'll post again on my findings with working with Spring Actionscript in a real world scenario. Even though I kind of prefer Spring Actionscript, it is definitely missing some of the really awesome Parsley stuff. I, for one, am a huge fan of the localization features of Parsley. So, don't automatically reject using Parsley because of this post. Parsley is an awesome framework for IOC, and SpiceFactory has done a lot of good work on it. It's definitely worth your time to check into both projects and choose which is best for each situation you run into. I can definitely see some areas where I'd prefer using Parsley over Spring Actionscript

Until then, here's my two test projects. They contain basically translations of the same general project, translated to Spring Actionscript and Parsley. The required libraries are included in each projects corresponding lib folder, though I used Arthropod for debugging and I didn't include that. They're Flex projects by the way. These are to help you make your informed choice on what to go on, rather than just depending on my glorious madness to make your decisions upon:
uploads/as3ioctesting.zip

Good luck in the wonderful world of IOC!

EDIT**
Here's a bit of a disclaimer about Parsley. Parsley does have a sort of "method-invocation" tag, though it wasn't clear to me at first. According to Jens Halm, the project lead, you can have multiple init-method tags to invoke methods when the object is instantiated. So basically, you can achieve the same result without the method invocation tag. So now my choice is more unclear. I like Parsley AND Spring Actionscript. I don't know what I'm going to do, but you can still make a choice at least :)

Labels: , , , , , ,