Having returned from a whirlwind of conferences and client meetings, I finally carved out a bit of time to work on gTween, my AS3 tweening engine. I’ve tweaked the API, added feature enhancements, fixed a couple of minor bugs, and am happy to announce gTween beta 2.
Category / Flash
Five Year Blogaversary
Time sure flies fast when you’re having fun! Today marks five years of blogging, including two redesigns, 345 posts, 3900 comments, and tens of millions of page views. There have been a lot of changes in the industry during that time: the dark ages of Flash (MX2004), Adobe buying Macromedia, the bitmap capabilities of Flash 8, the introduction (and subsequent reintroduction) of Flex, the release of ActionScript 3, and the emergence of Silverlight as the first serious competitor in the space.
Over this time, I’ve seen my role morph from a relatively unknown freelancer experimenting with Flash, to an active community member, regular conference speaker, and CEO of one of the top ActionScript development teams on the planet (I refuse to be humble when talking about my team – they rock!). We’ve built a diverse range of successful projects for some really stellar clients, ranging from the Fanbase AIR application for Atlantic records, to the v3 components for Adobe, to camera based installations for BBC and Nissan. It really is a testament to Flash as a technology, and the potential of the platform.
I want to take this opportunity to thank the Flash community for being such an awesome and open group of people. I’ve had so many stimulating conversations, made so many great friends, and been inspired in so many ways by this community. I’m excited to see what the next 5 years brings. Hopefully it will include a new design for gskinner.com (egads, is it really over 4 years old?)!
gTween: A New Tweening Engine for AS3 Developers
gTween: Programmatic Tweening for AS3 Developers
There are a lot of great tweening engines out there. Personally, I’m a huge fan of Jack Doyle’s TweenLite (and he’s been incredibly productive adding new features lately). However, none of these libraries exactly fit the needs of me and my team. I wanted an engine that was small, fast, hugely flexible, and built from the ground up for AS3 and developers.
The result was gTween. gTween is a small (4.5kb), fast (1500 instances, 0.5s duration, ~25fps), instance based tweening class, with a huge number of options and capabilities. You can read about core features of gTween below.
This is certainly not an attempt to displace any of the existing tween engines. Rather, it’s simply an attempt to share another option for managing programmatic tweens with the developer community.
For now, I am releasing this as a public beta. It has been loosely tested, but there is so much capability in gTween that I guarantee there are still bugs and edge cases we haven’t addressed. Likewise, I am soliciting input on additions or modifications to the API (including the names of specific properties or methods), so it is possible that the API may change in the future.
ActionScript 3 Notes Are Now Searchable
About a month ago I posted the monster deck of 165 slides from my ActionScript 3 workshop. I’ve had a lot of positive feedback, and have also found myself and my team using it as a quick AS3 reference.
The one thing that was holding it back from being a really useful reference was the need to click through every slide to find what you were looking for.
To address that, I added the ability to search for keywords by using the TextSnapshot object. I had never used TextSnapshot before, but it was quite easy to add keyword searching without modifying my slide deck, which is effectively just a timeline with static text fields on it. It works fairly well, except for a number of bugs with it selecting the found text. For example, you’ll notice it does not highlight text in the code samples. I’m going to try to pin these issues down, and then post an article on using TextSnapshot, along with a handy class for doing timeline searches like the one in my slide deck.
You can find the slides on my talks page at gskinner.com/talks/.
Additional Information on Loader.unloadAndStop
Following my post yesterday about the addition of Loader.unloadAndStop to the Flash Player 10 API, I chatted with Werner Sharp, who is one of the Adobe engineers that worked on the feature (and an all round good guy). Following that discussion, I thought it would be helpful to post a summary of what I know about it, and disseminate some of the information Werner provided.
The unloadAndStop method was added in response to challenges ActionScript developers were facing with halting loaded SWF content, and removing it from memory. These issues were detailed in an article I posted in early April titled “Failure to Unload: Flash Player 9’s Dirty Secret“.
This API addition is not a magic bullet for solving all of the listed problems. What it does do, is attempt to prepare the loaded content for collection, and then hint to the Garbage Collector that it should initiate a collection pass. You can prevent the latter by passing false as the first parameter. It is still easy to get a SWF stuck in memory, but it is much harder to do accidentally.
unloadAndStop in Flash Player 10
Adobe has announced the addition of the new Loader.unloadAndStop() method for Flash Player 10. Here is the description from the beta 2 release notes:
unloadAndStop â This new ActionScript 3.0 API adds unload functionality similar to the unload behavior in ActionScript 2.0. After calling unloadAndStop on loaded content it will be immediately removed stopping all audio, removing eventListeners, and becoming inaccessible through ActionScript.
This new API addresses some of the issues I raised in my article “Failure to Unload: Flash Player 9’s Dirty Secret“. It doesn’t enable content sandboxing, or provide a complete mechanism for explicit unloading, but it does make it much simpler to free a loaded SWF for garbage collection. It’s still possible to prevent a SWF from being unloaded, but it’s much more difficult to do by accident.
Kudos to the player team for putting this in. If you’re concerned about this topic, please help Adobe out by testing this feature and reporting any problems.
Update: You can find more details on the Loader.unloadAndStop feature in my article “Additional Information on Loader.unloadAndStop“.
Source Code Licenses and Flash/Flex
Source Code Licenses
I think there is a critical lack of understanding about the implications of different source code licenses in the Flash and Flex world. As my company has grown, and we have tackled more critical projects for larger clients, I have had to educate myself and my team on this topic.
I think this is a hugely important topic, so I’ve devoted quite a lot of time and energy to research and synthesize information on some of the most popular source code licenses being used in the Flash community today. I would also encourage you to spread this information around, either by linking to this article from your blog, or by sharing its contents with your colleagues. Hopefully it helps developers sharing their code to choose appropriate licenses (I’m getting sick of seeing LGPL source code), and also help the community to use shared source code legally and appropriately.
While I have worked hard to research everything in this article, I am not a lawyer, or an expert on this topic, so I make no claims that it is accurate or correct. It is also written from the perspective of someone who releases free code, and runs a service oriented development shop. Implications may vary for product development.
Below you will find an overview of some of the most common open source licenses. I have tried to list them in order from most restrictive to most permissive.
Programatically Drawing Trees With Recursion
I get asked a lot of questions about my tree experiments, such as sakura and interactive elm. I thought I would write up a simple explanation to point people in the right direction.
The easiest place to start is with recursion. Trees are beautiful examples of recursion in the natural world. Recursion is a deep and very important topic, but for our purposes can be simplified to the idea of code calling itself. In the example below, each time you click the stage, all of the “active” (outermost) branches call code to draw two more branches at their ends, the next time you click, those new branches call the same code. Move your mouse around to vary the angle of all of the branches. As an aside, this example also has an interesting “emergent” property of drawing hexagons (try moving your mouse to the bottom when all of the branches are drawn).