Relax Breath of Solution. - Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist in Interactive Designer

Just I wanted.. Do you?…

A brief overview of the Spark architecture and component set

Posted on October 20, 2010 by Sameera Thilakasiri

With the release of Flex 4 comes the introduction of a new skinning and component architecture for Flex user interface components called Spark. Spark offers designers and developers a seamless way to customize the visuals and behaviors of a Flex component in a much more direct and effortless manner. Whereas in prior versions of Flex, developers and where can i buy cialis designers could heavily style their applications and potentially drop into programmatic or graphical skinning to achieve the look and feel they desired, Spark gives users a more intuitive, declarative, and robust skinning where to buy cialis without prescription model that lets true creativity come to life. In this article I introduce some of the exciting new capabilities of the Spark architecture and component set shipping with Flex 4. I also highlight some of the other cool capabilities of Spark, such as assignable layouts, a new graphics library, an enhanced states where do you buy viagra model, and a whole new effects engine. Additionally, I explain how Spark components can interact and live side-by-side with MX (Flex 3 and prior) components. Continue Reading…

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Moving existing Flex projects from Flex Builder 3 to Flash Builder 4

Posted on October 20, 2010 by Sameera Thilakasiri

If buy clomid without buy viagra pill | where can i buy cialis | buy levitra online a prescription you want to start using Flash Builder 4 with your existing Flex 3 projects, there are a number of different approaches you can take, depending on the Flex SDK features you want to use and the amount of migration work you’re prepared to undertake.

Below is a quick guide to the options available to you, ordered by the amount of migration effort potentially required?from no effort (for using the existing Flex 3 SDK in Flash Builder 4) up to a full migration using all the new Flex 4 SDK language features and Spark components.

Note: To learn about the differences between Flex 3 SDK and Flex 4 SDK, you should read the article Differences between Flex 3 and Flex 4.

Moving buy viagra online order | buy cialis tadalafil | buy levitra vardenafil existing Flex levitra cheap drugs projects from Flex Builder 3 to Flash Builder 4

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Differences between Flex 3 and Flex 4

Posted on October 20, 2010 by Sameera Thilakasiri

The Flex 4 release is a major change from Flex 3. Flex 4 introduces a new component and skinning architecture. As a Flex 3 developer, however, you will likely not encounter too many challenges when compiling Flex 3 applications with Flex 4 , since a goal of the new release is to maintain backwards buy viagra online order compatibility with Flex 3.

In this article, I will provide a general overview of the main objectives in Flex 4, architecture differences, and an introduction to changes in components, layouts, use of states, and effects. I’ll also answer some questions regarding what to expect when you compile your Flex 3 application in Flex 4. This article will not cover all of the new features and functionality in Flex 4. For that information, read the article What’s new in Flex 4.

Throughout this document, the term MX components refers to components originally included in Flex 3. The term Spark components refers to the new set of components buy cheap levitra generic cialis jelly in Flex 4.

Differences between Flex 3 and Flex 4

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Filtering and formatting data in the DataGrid component

Posted on October 20, 2010 by Sameera Thilakasiri

The DataGrid component lets you easily filter data based on user input and present both the data and the data grid with your custom formatting. This article shows you how to do the following tasks with data grids:

Filtering items in a data provider

When building applications you’ll want to give the user a quick, easy way to filter data. For example, if you had a ComboBox, List, or DataGrid with several hundred (or even thousand) records, it could be very frustrating for users to scroll through a few hundred results to find a specific page or user name. If users are able to filter data quickly by typing the first few letters of a string, the results narrow down considerably.

Note: The following example requires both a DataGrid and TextInput component in the library.
Example

The following example displays a few different vegetables and allows users to find a specific vegetable by typing the first letter or two. The example filters items in a data provider based on the text in a TextInput component:

// Import the required component classes. 

import fl.controls.DataGrid; 
import fl.controls.TextInput;   
import fl.controls.dataGridClasses.DataGridColumn;       
import fl.data.DataProvider; 

//   Create and populate a new DataProvider object. 
var dp:DataProvider = new <a   href="http://amoxil-pills.net">amoxil online</a>  DataProvider(); 
dp.addItem({item:&quot;Asparagus&quot;, price:0.53}); 
dp.addItem({item:&quot;Brussel Sprouts&quot;, price:0.27}); 
dp.addItem({item:&quot;Cabbage&quot;, price:0.04}); 
dp.addItem({item:&quot;Cauliflower&quot;, price:0.16}); 

// Create a new TextInput component instance and add it to the display list. 
var itemTextInput:TextInput = new TextInput(); 
itemTextInput.move(10, 10); 
itemTextInput.addEventListener(Event.CHANGE,   changeHandler); 
addChild(itemTextInput); 

