Google analytics in Flex 4

Posted in Flash Builder, Flex, Tools on February 5th, 2010 by Niels – 1 Comment

Today I started development of an application done with Flex 4, and needed to include Google analytics. This turned out to be a problem:

The initialization of the FlexTracker in the gaForFlash package done by google initializes like this:

1
2
var appclass:Object = getDefinitionByName( "mx.core::Application" );
_app = appclass.application;

This does not play too well with the Flex 4 framework, which has changed the signature to:

1
FlexGlobals.topLevelApplication

The change was easy though:
I checked out the latest source from google and did the following change to the constructor:

1
2
3
public function FlexTracker()
{
super();
1
_tracker = new TrackerCache();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* note:
to avoid to create a hard reference to Application.application
we get the class by reflection
*/

var appclass:Object = getDefinitionByName( "mx.core::Application" );
if ( appclass.application != null )
{
_app = appclass.application;
}
/* Flex 4:
Use of Appliction.application has been replaced by
FlexGlobals.topLevelApplication
this will make tracking in flex 4 possible
*/

else
{
appclass = getDefinitionByName( "mx.core::FlexGlobals" );
_app = appclass.topLevelApplication
}
 _app.addEventListener( Event.ADDED_TO_STAGE, _factory );

So now it works!

The compiled version of the above can be downloaded here. -happy coding

Getting up to speed in Flash Builder 4 and Flex 4

Posted in Adobe, Flash Builder, Flex on January 31st, 2010 by Niels – Be the first to comment

Adobe has a while back posted this series of tutorials to get yourself up to speed with the latest Flex framework.

You can check it out here

Apparently you are able to become a master in one week :)

Happy coding!!

The result of the above can be downloaded as a swc here. – happy coding! (and tracking)

Optimizing Png’s

Posted in Development, Tools on December 16th, 2009 by Niels – Be the first to comment

A good friend and colleague of mine, Paw Suddergaard, pointed me towards PngGauntlet for optimizing png’s.

I just gave it a shot and saved the users for around 100k download on one large png. This is an interesting tool to put in your toolbox for the optimization part of your development cycle.

Chrome cookies and Flex

Posted in Development, Flash, Flash Builder, Flex, Tools on December 16th, 2009 by Niels – Be the first to comment

I recently made a Flex application that stores information in regular cookies. I found this util that enables you to set cookies from within Flex by injecting Java Script into the wrapper. You can get it here.

I then proceeded to test my application, and everything was smooth sailing. That is, until I switched primary browser from FF to Chrome. Then all of a sudden my cookies was not working in my local test environment, but fine in the deployed solution.

The root cause of this I found out is a deliberate decision from Google to not enable cookies from local files. I did not bother to read why that is, but found their solution to the problem: Include the following sting as a parameter to chrome: –enable-file-cookies

I hope I saved you some time :)

Improving quality of your work

Posted in Adobe, Development, Flex, Tools on December 10th, 2009 by Niels – Be the first to comment

In these days of rapid development, and increasingly complex RIA applications, quality of code is more important than ever. Being complex applications, means that tracking down and fixing bugs in your system will be increasingly time consuming.

There are a lot of ways to help your self to write better quality code. One of such is to select a framework and adhere to the rules of that framework, thereby ensuring that your code is consistent throughout the entire application and equally important,  consistent throughout the entire development team. I will not go in to the whole framework debate in this post, just quickly mention that for my part the PureMVC framwork has proven tedious and complicated to use in a consistent fashion..

Another measure you can take, to ensure higher code quality is code review. This technique ensures that no sloppy code enters production. This however can be a very tedious task if performed manually. It has also dawned on me as being (at least for most part of your day to day coding scenarios) somewhat stupid, as the quality of the code should not be up for subjective judgment rather analyzed by machines, again to ensure quality and to have unbiased opinions on the quality.

Here at Hello, we have been trying the FlexPMD for hudson/ teamcity to render some form of quality output when the CI process is run. This gives us measurables for the current state of the code at every build (triggered in our case by SVN commits), and reduces the code-review to looking at a list of issues detected by the FlexPMD.

Now FlexPMD has been released as an eclipse plugin. This is GREAT news! It means, that every developer can get feedback on every build about the state of the code he is currently working on. The impact is IMHO much greater than having the feedback posted on a results site for a given CI server, as it tends to be corrected faster when the feedback is provided in context to what you are doing. Even more important is to have this kind of feedback available to you very early in the development process,  so that errors done at the early state doesn’t multiply in the system during development.

So without further ado: The plugin can be downloaded from adobe here.

LCDS3 Experiments tips and tricks

Posted in Adobe, Flash Builder on November 5th, 2009 by Niels – Be the first to comment

I’ve been working a bit with LCDS, and have had a few issues that I would like to share, so that you may save some of the time I’ve wasted goofing around ;)

First off. If you want to run you LCDS on a windows machine, but as a service ( meaning that the server keeps running after you log off the system; the case for server setups ) there is a service.bat file in the \lcds\tomcat\bin, you can use to install a LCDS service on your system. Usage is: “service install [service name]” where you obviously replace the [service name] with a name of your choosing.

That service can then be started in the service config, or just set to automatic.

Second. If you wish to develop against a server other than localhost, you just type in that server info, in the initial project server configuration page.

In my case an example is:

This however requires for you to have set sharing for the folder containing the project on the particular server.

Secondly, in order for flash builder to be able to publish the datamodel to your server you need to set the JDBC Datasource in the general properties for the model. In my case the string is: java:/comp/env/jdbc/jukebox. The connection string can be found here:

I hope this helps those of you who wish to do development of LCDS applications on another machine than localhost.

Guerrilla Marketing

Posted in Clever, Design on October 27th, 2009 by Niels – Be the first to comment

Alex Cassoni did a nice Ignite at our monday meeting yesterday. It’s definitively worth the 5 minute watch:

Adobe MAX

Posted in Adobe, Flash Builder on October 12th, 2009 by Niels – Be the first to comment

Adobe posted all sessions from MAX here. I just saw this video, and I highly recommend it to anyone developing Flex in the all new Flash Builder

Tour de flex now with flash builder examples

Posted in Adobe, Applications, Flash Builder on September 9th, 2009 by Niels – Be the first to comment

Tour de Flex has been updated again to contain Flash Builder 4 examples.

Check it out here.

Via Mihai Corlan

Next on my todo

Posted in Random fill on August 19th, 2009 by Niels – Be the first to comment

Today I allocated my self some time to look into things on my ever growing todo list. I’ve been lookin at the Spicelabs Flex framework called Parsley. It looks promising, and several people state, that it is very similar to Swiz, so that developers coming from that framework should be quick to catch up!
Information about the framework can be found here.

I will be finding time to look further in to this exiting framework very soon!