Posts tagged flex builder
Runtime Shared Libraries – indispensable and infuriating!
Jul 22nd
Utilizing the RSL (Runtime Shared Library) mechanism in Flex is arguably one of the quickest and easiest ways to drastically shrink your Flex application’s file size. The RSL mechanism essentially allows you to compile your Flex application without embedding the Flex framework into the code. So, if the Flex framework isn’t compiled into the Flex application (final SWF file), then how does the application work? The real genius comes in at this point… The Flash Player – as of version 9.0.60 – can now cache signed RSLs containing the Flex framework. If the Flash Player caches these frameworks, it means that if you have viewed a Flex site using the 3.2.0 SDK and you launch another Flex application using the same SDK, you do not have to download the whole framework from the server!
For more information and a brief tutorial, visit this link on the Adobe Labs site.
However, it’s not always as quick and easy as some might like to believe. Recently i’ve been playing around with RSLs and different versions of the Flex SDK and i’ve been encountering the dreaded Error #1001 runtime error. This pernicious and convoluted little error can cause a spontaneous force of attraction between your forehead and your desk. It’s quite strange indeed… Well, after a bit of digging and some messing around, i seem to have noticed a general pattern for failure and subsequently getting the error message above, and how to fix it…
I’ve created a Flex project and have merrily gone about my day coding, styling, flexisizing etc… I’ve set my project to use RSLs (using the 3.2.0 Flex SDK) and everything is working just fine. Now i notice on the Adobe Labs site that there’s a new Flex SDK available (say… 3.3.0). I decide to chuck the current SDK and replace it with the new one… Only to see the following after a compile of the project:
Eek. Nothing like a good ol’ spanner in the works, eh?
After a bit of scratching around in the 3.3.0 SDK folder, i came upon the flex-config.xml file (located at $FLEX_INSTALL_PATH/sdks/$SDK_VERSION/frameworks). If you scour through the file, you’ll see that towards the bottom there’s a node called runtime-shared-library-path. Here’s what it looks like in the 3.3.0 SDK:
<runtime-shared-library-path> <path-element>libs/framework.swc</path-element> <rsl-url>framework_3.3.0.4852.swz</rsl-url> <policy-file-url></policy-file-url> <rsl-url>framework_3.3.0.4852.swf</rsl-url> <policy-file-url></policy-file-url> </runtime-shared-library-path>
Check out the two rsl-url properties… One is the name of a SWZ (signed SWF) file and the other is a plain SWF file… Notice the naming of those URLs and then refer back to the image above. Flex Builder obviously didn’t change the RSL linkages when i changed my SDK in my Flex project.
The SOLUTION:
Open your Flex Project Properties dialog, select the Flex Build Path option on the left, then the Library Path tab at the top. You will then see something like this:
Notice how the version numbers of the RSL files do not correlate with the version of Flex SDK? For some reason, Flex doesn’t change the RSL linkage when you switch SDKs in a Flex Project. I wonder whether this is a bug or a feature (like i often wonder about the ON button on Windows machines).
Anyway, the quick fix for this is as follows:
Simple select the Flex SDK and hit the REMOVE button on the right. The Add Flex SDK button will then become active and you can go ahead and click on it. This will scan the flex-config.xml file we looked at earlier and pick up the correct files to use for the RSL.
Done! You can now close the Properties dialog.
Go ahead and clean your project at this point by going to the menu, Project -> Clean. This will delete all the compiled code that was previously generated and it will then trigger a new build. Once the build has completed, run your Flex application…
Oh, don’t you just love it when shit works?!
Formatting your Flex code in Flex Builder 3
Jul 9th
Oftentimes i will be searching the net for a useful class or code snippet, only to be horrified by its inherently ugly formatting. I’m obsessed with code neatness and readability, and it really pisses me off when i have to reformat an entire class by hand.
Enter Flex Formatter from Ernest Pasour
This incredibly useful little set of three plugins for Flex Builder 3 (and possibly Flash Builder 4 – i haven’t tried yet, can someone confirm this?) provides you with a vast variety of code formatting options. Below is a couple of screenshots of the configuration pages:
ActionScript
MXML
Even apart from all of its amazing code reformatter tools, FlexFormatter 0.6.24 has the ability to generate ASDoc comments! By now you should be convinced, so here’s the installation process:
- Download zip file from here
- Unzip contents (3 .jar files) to your plugins directory inside of your Flex Builder 3 installation
- Restart Flex Builder and you will notice there will be 5 new buttons in your toolbar:
Happy formatting!
Linux Mint & Flex
Jan 24th
I recently moved over to Linux Mint. Their catch-phrase is “from freedom came elegance” and it rings so true.
Linux Mint is one of the surprise packages of the past year. Originally launched as a variant of Ubuntu with integrated media codecs, it has now developed into one of the most user-friendly distributions on the market – complete with a custom desktop and menus, several unique configuration tools, a web-based package installation interface, and a number of different editions. Perhaps most importantly, this is one project where the developers and users are in constant interaction, resulting in dramatic, user-driven improvements with every new release.
The truth be told – i’m a bit of a n00b when it comes to Linux, but wow… What an OS. You can download the OS here, then simply write it to disk and restart your PC and boot from the installer disk. Mint can be run from the disk, which is quite a cool feature (available on a few other Linux distros i’m told – such as Ubuntu)
My main line of work – and my passion – is developing Flex applications, and as a consequence, i need to be able to develop Flex apps from Linux. The incredible folks over at Adobe have released the fourth public alpha release of Flex Builder for Linux. Being an alpha version, it does not have all the features we’re accustomed to in the Windows or Mac incarnations, and you’ll need to install Eclipse Europa 3.3.2 for it to work (Flex Builder only comes as a plugin at this point). The main missing features are:
- Design view
- States view
- Refactoring
- Data Wizards
- Cold Fusion – Data Services Wizard
- Web Services introspection
- Profiler
However, the features that are present are more than enough to develop Flex/AIR applications, and if you can’t build Flex apps without design view, you suck
.
Please note: The Flex Builder plugin will NOT work with Eclipse Ganymede (3.4.x). The plugin will install just fine, but the MXML editor will not work. There has been much discussion about it on the bugs.adobe.com site, but no solution has been found as of yet.
The installation of Flex Builder for Linux is quite simple. Follow these instructions:
- Download Eclipse Europa 3.3.2 to your desktop. Open the terminal and extract the archive to wherever you like.
- Download the Flex Builder for Linux plugin to your desktop. Open the terminal, direct the terminal to your desktop and enter the following:
sudo sh flexbuilder_linux_install_a4_081408.bin
- Follow the installer’s instructions and install the plugin. Please be sure that the directory you’re installing the plugin to is the correct Eclipse directory.
- The plugin will now be installed to your Eclipse install. Go to your eclipse folder and run the main application. Click on the Window menu and select Open Perspective. Click Other and search for Flex. From here you can open your Flex Development perspective and start developing Flex applications
!
Great! So now you have installed the Flex Builder for Linux plugin. Unlike the Windows/Mac versions, you will have 311 days or something like that to test the application. If you are a student, you can apply for a free Flex license here. I’ve used my student license on both my Windows and Linux versions and it works fine.



