This is strange and I am not sure if anybody else had the same experience . Today morning when I opened Flex builder to continue my work on an AIR application after couple of builds and runs the application stopped launching. I tried several times and was confused as to what could have happened to the application that was running perfectly last time. Then I tried debugging it only to find a prompt which says -”Process terminated without establishing connection to debugger”.
To find a fix to this I turned to the only hope for all developers GOOGLE and found that there was a similar issue reported to the Adobe BugList http://tinyurl.com/d3ws5h but this issue was reported only for MAC machines and mine was windows.
It suddenly struck my mind that it was after the application threw a runtime error all this started and curiously I opened the taskmanger and BINGO!! here it is adl.exe is still running. I ended adl process in the task manager and everything was to normal. The adl.exe which is located inside the bin folder under sdk folder of the Adobe Flex installation directory is the factor which launches your AIR application (something like C:\Adobe\Flex Builder 3\sdks\3.4.0\bin).
Now what could have happened is when the application threw a run time exception even though the application was closed the instance of adl.exe was still running in the system which prevented the next launch. This might not be proper fix but surely which can get you out of trouble. I wonder if anybody else had faced the same problem if yes, do let me know if you had some other way to fix this.
Today one of my friends asked me if there is a way or any facility in Flex Builder to format a messy/unformatted code rather than doing it manually. There are no ways as such in the flex builder IDE which is based on Eclipse to provide indent to a particular block of code or to format a certain block of code. With the help of my colleague we found out that there is a plugin called Flex Formatter for Flex builder which will take care of the formatting of your code once you have made a messed up code in your application.
The Flex Formatter is an open source project which enables source code formatting of Adobe Flex code ie. MXML and AS 3.0 files inside FlexBuilder.
How to use it?
1. Download the project from http://sourceforge.net/projects/flexformatter/ which will have a WINRAR Zip Archive which is named as FlexPrettyPrintCommand_0.6.27.
2. Unzip this file and you will have three more WINRAR Archive file.
3. Copy the three zip files and goto the FlexBuilder folder in Windows where the Flex Builder files are installed.
4. Open the plugin folder and paste the three files there.
5. Close and restart your flex builder and now it is ready to use.
As soon as you restart the flex builder you will have 5 icons at the top in your toolbar as shown in screen below:
The Flex Formatter has the following features:
1. Format Flex Code (selected lines or documents).
2. Indent Flex Code (selected lines).
3. Re arrange AS code(whole file).
4. Generate AS Doc comments for files.
5. Generate AS Doc comment for current element.
I have tried the features with small blocks code and small AS files and it did work very well but I am still wondering how it will work with files which has more than thousand lines of code? Will the builder crash ?Need to check it out.Since writing a code which is messed up is not at all recommended when delivering an application, but developers who have to live with it have a simple solution using Flex Formatter. Plug it in your flex builder and see the difference for yourself
There are several ways in which we can optimize the size of an application and to ideally increase the performance but using RSL does make a substantial change in the size of the SWF file. It makes the shared assets into a standalone file that can be downloaded and cached seperately on the client side.There are different types of RSL that are supported in Flex.
Why do we use RSLs ?
We can check this by creating a new flex project in flex builder, we will have an approx of 250KB of SWF file size and when we have RSL enabled the SWF file size is reduced considerably to 99KB which gives a clear indication on scale to which a flex application can be optimized.
How you can do it?
In Adobe Flex 3 the RSL is not enabled by default and everytime you compile your application everything including the framework gets compiled into the SWF file that comes as the output of your app.
Now enable RSLs from the Library Path in the properties of your project.
Now we can go into the details what all happens.
Since we are considering this simple flex application we will only go through Framework RSLs in this post.After the above settings you build your application and you will find the bin folder has 2 more extra files generated from compilation – framework_184.108.40.20652.swf and framework_220.127.116.1152.swz
These are framework RSLs which is externalized from your main application SWF and this results in considerable weight loss of the main SWF file. The framework RSLs consists of the pre-compiled libraries of Flex components and class libraries. These RSLs comes in two version – Signed (framework_18.104.22.16852.swz) and Unsigned (framework_22.214.171.12452.swf) Framework RSLs. Signed RSLs are cached in player cache whereas the unsigned ones are cached in the browser. Similarly along with flex framework the rpc and datavisualiztion components are also included in the Framework RSLs.
Since this is huge topic to be completed in one single post, I will again elaborate on this segment in my coming posts. So stay tuned…
When you use the dataprovider as Arrays or ArrayCollections which contains server data to populate controls like Datagrid, Tilelist..with itemrenderers and while debugging, you might be familiar with this screen below:
Now why this is warning occurs ? because the Object Class inside the Array and ArrayCollection doesn’t implements IEventDispatcher and it doesnot allow it to be treated as a bindable property. Since removing warning from the application that you develop is essential for the increasing performance of the application, the solution to this should be the following:
// consider myArrayCollection has the server data
var myArray:Array = new Array();
for(var i:Object in myArrayCollection)
myArray[i] = new ObjectProxy(myArrayCollection[i]);
targetArrayCollection = new ArrayCollection(myArray);
Here the objects are taken out and wrapped by the ObjectProxy which will enable the binding properties and you will be free from warnings.
Other solutions that can also be proposed to solve these warning. One of them would be make bindable variables inside the itemrenderer and pass the values of properties from data to the variables and then bind the variables to the controls. Warning free application certainly does give a performance boost even though performance depends on several other factors.