deepak verma

January 10, 2008

Datagrid headerRenderer checkbox to select checkboxes in the row

Filed under: Flex — Tags: , , , , — deepuverma @ 6:39 am

I had been trying out to implement the datagrid headerrenderer + itemrenderer to allow select all/deselect all checkboxes on the datagrid rows

I have picked various ideas from the examples given by Alex on datagrid itemrenderers and created a demo to show how to implement the checkbox select all with header renderer.

[You can preview the example to see what I am talking about and download the code here]

September 6, 2007

Flex 1.5 to Flex 2 actionscript converter

Filed under: Flex — deepuverma @ 6:22 pm

I had been asked by my manager on how much time will it take to convert the intranet Flex 1.5 application to Flex2. Instead of doing the basic stuff for converting the app manually, I thought of writing a utility of replacing code.

The utility takes care of the following

I . Finds and replace
1. application namespace
2. Void with void
3. newline with \n in .as file
4. _root with Application.application
5. Application.alert with mx.controls.Alert

II. package the class

Following are the regular expressions I have used to replace the content (not sure if this is the best way to do the task)

file_content = Regex.Replace(file_content, "xmlns:mx=\"http://www.macromedia.com/2003/mxml\"", "xmlns:mx=\"http://www.adobe.com/2006/mxml\"");
file_content = Regex.Replace(file_content, "\bvoid\b", "void",RegexOptions.IgnoreCase);
if (fi.Extension == ".as")
{
file_content = Regex.Replace(file_content, "\bnewline\b", "\"\n\"", RegexOptions.IgnoreCase);
}
else
{
file_content = Regex.Replace(file_content, "newline", "#&13;", RegexOptions.IgnoreCase);
}
file_content = Regex.Replace(file_content, "\b_root[.]\b", "Application.application.", RegexOptions.IgnoreCase);
file_content = Regex.Replace(file_content, "\bApplication.alert\(", "mx.controls.Alert.show(", RegexOptions.IgnoreCase);
String packagename;
if (fi.Extension == ".as")
{
Match m = Regex.Match(file_content, @"(?<class>class)(?<packages>.*[.])(?<classname>.*)");
file_content = Regex.Replace(file_content, @"(?<class>class)(?<packages>.*[.])(?<classname>.*)", "${class} ${classname}");
packagename = m.Groups["packages"].Value;
file_content = "package " + packagename.Substring(0, packagename.Length - 1) + "{n" + file_content;
file_content = file_content + "n}n";
}

September 3, 2007

Understanding Flash player garbage collection

Filed under: ActionScript — deepuverma @ 4:38 am

I got the following links from one of my internal mailing list on how does Flash Player handle garbage collection.

Garbage Collection and Memory Leaks

Understanding garbage collection in Flash Player 9

Resource management strategies in Flash Player 9

July 30, 2007

Cairngorm code generator

Filed under: ActionScript — deepuverma @ 4:56 am

Cairngorm Creator is a Flex code generation application that enables developers to quickly define and create a Flex application skeleton based on the Cairngorm micro architecture. Check it out

Flex Podcast

Filed under: Flex — deepuverma @ 1:12 am

Listen to Flex podcast from some of the biggies from the Flex Arena.

July 23, 2007

Migrate Flex 1.5 applications to Flex 2

Filed under: Flex — deepuverma @ 5:58 pm

We have some applications which were developed in Flex 1.5. These application are still been used and the users complain about the slow response.

So we have decided to convert a bunch of Flex 1.5 applications to Flex 3 + Cairngorm. Conversion will help us leverage the best of LCDS and Flex Builder 3.

Here is a documentation to help converting your Flex 1.5 application to Flex 2.

July 11, 2007

Type was not found or was not a compile-time constant: Consumer

Filed under: ActionScript — deepuverma @ 7:54 am

Problem: If you are using Cairngorm 2.2 and you don’t have fds.swc in the Flex builder library path ‘Type was not found or was not a compile-time constant: Consumer’ error would be reported while compiling the application.

Cause : ServiceLocator class of Cairngorm has a soft reference onto the Flex framework’s Consumer class

Fix: Download Cairngorm 2.2.1 Beta Binary (SWC) from Alistair’s blog

June 29, 2007

Definition of local variable

Filed under: ActionScript — deepuverma @ 4:50 am

If you think that declaring a variable, as and when you need in a program will be a wise idea to utilize player memory, then you are wrong

public function testbtn_onclick():void
{
mx.controls.Alert.show(i+”");
var i:int = 10;
}

The above code will define the variable i at the start of the function, and would compile without any errors.

Therefore, you will get no performance benefit even if variable is defined when required

June 27, 2007

Get web domain from the Flex movie

Filed under: ActionScript — deepuverma @ 10:23 am

To get the domain name in which the flex movie is loaded URLUtil.getServerName(mx.core.Application.application.url)

[Simple]

June 26, 2007

Flex Builder 3 beta on Vista

Filed under: Flex Builder — deepuverma @ 11:15 am

During my initial run for FB 3 beta profiler and debugging functionality, I found that they do not seem to work correctly for me on Windows Vista with IE7.

I was able to run the features by setting Firefox as the default browser for FB

To set the browser, navigate thru Window->Preferences->General->Web Browser and select Firefox.

Older Posts »

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.