Flex, ActionScript and Related Stuffs

Enjoy!!!!

Archive for August, 2007

TODO/FIXME extension for Flex Builder 2

Posted by flexrays on August 22, 2007

This is an extension plugin for Flex Builder 2 which adds TODO/FIXME Task support. This is an excellent and very useful tool which is developed and shared by Dirk. I wasn’t sure if this tool will be really helpful to me until I downloaded and start using it

I bet you all, you will realize the use of this tool only after you download it and start using it.

Click here to Download TODO/FIXME extension for Flex Builder 2

Posted in Flex, Flex/ActionScript Downloads | 4 Comments »

Adobe Flex Coding Guidelines – Download

Posted by flexrays on August 22, 2007

I found a post on blog.dclick.com and I thought it is really useful to all those Flex/ActionScript application developers out there. They need to make it a practice to follow the rules mentioned in the book carefully . Download the pdf version of the file by clicking the link below

TO DOWNLOAD, CLICK THE LINK BELOW

Adobe_Flex_Coding_Guidelines.pdf

Posted in Flex/ActionScript Downloads | 1 Comment »

AutoFilter Search in Flex

Posted by flexrays on August 9, 2007

It might be really easy to search a list if you implement this feature.
This is how it is done

I am assuming that you know how to implement the below mentioned function

private var filteredListArray : Array;

private function filterList(event:Event = null) : void
{
var txtLength:Number = txtInput.length;;
var txtEntered:String = txtInput.text;
filteredListArray = new Array();

if(txtInput.text == “”)
{
listId.dataProvider = dataProvider;
return;
}

else
{
for(var i : int = 0 ; i < dataProvider.length; i++)
{
if(dataProvider[i].toString().substring(0, txtLength).toLowerCase() == txtEntered.toLowerCase())
{
filteredListArray.push(dataProvider[i]);
}
listId.dataProvider = filteredListArray;
}
}

}

<mx:TextInput id=”txtInput” change=”filterList(event)”/>
<mx:List id=”listId” dataProvider=”{dataProvider}”/>

TextInput calls filterList(event) every time user inputs something in the text input box
filterList(event) method carries out all the necessary functionality

The catch is the way we assign the proper data provider to the List component

I will provide the working example in near future. Till that time please try and make complete use of the bits and pieces of codes. :-)

Posted in Flex | 8 Comments »

Printing DataGrid in Flex

Posted by flexrays on August 8, 2007

I had to do a lot of research on printing a Flex datagrid in a decent way.
There are very few resources on the web about printing in Flex. Adobe LiveDocs is an excellent online reference for Flex

I thought of sharing my experience and the way I successfully printed the dataGrid in Flex

See the below code before you start understanding how it works

——————————————————————————————-
<!– FileOne.mxml –>
public function printDataGrid() : void
{

var printJob : FlexPrintJob = new FlexPrintJob();
var thePrintView : FormPrintView = new FormPrintView();

Application.application.addChild(thePrintView);

if(printJob.start() != true)
return;

//Set the print view properties.
thePrintView.width=printJob.pageWidth;
thePrintView.height=printJob.pageHeight;

thePrintView.printableDataGrid.dataProvider = originalDataGrid.dataProvider
thePrintView.printableDataGrid.columns = originalDataGrid.columns ;
thePrintView.printableDataGrid.setStyle(“fontSize”, 8);
thePrintView.printableDataGrid.setStyle(“wordWrap”, true);

printJob.addObject(thePrintView);

printJob.send();

Application.application.removeChild(thePrintView);
}

<mx:DataGrid id=”originalDataGrid” width=”100%” height=”100%” dataProvider=”{dataForGrid}”/>
——————————————————————————————–

<!– FormPrintView.mxml –>

<mx:VBox xmlns:mx=”http://www.adobe.com/2006/mxml”>
<mx:PrintDataGrid id=”printableDataGrid” width=”90%” height=”100%”>
<!– Specify the columns to ensure that their order is correct.
This is not mandatory–>

</mx:PrintDataGrid>
</mx:VBox>

——————————————————————————————-

Below are the simple steps to print the DataGrid in Flex

1. Crete an instance of the FlexPrintJob called printJob (you can call anything you want to)

2. Crete an instance of the PrintDataGrid in another MXML file FormPrintView.mxml and create an instance of that – thePrintView
(if you create<mx:PrintDataGrid/> in the same MXML, which uses the function –> printDataGrid() then the application reservers some place for <mx:PrintDataGrid/> component.
This looks a bit ugly as we do not want to see that extra space in our application)
Always use PrintGrid class to print the dataGrid instead of the DataGrid, which originally displays content in the application, as it is tailored to print DataGrid in flex

3. Add the thePrintView object to the application container
Application.application.addChild(thePrintView);

4. Only one print job can be active at a time. So check to see if the printJob.start() is true. Start printing when it is true

5. Set the height, width properties of the thePrintView object to the pageWidth and pageHeightof the pringJob object

6. Assign the dataProvider of the DataGrid to be printed to the instance of the PrintDataGrid class
You also need to set the columns of the original dataGrid to the thePrintView object

You can also control the appearance of the printDataGrid object as follows
printDataGrid.setStyle(“fontSize”, 8);
printDataGrid.setStyle(“wordWrap”, true);

7. Use addObject method to add object to the printJob instance

8. Use printJob.send() to send the print job to a printer

Let me know if you have any doubts so that I can help you.

Posted in Flex | 10 Comments »

Flex Data Services Basics – File downloads

Posted by flexrays on August 8, 2007

Hi All,

I am here again to give you two more files which tells us the basics of Flex Data Services. Thanks to the authors of the subjects. I am trying to provide access to those files which are difficult to find on the internet. All the credit goes to the authors of the subject and am just making their work available to public. Please click on the below link to download the files

Flex Data Services Basics

FDS for component developers

Posted in Flex, Flex/ActionScript Downloads | Leave a Comment »