You want your Image to behave like a Button with a hand-cursor?
Set buttonMode and useHandCursor to “true” and that’s it:
[Bindable] [Embed(source="/path/to/my/image.png")] private var myIcon:Class; private function handleImageClick(event:Event):void { // your click handler code } <mx:Image source="{myIcon}" useHandCursor="true" buttonMode="true" click="handleImageClick(event)" />
Interested in what the Flex team plans for states in Flex? They show what they are planning on the Open Source Wiki. I came across this via the Fatara Systems blog and it is also covered by Ted Patrick and InsideRIA. The inline state syntax looks a lot easier and it is very nice to see how open the Flex team works on the new features.
When you started with a Flex project for the browser and you decide to switch to AIR or vice versa you have to change the Flex Builder project settings.
In the application MXML you have to switch the root node from Application to WindowedApplication
In the .actionScriptProperties you have to change useApolloConfig=”true/false”.
For AIR projects the .project file needs the apollonature meaning <nature>com.adobe.flexbuilder.apollo.apollonature</nature> as the first of the three natures (before flexnature and actionscriptnature). Sometimes I had a refresh problem when I opened the project settings (every entry showed up twice) after editing these files so better close and re-open the project, re-build the project and the switch should be done.
- Debug information with the good old “trace” is around since ActionScript 1 and has been heavily used as this was a key for debugging a Flash application. In AS3 trace has lost its importance as Flash Player 9 supports Runtime Exceptions and the Flex Builder debugger supports breakpoints so you can have a look at all variables where and when you want.
Instead of “trace” I recommend to use the logging API of the Flex framework. To have the output also on the Console window add the TraceTarget to your main application MXML:
<mx:TraceTarget fieldSeparator="->" includeCategory="true" includeLevel="true" includeTime="true" />The nice thing you get when you add the TraceTarget is that the internal logs of the Flex framework also show up. If you use for instance HTTPService and load something this shows up in your console:
“[SWF] Users:soenkerohde:Documents:workspace:Example:bin-debug:Example.swf - 191,465 bytes after decompression
19:23:22.843->[INFO]->mx.messaging.Producer->’54A8E65E-90C9-3D70-66F6-BA1BEE5842F9′ producer set destination to ‘DefaultHTTP’.
19:23:22.956->[INFO]->mx.messaging.Channel->’direct_http_channel’ channel endpoint set to http:
19:23:22.960->[INFO]->mx.messaging.Producer->’54A8E65E-90C9-3D70-66F6-BA1BEE5842F9′ producer sending message ‘33FDE4CB-764A-C757-4FC6-BA1BEECFF0A6′
19:23:22.973->[DEBUG]->mx.messaging.Channel->’direct_http_channel’ channel sending message:
(mx.messaging.messages::HTTPRequestMessage)#0
body = (Object)#1
clientId = (null)
contentType = “application/x-www-form-urlencoded”
destination = “DefaultHTTP”
headers = (Object)#2
httpHeaders = (Object)#3
messageId = “33FDE4CB-764A-C757-4FC6-BA1BEECFF0A6″
method = “GET”
recordHeaders = false
timestamp = 0
timeToLive = 0
url = “http://feeds.feedburner.com/soenkerohde?format=xml”
19:23:22.978->[INFO]->mx.messaging.Producer->’54A8E65E-90C9-3D70-66F6-BA1BEE5842F9′ producer connected.
19:23:23.002->[INFO]->mx.messaging.Producer->’54A8E65E-90C9-3D70-66F6-BA1BEE5842F9′ producer acknowledge of ‘33FDE4CB-764A-C757-4FC6-BA1BEECFF0A6′.
19:23:23.006->[INFO]->mx.rpc.http.HTTPService->Decoding HTTPService response
19:23:23.011->[DEBUG]->mx.rpc.http.HTTPService->Processing HTTPService response message:
(mx.messaging.messages::AcknowledgeMessage)#0
body = “… REMOVED THE CONTENT HERE”
clientId = “DirectHTTPChannel0″
correlationId = “33FDE4CB-764A-C757-4FC6-BA1BEECFF0A6″
destination = “”
headers = (Object)#1
messageId = “6AF8650F-3634-FD0D-FF23-BA1BEEFFCDDB”
timestamp = 0
timeToLive = 0″
As you see this a bunch of information and the brackets in front indicate the level of the logging message which are DEBUG and INFO here. If you are not interested in DEBUG logs at all simply change the level in the TraceTarget to LogEventLevel.INFO.
What you need to log on your own is pretty simple. Just add this to every class (MXML/AS) to define your logger constant:
import mx.logging.Log; import mx.logging.ILogger; private static const logger:ILogger = Log.getLogger("MyCategory");
Now you can use the constant like:
logger.info("this is an info message");
which shows up as: 19:51:47.917->[INFO]->MyCategory->this is an info message
Replace “MyCategory” with a category name. I always use the name of the class. In this case an info message is used but there is also debug, warn, error and fatal to represent the kind of your log message.
InsideRIA posted an article about Flex Builder Enhancements. I am already using the TODO/FIXME Plugin by Dirk Eismann for a long time now which works really cool.
I did not know the Snippets plugin which I now also tried out. The usability is not that straight forward but it also does the job.

If you like to import my snippets.xml which includes a for loop and a bindable getter/setter.
The next Flex UG Hamburg Meeting will be May 19th. Thanks to Sven and Interone for hosting the event this time.

The last meeting was in our Adobe office and now it’s a god opportunity to visit Interone as they have a really nice conference room in the 19th floor. There are no speakers yet but we are sure to find interesting stuff so if you have an idea drop a comment!
A few days ago LCDS ES 2.6 beta was published on Adobe Labs.
“Adobe® LiveCycle® Data Services ES is the server-based technology that streamlines the integration of rich Internet applications (RIAs) with LiveCycle Services, J2EE applications, and business logic. This release aligns with the releases of Adobe Flex® 3 and Adobe Flex Builder™ 3.”
Today the Flex Docs Team came up with a really good article how to build and deploy LiveCycled DataServices ES apps.
In the beginning of March YouTube made a new release of there WebService API:
“We now provide a complete set of (CRUD) capabilities for uploading, managing, searching, and playing back user videos and metadata from the YouTube “cloud,” managed by us. We do all of the hard work of transcoding and hosting and streaming and thumbnailing your videos, and we provide open access to our sizable global audience, enabling you to generate traffic for your site, visibility for your brand, or support for your cause. Meanwhile, we provide full access to our substantial video library, enabling you to attract users and enhance the experience on your site. It’s all free, and it’s available to everyone, starting now. “
I think this a great move by Google and I want to try it out using Flex and AS3.
There is already a YouTube AS3 library (formlery hosted on Adobe Labs) which does not cover the latest features like uploading videos.
Searching for AS3 sample code I had a look at the YouTube API dev page.
The Contributed sample code wiki showed up the ActionScript 3 Wrapper and the AS3 Wrapper.
The first one has a Flash CS3 tutorial and uses the JSON stuff of the Open Source AS3 library corelib. But then I realized that the new features like uploading videos where not covered yet. Then I came to the blog of the author Martin Legris who blogged that he had problems using the new API.
The AS3 Wrapper is a message thread and cares about AS3-AS2 communication and also only about playback if I checked it right so also not the thing I was looking for.
So it looks like there is no open AS3 solution for the new YouTube features yet. Please leave a comment if you know anything else. I hope my next post on this will show a solution. However I hope this post may provide some good links for others who want to start playing with the YouTube API and AS3/Flex.
Another interesting link to follow up is SWFAdress and the YouTube API to allow deeplinking (e.g. start at second 10 instead of the beginning) into videos.
James Ward made a very nice example how to use Dough McCune’s cover flow component with videos hosted on YouTube.
I came across another “white label YouTube“. The startup Reality Digital just got another round funding and their services look very interesting. They use Adobe Premiere Express as online video editing solution like e.g. also the MTV Video Remixer and Photobucket.
Via TechCrunch I explored Magnify. They created VidyUp which uses the new YouTube API and are claimed the first who use the new YouTube API.
So again: If you see something in AS3 open source around the new API please drop a comment!
Since Flash Player 9.0.60 aka Moviestar got the new feature Flash Player Cache:
“The Flash Player cache enables common components, such as the Flex Framework, to be cached locally and then used by any SWF from any domain. Use of the Flash Player cache can significantly reduce SWF file sizes and speed application download times.”
Flex 3 uses this new Flash Player feature to cache Flex core framework classes. Ted Patrick posted an overview of this feature.
I think this is really a great feature as reducing the filesize/download size of Flex apps is really a great success factor as the user experience really improves with shorter download time. Yesterday Adobe Developer Connection released an article about “Improving Flex application performance using the Flash Player Cache“.
The author Darrell Loverin is in the Flex SDK team and developed the new RSL features in the Flex SDK compiler. The article is a great read and explains all in detail. What you really have to change to use the Flex framework as RSLs is not that big deal.
You compile using Flex Builder
Open project properties, go to Flex Build Path, switch to Library Path and change Framework linkage to Runtimeshared library (RSL).

Now it depends on the configuration of the flex-config.xml located in your sdk_install_dir/frameworks directory. There is the node runtime-shared-library-path which is sets the framework settings. If you also want to include datavisiulization and rpc simply duplicate the node and adjust the values. You should see a lower filesize of your compiled swf. To see the final filesize add the compiler argument debug=false to have no debug info in your swf.
You compile using Ant
I you compile with Ant I assume you use the Flex Ant Tasks. Within the mxmlc-tag add the attribute static-rsls=false and add the runtime shared libraries you like to use. Further you have to copy the libraries (swz and swf) from your sdk_install_dir/frameworks/rsls to your output directory. Check my AntExample build.xml.
You compile with command line
Specifiying RSLs on the command line is described in the article.
Last Friday we had the first usergroup meeting in the Adobe Office. This was the first larger organized meeting and I think a great success. Jens managed to invite Cliff Hall, the man behind PureMVC.
“PureMVC is a lightweight framework for creating applications based upon the classic Model-View-Controller design meta-pattern.”
Cliff did an awesome job explaining MVC and his approach with PureMVC in a very understandable way.
PureMVC does not only want to be an AS3/Flex framework but is ported to many different platforms like AS2, AS3, C#, ColdFusion, Java, Perl, PHP, Python and Ruby.
So the goal behind is that when you e.g. develop an app in AS3 with PureMVC it should not be that great effort to port this to e.g. C# or Ruby. The price you pay is that you don’t use platform specific features. In Flex for instance there is the data binding feature which PureMVC does not use at all. Instead it works with notifications which also would work in let’s say Java or Perl.
I have not used PureMVC for any project yet and am still satisfied using Cairngorm as the microarchitecture for my Flex projects. However, Cliff made me so curious that I will try PureMVC for my next playground project to get a deeper look into the framework.
Jens also registered the new domain flexughh.de for the Hamburg usergroup.
Here you find the slides of the presentations of Cliff and Jens.
On the PureMVC AS3 site you can also find utility classes like e.g. the Desktop Citizen for AIR which manages remembering the size, position and state of an AIR window like other desktop apps do.