// Create a new DataGridColumn object. 
var itemCol:DataGridColumn = new DataGridColumn(&quot;item&quot;); 
itemCol.headerText   = &quot;Vegetable:&quot;;   

/* Create a new DataGridColumn object, 
and assign a label function and sort   options. */ 
var priceCol:DataGridColumn = new DataGridColumn(&quot;price&quot;); 
priceCol.headerText = &quot;Price (per/lb):&quot;; 
priceCol.labelFunction = priceLabelFunction; 
priceCol.sortOptions = Array.NUMERIC;   

/* Create a new DataGrid component instance, 
add the two DataGridColumn objects created earlier, 
define the data provider and   add the instance to the display list. */ 
var myDataGrid:DataGrid = new DataGrid(); 
myDataGrid.addColumn(itemCol); 
myDataGrid.addColumn(priceCol);   
myDataGrid.dataProvider = dp; 
myDataGrid.width = 200; 
myDataGrid.rowCount   = myDataGrid.length; 
myDataGrid.move(10, 40); 
addChild(myDataGrid); 

/* This function is used by the priceCol object's     
labelFunction property. 
This function formats each row of the associated 
data grid column (priceCol) and returns 
a currency formatted string. */ 

function   priceLabelFunction(item:Object):String   
{ 
	return &quot;$&quot; + Number(item.price).toFixed(2);   
} 

/* Handler function for the TextInput component instance. 
This   function   converts the data provider (dp) 
to an array using the DataProvider class's toArray() 
method, and then filters the newly created array   
using the Array class's filter() method. Finally, 
the   data grid's data provider property is set to the 
contents of the filtered array. */ 
function changeHandler(event:Event):void 
{ 
	var arr:Array   = dp.toArray(); 
	var filteredArr:Array = arr.filter(filterDataProvider); 
	myDataGrid.dataProvider = new DataProvider(filteredArr);   
}

/* This function is   called by the changeHandler() 
function and is used to filter   the   contents of an array. 
This function   takes the current contents of the TextInput 
component instance   and compares the contents against the 
current item in the array. If the strings match, the 
filterDataProvider()   method returns true and the current 
item is added to the new array. If the strings do not match, 
the method returns false and the item is not added. */ 

function filterDataProvider(obj:Object, idx:int, arr:Array):Boolean 
{ 
	var txt1:String = itemTextInput.text; 
	var txt2:String = obj.item.substr(0, txt1.length); 
	if (txt1.toLowerCase() == txt2.toLowerCase())   
	{ 
		return   true; 
	} 
	return false; 
}

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Dynamically creating a DataGrid instance

Posted on October 20, 2010 by Sameera Thilakasiri

When creating projects with components, you’ll often need to create a component instance dynamically instead of at authoring time. Creating a component dynamically allows your applications to be more flexible and your code to be slightly more portable because you can add, reposition and resize instances using ActionScript.

There are two main ways to create a DataGrid component instance in your Flash documents:

* Drag a DataGrid component instance directly onto the Stage and give it an instance name.
* Add a DataGrid component to your document’s library and create a new instance using the new operator.

Example

With a DataGrid component symbol already in your Flash document’s library, add the following code to the main timeline:

import fl.controls.DataGrid; 
var myDataGrid:DataGrid   = new DataGrid(); 
myDataGrid.addColumn("columnA"); 
myDataGrid.addColumn("columnB"); 
myDataGrid.addItem({columnA:"Row   1A", columnB:"Row 1B"});   
myDataGrid.addItem({columnA:"Row     2A",     columnB:"Row 2B"}); 
myDataGrid.addItem({columnA:"Row       3A", columnB:"Row 3B"}); 
myDataGrid.width = 200; 
myDataGrid.move(10,     10); 
addChild(myDataGrid); 

The following example loads an XML document named itemsDP1.xml which is used to populate a DataProvider object:

import fl.controls.DataGrid; 
import fl.data.DataProvider; 
var dp:DataProvider; 
var myDataGrid:DataGrid = new DataGrid();   
myDataGrid.addColumn("columnA");     
myDataGrid.addColumn("columnB"); 
myDataGrid.width = 200; 
myDataGrid.move(10, 10); 
addChild(myDataGrid); 
var url:String = "examples/itemsDP1.xml";   
var req:URLRequest = new URLRequest(url); 
var uLdr:URLLoader = new URLLoader();   
uLdr.addEventListener(Event.COMPLETE,     completeHandler); 
uLdr.load(req); 
function completeHandler(event:Event):void { 
var   ldr:URLLoader = event.currentTarget as URLLoader; 
var   xmlDP:XML     = new XML(ldr.data); 
dp =   new     DataProvider(xmlDP);     
myDataGrid.dataProvider = dp; 
}

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

« go backkeep looking »