Category Archives: Flash

A look at the architecture changes in Feathers 3.0.0

Over three years ago, I released Feathers 1.0, targeting Starling 1.3. Today, I release Feathers 3.0 targeting Starling 2. It’s been an amazing experience to work hard and improve an open source project every day with the enthusiastic support of both Adobe and the wonderful Starling community.

As a new major release, Feathers 3.0 gave me the opportunity to re-imagine part of the Feathers architecture, based on feedback from developers who use Feathers in their apps and from my own experiences building new components. Let me point out a few of those architecture changes and the reasons why I made them.

Shared Constants

Way back in 1.0, I should have moved shared constants into their own classes. Instead, with each new version of Feathers, duplicate constants like HORIZONTAL_ALIGN_LEFT, SCROLL_POLICY_ON, and others repeatedly appeared throughout the Feathers codebase. I now realize that a single place to find HorizontalAlign.LEFT and ScrollPolicy.ON would have been better, and this is one of the things I cleaned up in Feathers 3.0.

When I started developing these components, I defined constants on the classes that used them because it seemed very convenient. If you needed to use a constant with the Slider class, you’d find it… on the Slider class! At the time, Feathers didn’t use many subclasses, and it had only a handful of components and layouts. I didn’t fully realize that defining constants like this wouldn’t scale very well as Feathers grew much larger over time.

By the time I started developing Feathers 2.0, I got frustrated as I saw myself duplicating constants in subclasses (so that developers wouldn’t need to know the inheritance hierarchy to find them), and I sometimes forgot to do it when new constants were added to the base classes. It was clear that things were getting a little messy in ways that I did not foresee. However, I worried that making this change would be too disruptive at the time, with the big theme changes that were included in Feathers 2.0, so the constants stayed as-is.

As I started working on Feathers 3.0 this year, I decided that this change finally needed to happen. It would indeed be disruptive, but the duplication and its side effects were getting out of hand. Using shared constant classes like VerticalAlign, RelativePosition, and Direction would be way easier for me to maintain going forward with a smaller learning curve and fewer bugs. I really wish I had made this change three years ago, but if I had waited for everything to be perfect, 1.0 would never have been released.

I’ve done my best to ease the pain of this migration. The old constants still exist, and they will not be removed until at least 18 months from now or until the next major version (whichever takes longer). Take your time switching over, and don’t feel like it must happen immediately when you upgrade. Be sure to try out the regular expressions in the Feathers 3.0 Migration Guide. You can use them with your editor’s Find/Replace feature to quickly swap out the old constants with the new. I used them on the example themes, and it was so much faster than doing the replacements manually.

saveMeasurements()

When a Feathers component’s width or height is not set explicitly, it needs to calculate appropriate dimensions during validation. Usually, this calculation is based on the dimensions of its skins and sub-components. Custom component developers will be familiar with the old setSizeInternal() method that was used to commit the calculated dimensions. This method has been deprecated and replaced with one named saveMeasurements() that accepts width and height the same as before, but also minimum dimensions as well.

Previously, the minWidth and minHeight properties defaulted to 0, and you could change them manually. However, in many layouts, the minimum dimensions may be used as a fallback. For instance, in a VerticalLayout where percentWidth is specified on children, their minWidth values of those children may be used as a fallback when the parent container’s width is not set. In previous versions, 0 would be used, which wasn’t always ideal.

Now, all core Feathers components calculate their minWidth and minHeight when needed. Custom component developers are encouraged to do the same.

As a bonus, this change helped me discover me some places where I could optimize Feathers by avoiding validation when it wasn’t necessary. This leaves Feathers in a better place for new, more advanced components that may be coming in future versions.

feathers-compat

As Feathers evolves, some APIs are inevitably deprecated and, eventually, removed. For instance, Feathers 3.0 includes a new class named ImageSkin that replaces an “advanced” class named SmartDisplayObjectValueSelector that was more cumbersome to use. Both optimize skinning by reusing the same display object with multiple textures, but ImageSKin does it in a better way.

