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.
Ted Patrick has posted an interesting information about the open source project FlexPMD which is a tool to find out the worst parts of your code. The tool alerts and points out the bad coding practices that you have followed in your Flex project which I believe is a great thing, given that while developement you tend to leave behind complex, redundant code and unused variables/piece of code which might give you the expected output but may be not considered as the best practice.
There is also a Flex application FlexPMD Rule set creator which enable to set custom rules for your application, that can be exported and used. The FlexPMD can be downloaded in three forms – CommandLine, Ant Task, Mac OSX Automater.
Once we start development on a project, in the initial stages most of us do rather take care to follow the best practices and try delete the unwanted code / unused code, but as soon as the code gets larger and more complex and as the project manager start talking only about delivery dates, it is always a time taking and horrendous process to sit and go through the code and remove all those rubbish stuffs that we have written. Now,I am going to download and try out this tool, if it works well then my code will look pretty in and out. What do you guys think ? 😉
For more info – http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD
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 🙂