Resolving an Eclipse instance that stalls/freezes during splash/loading

I have a particular Eclipse workspace that has a pretty elaborate setup. For a long time, I had an issue where once in a while, Eclipse would just freeze during startup with no way to load the workspace. In the past, I would have to rebuild the workspace from scratch. But just today I found a post on Stack Overflow (http://stackoverflow.com/a/9832027) that explains how easy it is to fix this.

  1. Close Eclipse if it’s open.
  2. Open a terminal window.
  3. cd to your workspace directory.
  4. rm .metadata/.plugins/org.eclipse.core.resources/.snap
  5. Reopen Eclipse.

Fake ADDED_TO_STAGE event

I wanted to create a tool that could verify if a given SWF references the Stage instance. The only reason to reference the Stage is if you want to call one or more of its member functions or properties. So I set up this test to simulate DisplayObjects being added to the Stage. I wanted to verify the sequence of events so I created the same sequence of DisplayObjects that actually were added to the Stage and then create a Sprite as the root and manually fired ADDED_TO_STAGE events as display children were added to it. The resulting code is below. Feel free to use it however you need…

IAB VAST ActionScript 3 Library

As a personal project, I wanted to put together a parser for VAST responses. So I created an ActionScript library on GitHub. It’s basic but takes care of the monotonous XML to AS3 mappings. It also allows for custom extension parsers.

For more info, visit the project page: http://nathanhinish.github.com/AS3-IABLib/

UPDATE: I think a WP update borked the page. If there’s interest I’ll put it up. Otherwise, here’s the link to the GitHub repo. https://github.com/nathanhinish/AS3-IABLib

UPDATE #2: There is growing interest in the library so I wanted to make sure the documentation is available online. To that end, I created a GitHub project page that has a link to the documentation. http://nathanhinish.github.com/AS3-IABLib/

Flex Quick Tips: More Advanced Responders

I just came across a Flex framework class I was previously unaware of.  It’s the AsyncResponder class and has a nifty extra parameter in addition to the ‘result’ and ‘fault’ parameters of the normal Responder class.  The third parameter allows you to pass-through data in the form of a token object.  This could definitely come in handy when trying to use the Command pattern if you don’t want lingering commands. For more info, check the link below.

AsyncResponder Flex Docs

Ant scripts for Robotlegs and Signals projects

I’ve put together a set of Ant scripts build targets to create the boilerplate code for a Robotlegs/Signals project.  You can either clone the code using Git at git clone https://bitbucket.org/nathan.hinish/flex-rl-generator

It can create a basic project structure with or without the Flash Builder specific files like .flexProperties and .actionscriptProperties. The project creation targets will set up the necessary libraries, create the project folders, and create a default project SignalsContext with mappings for the StartupCommand.  Then you have a variety of targets that can create client signal loops, service signal loops, view mediators, models, etc.

In addition to the creation targets, there are a couple extras to run Flex-PMD to verify the quality of your code and to build a production-ready SWF. To see more info, you can check out the Project Wiki.

Enjoy, and if you have questions, feel free to comment below.  Or if you have an idea for a better project name, please suggest them.  I’ve been trying to think of one but couldn’t.

Best Flash iPhone Apps Vs. Worst XCode Apps

This is another short post about something that’s been floating around in my thoughts. It deals with the current Apple opposition to Flash-created iPhone native apps.

The main thought that I am basing my opinion on is this: “The best Flash-created app is likely to be better for the end-user than the worst XCode-created app.”

Why not give end-users more choice in apps? Sure there’s already a lot of choice there. But does it degrade the App Store to allow more apps in? Developers have been creating for the iPhone for 3 years. Flash development has been going on for 6 years. (ActionScript 2.0 was released with MX 2004) Flash devs have a huge head start in getting comfortable with the language and building a community. Though Flash may not be around forever, it’s here as a viable tool now, so why not use it? Sure, improvements in the intermediary layer (Flash cross-compiler) may lag, but there is substantial proof that you don’t need bleeding edge features to have a very popular or successful platform. (Twitter, Facebook, Hulu)

Flex threading w/ Web Workers

One place where Flash falls short is threading.  Unfortunately it is not possible to create threads using the current version of the Flash Player. (10 point something something at the time of this writing)  What this means is if you have a large dataset you need to parse through, and you simply use an recursive function or iterator, the ActionScript Virtual Machine (AVM from now on) simply enters the loop and nothing else gets processed until this loop is done.  Where this becomes problematic is when it keeps the UI from redrawing.  If the UI becomes unresponsive for a non-trivial amount of time, the user can become frustrated and may stop using your app. Furthermore, if your script takes longer than the predefined (and not really overrideable) amount of time, Flash spits out an execution time limit exceeded error which kills code execution.  And nobody wants any code to be killed. So what we need is a work-around for no threads. Continue reading