Handling a common event like a double click is not so simple as we may assume when it comes to Flex programming.
In fact there are several critical aspects related to this event, first of all we have to set the attribute doubleClickEnabled to true in order to make our components double clickable, and this sounds pretty silly to me. Why should I enable an object to receive an event which is so common and “natural”? This is incoherent from a software design perspective end totally unexpected by the user. Anyway this is not a real problem, because once we know about it we have just to use a setter, but double click is somehow buggy in the framework and its broadcasting can be blocked mysteriously when using certain components. I faced this issue by trying to handle a double click on a DataGrid which makes use of custom item renderers and I tested that by double clicking on the “special cells” (those rendered by my own renderers) the MouseEvent.DOUBLE_CLICK is not dispatched/cacthed. To solve the problem I had to draw an invisible rectangle using the underlying Actionscript graphics API! This is my workaround:
this.graphics.drawRect(0, 0, this.parent.width, this.parent.height);
Finally, it seems that double click is completely ignored by Firefox 3.6 on Mac OS X, but fortunately this seems to been fixed in the last release (3.6.3)
Today, I released my component “ImageNavigator”, you can see it here and download source code. I’m pretty satisfied about it, but it needs some little improvements and I’ve got some ideas to extend its features… so don’t consider it as the final version :P
I just faced the terrible nightmare of “Type was not found or was not a compile-time constant” error (Flex Builder) and I lost several time to figure out what the problem was.
I realized that I was using the same name for MXML Application file which was already used by a class inside one of my packages. So, by renaming the file I solved the problem, but I was not completely satisfied and I looked for a way to avoid the error mantaining the same file/class name. Initially I tried to use namespaces, but as the reference says: “Applying a namespace means placing a definition into a namespace. Definitions that can be placed into namespaces include functions, variables, and constants (you cannot place a class into a custom namespace)”. I finally solved by renaming class references inside my package with the full qualified name (from MyClass to com.mysite.foo.MyClass)
Flex 4 beta (codename: Gumbo) has been released, I just finished to read about the new major release. These are the main news:
- Improved compiler performance
- New skinning and component architecture (named Spark)
- Added suppurt to FXG (learn more about FXG)
- New states model
- ASDoc tool has been improved and is now possible to use ASDoc tags in mxml documents
- CSS has been improved to support descendant and id selectors (finally the previous missing “cascading part” of CSS has been provided!)
- Backwards compatibility with Flex 3
The new sdk is available on Adobe Labs
More about Gumbo here:
An Introduction to the Gumbo Component Architecture (by Deepa Subramaniam)
What’s new in Flex 4 SDK beta (by Matt Chotin)
Differences between Flex 3 and Flex 4 (by Joan Lafferty)
I’m preparing for the Adobe Flex 3 + AIR certification and I would like to share two AIR applications which I’m using to study an test my Flex knowledge.
The first is pretty famous, so maybe you already know it: Tour The Flex.
It provides hundreds examples of all components available in the framework and includes Adobe reference.
The second is a real helpful app (which I discovered through Twitter), because it consist in an exam simulator (flex 3 + air). Is possible to choose between 8 different test, once a test begins a timer will show you the remaining time and at the end of test the reached score will be showed. Wrongs questions will be explained and you’ll be pointed to Adobe reference for clarifications.
The (free!) application is available here: http://software.pxldesigns.com/attest