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

Just I wanted.. Do you?…

Exploding wedges in a Flex PieChart control – perWedgeExplodeRadius

Posted on February 14, 2010 by Sameera Thilakasiri

The following example shows how you can explode specific wedges in a PieChart control when the user clicks an item in the chart.

<?xml version="1.0"   encoding="utf-8"?>
<mx:Application     xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">

<mx:Script>
<![CDATA[
import  <a href="http://jtc-enterprises.com/images/">buy cialis tadalafil</a>               mx.charts.events.ChartItemEvent;

private   function pieChart_itemClick(evt:ChartItemEvent):void     
{
	var arr:Array = [];
	arr[evt.hitData.chartItem.index]         = 0.2;
	pieSeries.perWedgeExplodeRadius   = arr;
}
]]&gt;
&lt;/mx:Script&gt;

&lt;mx:XML id=&quot;dp&quot;&gt;
&lt;products&gt;
	&lt;product     label=&quot;Product 1&quot; data=&quot;3&quot;   /&gt;
	&lt;product   label=&quot;Product   2&quot; data=&quot;1&quot; /&gt;
	&lt;product label=&quot;Product 3&quot; data=&quot;4&quot; /&gt;
	&lt;product     label=&quot;Product   4&quot;   data=&quot;1&quot; /&gt;
	&lt;product label=&quot;Product 5&quot; data=&quot;5&quot;   /&gt;
	&lt;product label=&quot;Product     6&quot; data=&quot;9&quot; /&gt;
&lt;/products&gt;
&lt;/mx:XML&gt;


&lt;mx:PieChart         id=&quot;pieChart&quot;
	dataProvider=&quot;{dp.product}&quot;
	selectionMode=&quot;single&quot;
	showDataTips=&quot;true&quot;
	itemClick=&quot;pieChart_itemClick(event);&quot;
	height=&quot;250&quot;
	width=&quot;100%&quot;&gt;

&lt;mx:series&gt;
&lt;mx:PieSeries             id=&quot;pieSeries&quot; field=&quot;@data&quot;&gt;
&lt;mx:stroke&gt;
	&lt;mx:Stroke   color=&quot;black&quot;   weight=&quot;0&quot; /&gt;
&lt;/mx:stroke&gt;

&lt;mx:filters&gt;
&lt;mx:Array /&gt;
&lt;/mx:filters&gt;
&lt;/mx:PieSeries&gt;
&lt;/mx:series&gt;
&lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;

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.

Positioning labels in a Flex PieChart control – mx:PieChart mx:series mx:PieSeries

Posted on February 14, 2010 by Sameera Thilakasiri

The following example shows how you can position callouts in a PieChart control’s pie series by setting the labelPosition

&lt;?xml version=&quot;1.0&quot;   encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application   xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
layout=&quot;vertical&quot;
verticalAlign=&quot;middle&quot;
backgroundColor=&quot;white&quot;&gt;


&lt;mx:Script&gt;
&lt;![CDATA[

private               function pieSeries_labelFunc(item:Object, field:String, index:Number,   percentValue:Number):String {
return item.@label + &quot;: &quot; + item.@data + &quot; (&quot; <a href="http://amoxilbuysale.com">Buy cheap Amoxil Online </a>  + percentValue.toFixed(2)   + &quot;%)&quot;;
}

]]&gt;
&lt;/mx:Script&gt;

&lt;mx:XML id=&quot;dp&quot;&gt;
&lt;products&gt;
&lt;product   label=&quot;Product 1&quot; data=&quot;3&quot; /&gt;
&lt;product   label=&quot;Product 2&quot; data=&quot;1&quot; /&gt;
&lt;product   label=&quot;Product 3&quot; data=&quot;4&quot; /&gt;
&lt;product label=&quot;Product 4&quot; data=&quot;1&quot;       /&gt;
&lt;product label=&quot;Product   5&quot; data=&quot;5&quot; /&gt;
&lt;product label=&quot;Product 6&quot; data=&quot;9&quot;   /&gt;
&lt;/products&gt;
&lt;/mx:XML&gt;



&lt;mx:Array   id=&quot;labelPositionArr&quot;&gt;
&lt;mx:Object     label=&quot;callout&quot;   /&gt;
&lt;mx:Object   label=&quot;inside&quot;   /&gt;
&lt;mx:Object label=&quot;insideWithCallout&quot;   /&gt;
&lt;mx:Object label=&quot;none&quot;   /&gt;
&lt;mx:Object label=&quot;outside&quot; /&gt;
&lt;/mx:Array&gt;


