Adobe Flex and AIR Pre-Release Tour comes to London

Tagged Under : ,

As the subject says, January 24th is the date for this event. Although getting to London takes me not more than 30 mins and my schedule for 24th is not very busy as well, so, unless any unforeseen problems, I am going to attend this event.

Flex : How to remove Duplicates from an Array

Tagged Under :

If you have an Array and you want to get rid of duplicates from the array, here is a little function you can use to achieve the same.

Basically, all its doing is making use of the forEach function built in Flex that runs a custom function for every item in the Array. This function then sorts the data alphabetically, checks each value with the previous value and if they are not same, adds the unique element to the new tempArray and thats what gets returned.

Might be useful for some I guess!

How to manually generate RSL file for Flash Player

Tagged Under : ,

In my last post , I spoke about how we can exclude the RSL files from Flex SWF generation. So, I uploaded framework_3.0.189825.swz file to the same folder where the SWF sits on the server. This file can be found under C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\rsls assuming that you have the default installation. However, a few people reported that they were getting this error “RSL error 1 of 1″, and on some investigation I got to this link and I realized I was missing a RSL file. The problem was that I had uploaded framework_3.0.189825.swz which is the “signed” framework RSL and I also needed to upload the framework_3.0.189825.swf which is the “unsigned” framework RSL. So I thought its just a matter of uploading the missing file and I should be done.

However, I could not find this file in the RSLs folder. So I did some Googling and followed these steps to generate the .swf file.

1) Extract library.swf file from C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\framework.swc
2) Using the command line Flex tools, run the following command :-
optimizer library.swf –output framework_3.0.189825.swf –keep-as3-metadata=Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,Transient

This optimizer commands removes any debugging information from the file and makes it fit for deployment.

Then I uploaded the file and the error is now presumably gone. I did test on several different machines.

I just thought this might be some useful information for someone who faces the same problem.

SWF file size on coldfusiondocs.com

Tagged Under :

I was fixing a bug today on coldfusiondocs.com , reported by one of the readers and I noticed that the SWF file that Flex generated was 482Kb in size. I think that is rather big for a simple application, that it is and it also explains why the server bandwidth usage had gone very high up suddenly in last 2 weeks after the launch of the site. So I asked my best friend (Google) on how to fix this and as always there was a solution to it.

Turns out that you can exclude the framework RSLĀ  files from your build and reduce the SWF size by approx 500Kb. The trick is that latest flash player has the capability to cache RSL files as soon as it visits any Flex/Flash site. These RSL files can be hosted separately on the server (either in the same directory as SWF or a central URL if you host multiple SWF’s). And your SWF can load these RSL files if not already cached. Cool Stuff! Here is the full article.

So, the next time you visit coldfusiondocs.com, your browser will only load a SWF which is 92Kb in size as compared to a 482Kb till now.

However, if anyone faces any problems, please give me a shout.

Flex : How to pre-select an Item in DataGrid

Tagged Under : ,

If you want to pre-select an item in a Datagrid when it loads for the first time, this is how you can do it. The idea is really simple, just set the selectedIndex property of the Datagrid to the index you want and then scroll the DataGrid to the selectedIndex. Took me a while to figure it out. However, turns out the you need to call validateNow() before you call the scrollToindex() on DataGrid.

Sample code posted below. More »

Feedback wanted on new coldfusiondocs.com

Tagged Under : , ,

I have been spending some time lately on this idea of mine and I would like to get some initial feedback on this. Its to do with the CF documentation that is available to developers. As a developer, I always have to search for CF tags or functions and there is no easy way to do that without doing atleast 3 or 4 clicks or searches. So I went ahead and put it all together in a Flex app. And I also purchased a name for it. www.coldfusiondocs.com (which is not live yet).

The demo app is here ( www.coldfusiondocs.com/app/ ) . It lists all the tags and functions and its easy to filter down to what you are looking for and it lists the attributes and also opens up a HTML version of the tag/function. At the moment, it does not have display the attributes for every tag and function (because thats something I am still working on). I am going to put together a homepage and possibly a forum for the site sometime during this week but the heart of this project is this Flex app I am working on.

I would like to have some feedback and find out if the effort is really worth it.

Changing MXML string labels via XML

Tagged Under : , ,

I personally dont like hardcoding things like texts and labels inside any compiled code, reason being , when it needs to be changed for whatever reason, I have to go through the pain of loading the project and making the change and then compiling it again and deploying it again , all for one little change. Its always better to save as many as possible config’s in a separate file (XML being the more appropriate choice). More »

Coldfusion documentation Flex’ed

I have been playing around with this idea of giving a new face to the CF documentation on tags and functions. Whenever I had to search for some tag or function (which I do almost daily), I had to make several clicks before I got to the page. So I decided to play around with this little idea of mine. I put together everything in a Flex app. (http://cfdocs.anujgakhar.com/) . (try in IE for now)
I know there is room for enhancements and features but this is my first step forward towards this project. Any new ideas/features/improvements/critics are welcome and I am keen to make this a really useful tool for fellow developers.

One known issue is, it doesnt load up the online URL in Firefox. I am using IFrame class from Alistair Rutherford which does a really nice job, I just need to work out this Firefox bug.

Centering a PopUp in Flex

Tagged Under :

If you are using PopUpManager and TitleWindow to create a popup window in Flex, you have probably run across this problem already. The createPopup() function takes first argument as the owner of the popup window. And when you do PopUpManager.centerPopup(this) , it centers the popup. But it only centers the popup relative to its parent component, which means if you are creating the popUp from lets say a Sidebar control, the popup will not be in the center of the page but in the center of the sidebar which can look messy.

Here is what you can do to solve this.

Instead of the above, you can do this :-

I have used _class here to represent the actual TitleWindow classs you will be using. And notice how I pass the parentApplication as a UIComponent to the owner of the popup.
What this does is, it changes the owner of the PopUp to the main Application file which in return centers the Popup in the page when you call PopUpManager.centerPopUp(this).

Flex Builder : Jump to definition

I just found out this really cool way to browse a Flex app. I use Flex Builder to develop Flex apps, so this is related to Flex Builder , not sure if this works in the Eclipse plugin as well. While you are in the code view, if you mouse over the name of a function, class or object, press the CTRL key and it becomes a hyperlink to point to the actual definition of the object.

Really cool! I always found it a bit messy to browse all the files and functions inline and dont really like the functions list view.

Flex Builder