What does [Bindable] mean in ActionScript?

I’ve been hanging out a bit lately over at Stack Overflow answering questions, earning badges, etc.  I love to find older questions that have incomplete answers or answers that could be expounded upon.   Here is the latest question I wrote an answer for.

What does [Bindable] mean in ActionScript?

You can either read my answer here or over on Stack Overflow.


[Bindable] is a one of several meta tags that you can use in flex ActionScript code. It can be applied to properties, or methods that are marked in any scope. It cannot be used with static class members.

The key to useing the [Bindable] meta tag is understanding what is going on under the hood when you use it. Essentially using data binding is a type of short hand for adding event listeners and dispatching events.

There are two basic forms of the [Bindable] tag. The first is just [Bindable] followed by a var/property declaration. The Second is [Bindable(event="eventname")] followed by either a var/property declaration, a function/method declaration or one half of a getter/setter declaration.

I’ll explain the longer notation first since the other builds on the same concept but with even more short hand.

Continue reading

Leave a Comment

Filed under AIR (Adobe Integrated Runtime), Flash, Flex, Programming, StackOverflow, Uncategorized

DRY or DIE

Am I the only one that find’s it ironic that there are TWO terms for this same concept…

http://en.wikipedia.org/wiki/Don’t_repeat_yourself

Leave a Comment

Filed under Programming

laptop “plugged in, not charging”

Oh crap! your laptop says “plugged in not charging” when you hover over the battery icon.  It turns out that you probably do not have anything to worry about. Continue reading

2 Comments

Filed under Technology

Migrating from Subversive to Subclipse in eclipse

I recently decided to migrate from Subversive to Subclipse  as my SVN plugin for FlashBuilder (eclipse)  I found it to be a very easy process.   I found the video Migrating from Subversive to Subclipse in Servoy 5 to be especially useful.

