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.
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 »
As a result of feedback from one of my previous posts , I have made a few changes based on the feedback and the site is now live. This site is basically about giving a new face to the Coldfusion documentation, valid upto the latest version.
Website : www.coldfusiondocs.com
Documentation : www.coldfusiondocs.com/app/
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.
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 »
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).
User specific login information is usually stored in session variables in any web application. However, Flex doesnt have anything called session variables in it. So how do we save this information across the whole application. Static classes come to the rescue here. This can also be achieved by use of shared objects and Singletons but I am going to focus on static classes for now.
A static class holds the information in it once declared and is very useful for such scenarios. Typically, after you are done with the username/password authentication in your Flex app, you would need to store the data in a static class to be able to access it from anywhere in your application. More »
In one of my other blog posts, someone pointed me towards the Flex AJAX bridge as an alternative to using Flex ExternalInterface. So I went ahead and had a look at it. Its currently in beta state and would need the Flash debug player to be notified of any errors etc while execution but apart from that, I think its an improvement over the ExternalInterface. As per the article, ExternalInterface has some limitations :- More »
Google has released out Flex version of the searchmash website, http://www.searchmash.com/flash/search/#home . It seems to have a few interesting features. It has got Google Maps embedded and when searching for videos, you can play videos within the results. And when you get the web results, you can mouse over a result to view a snap shot view of the webpage.
However, I think the HTML version of searchmash is also very cool and worth having a look.
Just read the announcement that Flex Builder 2 would be free for students and faculty.
However, not sure if this is free for students and faculties from outside US as well. Would be quite handy if it is, its a big step forward in promoting Flex.