It would be better if developers did not use SmartDisplayObjectValueSelector anymore, and I’d like to remove it from Feathers. However, existing code doesn’t rewrite itself, so developers may want to continue using this class for a while and still benefit from the bug fixes in Feathers 3.0. That’s where feathers-compat comes into play. Classes like SmartDisplayObjectValueSelector can be moved into feathers-compat so that they’re still available, if needed.

If you’re upgrading an app built with an earlier version of Feathers, and you find that some classes are missing, be sure to check if they’re included in feathers-compat.

New components on the way!

Feathers now has a stronger foundation that has been re-enforced with these architecture improvements (not just in Feathers, but in Starling too!). Starting with version 3.1 and beyond, I can start adding new and more advanced components. Stay tuned for news on what I have planned!

Also, thank you again to the community for your support, bug reports, and feedback. With your help, Feathers is better than it ever could have been if I were developing it alone. Happy coding!

Feathers 1.3.0

Today, I’m very happy to present Feathers 1.3.0, the latest stable release of the open source user interface components for Starling Framework. This version packs a punch with a couple of much-anticipated new features. I also dedicated many days to filling in many gaps and annoyances here and there, so get ready for the most stable and mature release of Feathers yet.

percent-layout-smaller

First up, we have one feature that many developers have been waiting for: percent-based dimensions in layouts. Fluid layouts have been possible since Feathers 1.1.0, with the introduction of AnchorLayout, but I know that many developers prefer percentages instead. HorizontalLayout, VerticalLayout, and AnchorLayout all support adding layout data to components to specify percent width and height values.

Flash Text Engine (FTE) provides advanced text layout capabilities that the traditional Flash TextField can never achieve, with more low-level control over text-metrics, formatting, and bi-directional text. Feathers 1.3.0 adds a new text renderer named TextBlockTextRenderer that exposes many FTE APIs.

Feathers 1.3.0 includes many other smaller enhancements. Among them include support for Mac HiDPI resolutions, better support for multiple desktop windows with different Starling instances, and the example themes are now built as SWCs to allow anyone to easily drop them into a new project. That’s not all, of course. For complete details about what’s new in Feathers 1.3.0, please read the release notes. Now, go download Feathers 1.3.0, and enjoy!

Where to download old versions of the Adobe Flex SDK

If you’re maintaining a legacy project that will not compile or run correctly with the latest Apache Flex SDK, you may prefer to avoid overhauling the entire project simply to make some minor bug fixes. If you’d rather continue using the same Flex SDK that project was originally developed with, you’ll be asking yourself, “Where can I find old builds of the Adobe Flex SDK?” They’re not exactly easy to find.

Adobe used to helpfully provide archives of Flash Player and AIR SDK versions on their website. Unfortunately, those are no longer available. Even when they were, I had some difficulty finding a similar archive for the Adobe Flex SDK. The most promising resource for Flex was the SourceForge Flex SDK Downloads page, but all of the links seem to be dead now. Many pointed to a strange FlexLicense.swf on blogs.adobe.com that my web browser asked me to download.

After searching for a while, I could only find direct links to a few specific versions of the Adobe Flex SDK, but most versions remained seemingly lost. Eventually, I returned to that weird FlexLicense.swf, and I tried running it with the standalone Flash Player. Someone else posted that they couldn’t get it to run at all after downloading it (which is why I didn’t try it earlier), but it actually worked for me, and I took the time to select each version of the Adobe Flex SDK that it listed, and I was able to open a valid URL in my browser for every single one of them.

In order to keep my fellow developers from going through the same hassle, I compiled the following list of legacy Adobe Flex SDK versions that are still available on Adobe’s servers (at the time of this writing):

Hopefully, that helps another Flex developer with some legacy code to maintain. Additionally, let’s hope that Adobe doesn’t take these down any time soon! If you think you might need any of these versions in the future, you should download them immediately and keep a personal archive of old Flash, AIR, and Flex content.