For those people like myself that didn’t know…. Servoy Developer is apparently an eclipse based  IDE  / plug-in, that is not unlike FlashBuilder.   (http://en.wikipedia.org/wiki/Servoy)

Since Servoy is eclipse and FlashBuilder is eclipse the process is almost exactly the same.  The only difference being that instead of the Servoy Solution explorer you use the Project Explorer.

If you are curious as to why I decided to migrate to Subclipse; it mostly has to do with the failing of Subversive to properly integrate refactoring changes (moves) into the SVN repository.   I use the eclipse automated refactoring frequently in the initial stages of a projects as I play with different package structures.  The Subversive method of handling a move is to post two  distinct SVN actions a delete and an add.  This looses any history attachment and is not ‘proper’ in my opinion.  (You can get around this by doing the SVN move outside of eclipse and then doing the refactor, but IMO this is just lame. )   I haven’t tried it yet but apparently Subclipse integrates closer to eclipse so that it will properly handle refactoring.  (Most people suggest that you do an update before and commit after the re-factor. )

When you look at the way each of these came about it makes sense.  Subversive was written by eclipse people to connect to SVN while Subclipse was written from the SVN perspective.  If you are primarily concerned with SVN then move is a really important function (to maintain history)  where as if you are coming at it from the IDE side of things it might not be as important and the easier delete/add would be sufficient.

I am in no way putting down Subversive, it is a great tool, and works well particularly if you don’t plan on doing any refactoring, then again who “plans” on refactoring

1 Comment

Filed under Adobe, AIR (Adobe Integrated Runtime), eclipse, Flash, Flex

Chaining bindable properties in ActionScript using anonymous functions.

Imagine that you have an object that exposes a public property that is bindable.   Now imagine you have a second object that uses this bindable property to provide it’s own bindable property.  How do you simply and easily bind a UI element to this property on the second object, so that when the first object’s property updates, the UI updates.

A couple of months ago I was working on a project using the ExtJS framework in JavaScript. I came to appreciate one particular feature in JavaScript that is commonly used there and while somewhat available in ActionScript is not as commonly used here in the AS world.  This is the use of anonymous functions and method injection.  Now back in the days of pre OO, AS2  Anonymous functions actually were rather common. However with the advent of AS3 and classes no longer being dynamic by default the use of things like anonymous functions and method injection has really gone away.  With the move toward a real OO language it can be argued that this is a good thing.  I’m never one to strictly stick with a prescribed architecture or pattern, and this include things like these that might make some OO purists wince.  However living in the real world I have to go with what works and makes my life easier. Sometimes that means crossing the street where there is not a crosswalk. Continue reading

Leave a Comment

Filed under Adobe, AIR (Adobe Integrated Runtime), Flash, Flex

Flex Events and FlashBuilder Event Meta Tags

As so many of these things go I’m sure this information is out there somewhere… I’ve even probably read it.   For whatever reason it didn’t “click” for me.   I figured out how to effectively leverage the Flex Event meta tags in FlexBuilder.

Now I’m not going to get into why you should use an event architecture… there are lots of articles on that and I’m sure by this time most developers are using events.  I will lay out my preference on how to set up events.

So if you are not familiar with it there is this neat little meta tag for attaching events to the a dispatcher.  The tag looks something like this:


[Event(name="someEventName",type="com.some.thing.fooEvent")]

Now as meta tags go this one is NOT required by the compiler (as opposed to say [Bindable] ) so it is completely optional. However if you are using FlashBuilder let me tell you what magic happens when you do use it correctly.

Continue reading

Leave a Comment

Filed under Adobe, AIR (Adobe Integrated Runtime), Flash, Flex

“content is not allowed in prolog” using Picasa/Google API

Ok the problem….   getting “content is not allowed in prolog” when trying to create an album on Picasa via the Picasa/Google API  from inside of a Flex client.

From a bit of googleing   I was able to determine that the problem was basically that my atom-xml request content was not formed properly.  In particular that the xml content was preceded in the request by “something”    Using Charles I was able to easily determine that the offending piece of data was my oauth signature and other oauth bits.  The problem could best be summed up as the following: Continue reading

3 Comments

Filed under Flash, Flex

Fujitsu Tablet Button issue on Windows 7 x64

So I’ve been having strange issues with my Fujitsu tablet.   The buttons on the bezel stopped working for no apparent reason. (but I now suspect was due to a system update) I started getting the following error when I would try to rotate the screen with the rotate button.

“SetSlate returned error. FjSetSlt is exiting”

After some looking around at  tabletpcreview.com and some trial and error I found a solution.

Continue reading

1 Comment

Filed under Software, Technology, Windows 7

Flex/Flash Builder localization configuration

In addition to the localization strings that you can add, the underlying Flex framework needs to be localized in order to format numbers, dates, currency etc.    (think of the days of the week on a calendar control, or the decimal separator for currency)

Adobe makes available but does not include by default many framework localization resource bundles in the form of collections of property files. These files provide localization settings for the Flex framework components including; number and currency formats, month and day names, internal error messages etc…

To localize the framework components it is necessary to download these property files and recompile the framework resource bundle library (framework_rb.swc) for each locale. (see attachment) These libraries can then be compiled into our localization files.

Setting up basic standard localization for the Flex environment.

This post does not cover how to apply localization to your application when I have a chance I’ll post one on how to do that. Also, this information is made regarding the Flex SDK 3.4 but should apply with minor modifications to most other versions of the SDK. These steps should apply to the command line or any version of Flex/Flash Builder with minor variation.

For reference, I am using Flash Builder 4 installed in the default install directory, with the 3.4.0.9271 SDK loaded as an alternative SDK.
The process to setup basic Flex localization can be broken into the following steps.

  1. Create the localization component libraries in the SDK
  2. Localize the component librariesfor the SDK
  3. Recompile the component libraries for the SDK

Continue reading

1 Comment

Filed under Uncategorized

Getting Flex UI components all the same width or height

I’ve been doing a lot of work using localization lately and as part of this I’ve had to consider the fact that words in one language are not usually the same lengths as their translations in another.  Because of this I’ve increasingly been relying on the size to fit content ability of labels, buttons etc. in side of Flex.   Now that is all well and good except for when you want a set of buttons to all be the same width or some labels and controls to all line up and be the same width.    You need some way of telling all of the components in the set to re-size to the largest size of any of the components.  I’ve written a very little function to do just that. Continue reading

Leave a Comment

Filed under Adobe, AIR (Adobe Integrated Runtime), Flash, Flex