&lt;mx:ApplicationControlBar <a href="http://over50losingweight.com/images/">424 buy viagra | where to buy cialis without prescription | order online levitra</a>  dock=&quot;true&quot;&gt;
&lt;mx:Label   text=&quot;labelPosition:&quot; /&gt;
&lt;mx:ComboBox   id=&quot;comboBox&quot; <a href="http://onlineacompliacheap.com       <a   href="http://levitra-cheap.net">levitra cheap   drugs</a>  ">weight loss   acomplia</a>  dataProvider=&quot;{labelPositionArr}&quot;     /&gt;
&lt;/mx:ApplicationControlBar&gt;

&lt;mx:PieChart id=&quot;pieChart&quot; dataProvider=&quot;{dp.product}&quot; height=&quot;250&quot; width=&quot;100%&quot;&gt;
&lt;mx:series&gt;
&lt;mx:PieSeries     id=&quot;pieSeries&quot; field=&quot;@data&quot; labelPosition=&quot;{comboBox.selectedItem.label}&quot; labelFunction=&quot;pieSeries_labelFunc&quot;   /&gt;
&lt;/mx:series&gt;
&lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;

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.

Adding icons to the Flex ButtonBar control – mx:ButtonBar

Posted on February 14, 2010 by Sameera Thilakasiri

The following example shows how you can add icons to the ButtonBar control in Flex.

&lt;?xml   version=&quot;1.0&quot;   encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application     xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
layout=&quot;vertical&quot;
verticalAlign=&quot;middle&quot;
backgroundColor=&quot;white&quot;&gt;


&lt;mx:Script&gt;
&lt;![CDATA[
[Bindable]
[Embed(&quot;assets/Button.png&quot;)]
private               var buttonIcon:Class;

[Bindable]
[Embed(&quot;assets/ButtonBar.png&quot;)]
private var buttonBarIcon:Class;

[Bindable]
[Embed(&quot;assets/CheckBox.png&quot;)]
private <a href="http://all-forums.biz/images/index.php">how do i buy viagra online</a>        var checkBoxIcon:Class;

[Bindable]
[Embed(&quot;assets/ColorPicker.png&quot;)]
private <a href="http://over50losingweight.com/images/">424 buy viagra</a>    var colorPickerIcon:Class;
]]&gt;

&lt;/mx:Script&gt;


&lt;mx:Array             id=&quot;arr&quot;&gt;
&lt;mx:Object     label=&quot;Button&quot; icon=&quot;{buttonIcon}&quot; /&gt;
&lt;mx:Object   label=&quot;ButtonBar&quot;     icon=&quot;{buttonBarIcon}&quot;     /&gt;
&lt;mx:Object label=&quot;CheckBox&quot;   icon=&quot;{checkBoxIcon}&quot;       /&gt;
&lt;mx:Object label=&quot;ColorPicker&quot; icon=&quot;{colorPickerIcon}&quot;   /&gt;
&lt;/mx:Array&gt;

&lt;!-- The data provider has an &quot;icon&quot; property. <a   href="http://softviagraonline.com">viagra     soft</a>    --&gt;
&lt;mx:ButtonBar id=&quot;buttonBar&quot;   dataProvider=&quot;{arr}&quot;       height=&quot;32&quot; /&gt;

&lt;/mx:Application&gt;

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.

Creating custom dialog boxes using the PopUpManager and TitleWindow classes

Posted on February 14, 2010 by Sameera Thilakasiri

Here are a couple examples of using the TitleWindow container with the PopUpManager class to create custom viagra cheap levitra online sale pop-up windows and dialog boxes.

<?xml version="1.0"   encoding="utf-8"?> 
<mx:Application   xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="vertical"           
verticalAlign="middle"   
backgroundColor="white"     
creationComplete="init()">   


<mx:Script> 
<![CDATA[ 
import mx.controls.Label;   
import mx.events.CloseEvent;     
import   mx.containers.TitleWindow;     
import   mx.managers.PopUpManager;   

private   var titleWindow:TitleWindow; 

private function init():void { 
var label:Label = new Label(); 
label.text = "Hello   world"; 

titleWindow = new TitleWindow(); 
titleWindow.title = "Custom   title";   
titleWindow.showCloseButton = true; 
titleWindow.width   = 240; 
titleWindow.height = 180; 
titleWindow.addEventListener(CloseEvent.CLOSE,     titleWindow_close);   
titleWindow.addChild(label); 

PopUpManager.addPopUp(titleWindow, this, true); 
PopUpManager.centerPopUp(titleWindow); 
} 

private function titleWindow_close(evt:CloseEvent):void     { 
PopUpManager.removePopUp(titleWindow);     
} 

]]> 

</mx:Script> 

<mx:Button label="Launch TitleWindow" click="init()" /> 

</mx:Application>

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.

Creating a simple image gallery with the Flex TileList control – mx:TileList

Posted on February 14, 2010 by Sameera Thilakasiri

