18. June 2011

Structure of Flex project for multi-target development

What I mean by multi-target?

Today it is possible to create Flex project that runs in browser as Flash application. Other option is to create mobile or desktop application using AIR.

The question is how to structure bigger projects that need to target web, mobile and desktop.

Let’s assume that we’re developing multiple applications and therefore it is good to have common library which aggregates common functions.

That is sufficient when you’re targeting just one platform. Once you need to support more projects then one common library is not enough.

It is reasonable to split this library into the main core that is common for all projects and then create specialized libraries for AIR, web and mobile.

On the top of these libraries you can build final applications for desired platform.

Recap:

  • top: applications for mobile, web and desktop
  • middle: specialized libraries that extends functionality for mobile, web, desktop
  • bottom: common library for all platforms

6. June 2011

IntelliJ – new Flex project – error #2032

IntelliJ Idea Ultimate has great support for Flex projects.

There are few gotchas that you have to deal with.

When you set up project, compile it and open it in browser you can get very common error #2032 in Flash Player.

This indicates that you have some problem with RSL libraries. I already wrote some posts about RSL troubleshooting.

In case of Intellij Idea just add following line to Additional compiler settings (Modules – Flex – Flex Compiler Settings):

-static-link-runtime-shared-libraries

This option causes that compiler links RSL into final SWF. The file is bigger, but you can be sure that it will work without #2032.

This option could help you for the time being.

 

3. June 2011

Gotcha – performance on iOS and Android – Flash Builder – debug vs release

Several developers mentioned tricky gotcha of Flex and ActionScript apps on iOS and Android.

Flash Builder produces debug version of code by default. Debug code contains a lot of additional stuff that slow down application on target device. E.g. You’ll get 5-8 fps. That is very poor.

In order to test performance make sure that you’re using release version of project without debug information. Same code will work much faster – e.g. 20-24 fps.

29. May 2011

Flex ExternalInterface – sending big amount of data

When you want to exchange data between Flash Player and JavaScript then you can use ExternalInterface.

There are two issues that you should be aware of:

1. Binary data must be encoded.

You could not send binary data directly from JavaScript to ExternalInterface. Data will be garbled. You have to encode it e.g. using Base64.

2. Send small chunks of data.

When you need to send 2 MB via ExternalInterface, you need to chop it into smaller pieces. E.g. 256 KB. Bigger chunks cause big load and it slows down transfer.

It takes 15 seconds to transfer 2 MB big chunk in Google Chrome 11. When you chop 2MB into 256 KB chunks, then it’s less than second.

28. May 2011

Flash Memory Monitor

Simple memory monitor which displays total memory usage of Flash Players in browser. Original code is from: flexponential.com.

I just removed some UI components.

Some links:

You can also reuse package published here and embed this monitor in your app:

<iframe src="http://georgik.rocks/wp-content/flex/memory-monitor/0.1/MemoryMonitor.html" 
width="400" height="150" frameborder="0" marginheight="0" 
marginwidth="0">Loading...</iframe>

You can also just open this app and see what is going on with memory usage of Flash Player.

  • Quick search

  • Links

  • Twitter

    Follow @jurajmichalek on twitter.

  • Comments

  • Tags

  • Topics