Archive for the ‘Flex’ Category

Creating a custom logging target

Tuesday, March 3rd, 2009

I figured since I’m on the subject I would go ahead and create a custom logging target for sugarcookie and a companion logging app – LumberJack. This particular target sends log message objects over a LocalConnection to a basic logging console that will output them into a text field. Being able to see trace statements from a site running on any server, on any network can really help when debugging your application that is deployed somewhere besides your localhost. There are other tools out there that do this like RED|Bug, Xray or even FlashTracer, but this one is extremely simple and includes all the code so you can modify it to suit your needs.

First let’s create the new log target class by extending the existing mx.logging.targets.LineFormattedTarget Flex class. Then override the logEvent method with the functionality desired and you’re in business. Here’s how I did it:
(more…)

Removing trace() statements from Flex applications

Thursday, February 26th, 2009

Removing trace() from your code is a great way to optimize it and improve overall performance. This is easy enough to do in Flash by checking “Omit trace actions” in the Publish Settings window, but in Flex there is no such setting or compiler argument that I’ve seen. No worries, there is a solution.
(more…)

Style your Flex applications with ease

Wednesday, January 14th, 2009

The Flex Style Exporter is one of the best tools I’ve seen yet that support Flex development. Styles can be visually tricky, especially when your a developer styling your app on the fly. Colors don’t always work out the way you expect them to. This tool really makes it easy and fun to get your styling just right. I don’t know who wrote this, but I would like to shake their hand.

Flex 2 Style Exporter
Flex 3 Style Exporter

Handy Flex compiler arguments

Thursday, January 8th, 2009

Descriptions are from the Adobe Flex Help that can be accessed in Eclipse under Help->Help Contents.

The topic that this information can be found under is:
Building and Deploying Flex Applications > Building Flex Applications > Using the Flex Compilers > Using the application compiler

-defaults-css-url path-to-css-file/default.css
For ActionScript projects that use the sugarcookie AppLoader class.

-use-network=true|false
To allow local access

-benchmark=true|false
Prints detailed compile times to the standard output.

-default-frame-rate int
Sets the application’s frame rate.

-keep-generated-actionscript=true|false
Determines whether to keep the generated ActionScript class files.

-optimize=true|false
This one should always be set to true.
Enables the ActionScript optimizer. This optimizer reduces file size and increases performance by optimizing the SWF file’s bytecode.

For a complete list for all versions of Flex compilers check out this site. It also has some other good info on more advanced topics like Flex Internals.

Getting rid of the Flex preloader

Friday, November 14th, 2008

At some point in your Flex career you have probably wanted to get rid of the generic Flex preloader that you always see when your application initially loads. It’s an easy way for people to spot a Flex app and quite frankly is a lack of attention to detail. If your application is fairly light weight there really is no need for it and it’s super easy to make a custom one. Luckily the answer is simple. All you have to do is set the usePreloader attribute to false.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" usePreloader="false">
</mx:Application>

FlashVars with Flex

Tuesday, September 16th, 2008

The switch from Flash to Flex can sometimes be frustrating when trying to do the things that we took for granite in Flash. FlashVars were so easy because they were automatically available on the root timeline object in AS2 . Well, in Flex they are still automatically made available to you, just not in a place that you might expect. The mxml code example will show how to test for FlashVars.
(more…)