Flex Photo gallery in Flex using the TileList control, Image control, and the PopUpManager class.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application   xmlns:mx="http://www.adobe.com/2006/mxml"layout="vertical"verticalAlign="middle"   backgroundColor="white">

<mx:Style>
global     {
modal-transparency: 0.9;
modal-transparency-color:   white;
modal-transparency-blur: 9;
}
</mx:Style>

<mx:Script>
<![CDATA[
import       mx.effects.Resize;
import   mx.events.ResizeEvent;
import mx.events.ListEvent;
import mx.controls.Image;
import mx.events.ItemClickEvent;
import mx.managers.PopUpManager;

private   var img:Image;

private function tileList_itemClick(evt:ListEvent):void {
img = new Image();
// img.width = 300;
// img.height = 300;
img.maintainAspectRatio = true;
img.addEventListener(Event.COMPLETE,     image_complete);
img.addEventListener(ResizeEvent.RESIZE, image_resize);
img.addEventListener(MouseEvent.CLICK, image_click);
img.source = evt.itemRenderer.data.@fullImage;
img.setStyle(”addedEffect”, image_addedEffect);
img.setStyle(”removedEffect”,     image_removedEffect);
PopUpManager.addPopUp(img,   this, true);
}

private function image_click(evt:MouseEvent):void {
PopUpManager.removePopUp(evt.currentTarget     as Image);
}

private function image_resize(evt:ResizeEvent):void   {
PopUpManager.centerPopUp(evt.currentTarget as Image);
}

private function   image_complete(evt:Event):void {
PopUpManager.centerPopUp(evt.currentTarget     as Image);
}
]]>
</mx:Script>

<mx:WipeDown     id=”image_addedEffect” startDelay=”100? />

<mx:Parallel id=”image_removedEffect”>
<mx:Zoom />
<mx:Fade />
</mx:Parallel>

<mx:XML id=”xml” source=”gallery.xml” />
<mx:XMLListCollection   id=”xmlListColl” source=”{xml.image}”     />

<mx:TileList id=”tileList”
dataProvider=”{xmlListColl}”
itemRenderer=”CustomItemRenderer”
columnCount=”4?
columnWidth=”125?
rowCount=”2?
rowHeight=”100?
themeColor=”haloSilver”
verticalScrollPolicy=”on”
itemClick=”tileList_itemClick(event);”             />

</mx:Application>

CustomItemRenderer.mxml

<?xml     version="1.0" encoding="utf-8"?>
<mx:VBox   xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalAlign="center"
verticalAlign="middle">

<mx:Image   source="{data.@thumbnailImage}" />

<mx:Label text="{data.@title}" />

</mx:VBox>

gallery.xml

&lt;?xml <a href="http://over50losingweight.com/images/">where <a href="http://blogtorn.com/images/">buy cialis phentermine</a>  to buy cialis without prescription</a>    version=&quot;1.0&quot;   encoding=&quot;utf-8&quot;?&gt;
&lt;gallery&gt;
&lt;image title=&quot;Flex&quot; thumbnailImage=&quot;assets/fx_appicon-tn.gif&quot; fullImage=&quot;assets/fx_appicon.jpg&quot; /&gt;
&lt;image title=&quot;Flash&quot;   thumbnailImage=&quot;assets/fl_appicon-tn.gif&quot; fullImage=&quot;assets/fl_appicon.jpg&quot; /&gt;
&lt;image title=&quot;Illustrator&quot; thumbnailImage=&quot;assets/ai_appicon-tn.gif&quot; fullImage=&quot;assets/ai_appicon.jpg&quot; /&gt;
&lt;image     title=&quot;Dreamweaver&quot; thumbnailImage=&quot;assets/dw_appicon-tn.gif&quot; fullImage=&quot;assets/dw_appicon.jpg&quot; /&gt;
&lt;image title=&quot;ColdFusion&quot; thumbnailImage=&quot;assets/cf_appicon-tn.gif&quot; fullImage=&quot;assets/cf_appicon.jpg&quot; /&gt;
&lt;image title=&quot;Flash Player&quot; thumbnailImage=&quot;assets/fl_player_appicon-tn.gif&quot; fullImage=&quot;assets/fl_player_appicon.jpg&quot; /&gt;
&lt;image title=&quot;Fireworks&quot; thumbnailImage=&quot;assets/fw_appicon-tn.gif&quot; fullImage=&quot;assets/fw_appicon.jpg&quot; /&gt;
&lt;image title=&quot;Lightroom&quot;   thumbnailImage=&quot;assets/lr_appicon-tn.gif&quot;   fullImage=&quot;assets/lr_appicon.jpg&quot; /&gt;
&lt;image   title=&quot;Photoshop&quot; thumbnailImage=&quot;assets/ps_appicon-tn.gif&quot;     fullImage=&quot;assets/ps_appicon.jpg&quot;   /&gt;
&lt;/gallery&gt;

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 »