<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Flexshishak&#039;s Blog</title>
	<atom:link href="http://flexpandit.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://flexpandit.wordpress.com</link>
	<description>Just another WordPress.com site</description>
	<lastBuildDate>Wed, 16 Jun 2010 14:15:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='flexpandit.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Flexshishak&#039;s Blog</title>
		<link>http://flexpandit.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://flexpandit.wordpress.com/osd.xml" title="Flexshishak&#039;s Blog" />
	<atom:link rel='hub' href='http://flexpandit.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Flex Tutorials &#8211; Sorting Date’s on ArrayCollection in Flex</title>
		<link>http://flexpandit.wordpress.com/2010/06/16/flex-tutorials-sorting-date%e2%80%99s-on-arraycollection-in-flex/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/16/flex-tutorials-sorting-date%e2%80%99s-on-arraycollection-in-flex/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:05:15 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[Flex for Beginners II]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=892</guid>
		<description><![CDATA[First things first, read about the mx.collections.Sort Class before going in to the code below. About the Post,suppose i have a AC[ArrayCollection] like below; [Bindable] private var arrClldetails:ArrayCollection = new ArrayCollection([ {Fname:&#34;Ravi&#34;, Lname:&#34;chengalva&#34;, dob:&#34;21 Sep 79&#34;}, {Fname:&#34;Ram&#34;, Lname:&#34;Boda&#34;, dob:&#34;11 Jun 80&#34;}, {Fname:&#34;Amatya&#34;, Lname:&#34;kotamraju&#34;, dob:&#34;16 July 81&#34;}, {Fname:&#34;Reddy&#34;, Lname:&#34;Lakki&#34;, dob:&#34;15 Feb 72&#34;}, {Fname:&#34;Shreya&#34;, Lname:&#34;REddy&#34;, dob:&#34;02 Jan [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=893&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">First things first, read about the mx.collections.Sort Class before going in to the code below.</p>
<p>About the Post,suppose i have a AC[ArrayCollection] like below;</p>
<p><b><font size="2">[Bindable]<br />
private var arrClldetails:ArrayCollection = new ArrayCollection([<br />
{Fname:&quot;Ravi&quot;, Lname:&quot;chengalva&quot;, dob:&quot;21 Sep 79&quot;},<br />
{Fname:&quot;Ram&quot;, Lname:&quot;Boda&quot;, dob:&quot;11 Jun 80&quot;},<br />
{Fname:&quot;Amatya&quot;, Lname:&quot;kotamraju&quot;, dob:&quot;16 July 81&quot;},<br />
{Fname:&quot;Reddy&quot;, Lname:&quot;Lakki&quot;, dob:&quot;15 Feb 72&quot;},<br />
{Fname:&quot;Shreya&quot;, Lname:&quot;REddy&quot;, dob:&quot;02 Jan 74&quot;},<br />
{Fname:&quot;Gautam&quot;, Lname:&quot;Goud&quot;, dob:&quot;18 Oct 76&quot;},<br />
{Fname:&quot;Shiva&quot;, Lname:&quot;Dromraju&quot;, dob:&quot;30 Mar 79&quot;},<br />
{Fname:&quot;Suresh&quot;, Lname:&quot;Vali&quot;, dob:&quot;19 Dec 79&quot;},<br />
{Fname:&quot;Kalyani&quot;, Lname:&quot;Rayavarapu&quot;, dob:&quot;05 Dec 80&quot;},<br />
{Fname:&quot;Abhay&quot;, Lname:&quot;Reddy&quot;, dob:&quot;26 Apr 77&quot;},<br />
{Fname:&quot;Priya&quot;, Lname:&quot;chengalva&quot;, dob:&quot;31 Mar 82&quot;}<br />
]);</font></b></p>
<p>Now i want to Sort the “dob” Date field in the AC.,so for this i need to write a compareFunction for Sort which in turn is applied to the AC like below,</p>
<p><b><font size="2">//Compare Function<br />
private function fnCompareFunction(ObjA:Object,ObjB:Object,fields:Array =<br />
null):int<br />
{<br />
//fnDtfParceFunct is a Date parse function avail in DownloadCode.<br />
var dateA:Date=fnDtfParceFunct(ObjA.dob,”DD/MM/YY”);<br />
var dateB:Date=fnDtfParceFunct(ObjB.dob,”DD/MM/YY”);<br />
return ObjectUtil.dateCompare(dateA, dateB);<br />
}</font></b></p>
<p>Now apply this CompareFunction to Sort and then apply that to AC like below,</p>
<p><b><font size="2">var sort:Sort=new Sort();<br />
sort.compareFunction=fnCompareFunction;<br />
arrClldetails.sort=sort;<br />
</font></b><br />
Now refresh the AC for Sort to take effect,</p>
<p><b><font size="2">arrClldetails.refresh();</font></b></p>
<p><font color="#0000FF">Source code:</font></p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;<br />
verticalAlign=&quot;middle&quot;&gt;</p>
<p>&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.controls.DateField;<br />
import mx.utils.ObjectUtil;<br />
import mx.collections.Sort;<br />
import mx.collections.ArrayCollection;<br />
[Bindable]<br />
private var arrClldetails:ArrayCollection = new ArrayCollection([<br />
{Fname:&quot;Ravi&quot;, Lname:&quot;chengalva&quot;, dob:&quot;21 Sep 79&quot;},<br />
{Fname:&quot;Ram&quot;, Lname:&quot;Boda&quot;, dob:&quot;11 Jun 80&quot;},<br />
{Fname:&quot;Amatya&quot;, Lname:&quot;kotamraju&quot;, dob:&quot;16 July 81&quot;},<br />
{Fname:&quot;Reddy&quot;, Lname:&quot;Lakki&quot;, dob:&quot;15 Feb 72&quot;},<br />
{Fname:&quot;Shreya&quot;, Lname:&quot;REddy&quot;, dob:&quot;02 Jan 74&quot;},<br />
{Fname:&quot;Gautam&quot;, Lname:&quot;Goud&quot;, dob:&quot;18 Oct 76&quot;},<br />
{Fname:&quot;Shiva&quot;, Lname:&quot;Dromraju&quot;, dob:&quot;30 Mar 79&quot;},<br />
{Fname:&quot;Suresh&quot;, Lname:&quot;Vali&quot;, dob:&quot;19 Dec 79&quot;},<br />
{Fname:&quot;Kalyani&quot;, Lname:&quot;Rayavarapu&quot;, dob:&quot;05 Dec 80&quot;},<br />
{Fname:&quot;Abhay&quot;, Lname:&quot;Reddy&quot;, dob:&quot;26 Apr 77&quot;},<br />
{Fname:&quot;Priya&quot;, Lname:&quot;chengalva&quot;, dob:&quot;31 Mar 82&quot;}<br />
]);<br />
private function fnClick():void<br />
{<br />
var sort:Sort=new Sort();<br />
sort.compareFunction=fnCompareFunction;<br />
arrClldetails.sort=sort;<br />
arrClldetails.refresh();<br />
}<br />
private function fnCompareFunction(ObjA:Object,ObjB:Object,fields:Array =<br />
null):int<br />
{<br />
var dateA:Date=fnDtfParceFunct(ObjA.dob,&quot;DD/MM/YY&quot;);<br />
var dateB:Date=fnDtfParceFunct(ObjB.dob,&quot;DD/MM/YY&quot;);<br />
return ObjectUtil.dateCompare(dateA, dateB);<br />
}<br />
public function fnDtfParceFunct(valueString:String, inputFormat:String):Date<br />
{<br />
return DateField.stringToDate(dateFormatter.format(valueString),inputFormat);<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
&lt;mx:DateFormatter id=&quot;dateFormatter&quot; formatString=&quot;DD/MM/YY&quot;/&gt;<br />
&lt;mx:Button label=&quot;Sort on Date&quot; click=&quot;fnClick()&quot;/&gt;<br />
&lt;mx:DataGrid id=&quot;dg&quot; width=&quot;370&quot; height=&quot;212&quot; dataProvider=&quot;{arrClldetails}&quot;&gt;<br />
&lt;mx:columns&gt;<br />
&lt;mx:DataGridColumn headerText=&quot;First Name&quot; dataField=&quot;Fname&quot;/&gt;<br />
&lt;mx:DataGridColumn headerText=&quot;Last Name&quot; dataField=&quot;Lname&quot;/&gt;<br />
&lt;mx:DataGridColumn headerText=&quot;Date of Birth&quot; dataField=&quot;dob&quot;/&gt;<br />
&lt;/mx:columns&gt;<br />
&lt;/mx:DataGrid&gt;</p>
<p>&lt;/mx:Application&gt; </font></b></font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/893/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=893&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/16/flex-tutorials-sorting-date%e2%80%99s-on-arraycollection-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>
	</item>
		<item>
		<title>Flex 3 Custom validation of grouped input fields</title>
		<link>http://flexpandit.wordpress.com/2010/06/16/flex-drag-and-drop-the-definitive-tutorial/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/16/flex-drag-and-drop-the-definitive-tutorial/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 11:33:36 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[Flex for Beginners II]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=787</guid>
		<description><![CDATA[Introduction Flex 3 has nicely build-in validation mechanism, but sometimes you wish they had not embedded this so deep into the components, that customization becomes a laborish task. I have also read many articles on customizations of this mechanism, but I have not found a working solution to my specific wish. What I want is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=787&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial"><font color="#FF0000">Introduction</font></p>
<p>Flex 3 has nicely build-in validation mechanism, but sometimes you wish they had not embedded this so deep into the components, that customization becomes a laborish task. I have also read many articles on customizations of this mechanism, but I have not found a working solution to my specific wish. What I want is validation of single input fields, multiple input and arbitrary placement of errors besides the tooltip method.</p>
<p><font color="#FF0000">Requirements</font></p>
<p>* Flex Builder 3<br />
* Tutorial code (See step 7 for both files)</p>
<p><font color="#0000FF">Steps</font></p>
<p>Now I am going to describe the steps I took to create this validator.<br />
<font color="#FF0000">Step 1</font></p>
<p>I have created a Flex (web) project in my workspace. In this project I have 1 mxml file (my application file). I have named this ValidationTutorial.mxml.</p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;<br />
xmlns:local=&quot;*&quot;&gt;<br />
&lt;/mx:Application&gt;</font></b></p>
<p>In this mxml I will put 3 input field (day, month, year) in a hbox. Furthermore I will place a hidden Label below the hbox. These are my basic components that I will be using to demonstrate the multiple input validator</p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;<br />
xmlns:local=&quot;*&quot;&gt;<br />
&lt;mx:HBox&gt;<br />
&lt;mx:TextInput id=&quot;day&quot; /&gt;<br />
&lt;mx:TextInput id=&quot;month&quot; /&gt;<br />
&lt;mx:TextInput id=&quot;year&quot; /&gt;<br />
&lt;/mx:HBox&gt;<br />
&lt;mx:Label id=&quot;errorMsgbirthdayValidationModel&quot; visible=&quot;false&quot; includeInLayout=&quot;false&quot;/&gt;<br />
&lt;/mx:Application&gt;<br />
</font></b></p>
<p><font color="#FF0000">Step 2</font></p>
<p>Code our custom validator. Now we have to create the validator. file -&gt; new -&gt; actionscript class and call it BirthdayValidator (make it extend Validator). override the protected function doValidation, put a call to super.doValidation(value) in it and we have our foundation for the validator in place. Your actionscript class should look as follows</p>
<p><b><font size="2">package {</p>
<p>public class BirthdayValidator extends Validator {</p>
<p>public function BirthdayValidator() {<br />
super();<br />
}</p>
<p>override protected function doValidation(value:Object):Array {<br />// Init the results array with the basic validation <br />
var results:Array = super.doValidation(value);<br />
return results;<br />
}</p>
<p>}<br />
}</font></b></p>
<p><font color="#FF0000">Step 3</font></p>
<p>This is a relatively small step, but contains the magic that will enable me to validate and control the output regarding 3 input fields. Make a mental note of the valError element, which I will use later on.</p>
<p><b><font size="2">&lt;mx:Model id=&quot;birthdayValidationModel&quot;&gt;<br />
&lt;date&gt;<br />
&lt;birthday&gt;<br />
&lt;day&gt;{day.text}&lt;/day&gt;<br />
&lt;month&gt;{month.text}&lt;/month&gt;<br />
&lt;year&gt;{year.text}&lt;/year&gt;<br />
&lt;valError&gt;&lt;/valError&gt;<br />
&lt;/birthday&gt;<br />
&lt;/date&gt;<br />
&lt;/mx:Model&gt;</font></b></p>
<p><font color="#FF0000">Step 4</font></p>
<p>We define the validator and link all components together. this means we are going to tell the validator that the source for validation is our model and the results will be displayed in the label. If you now run the application, nothing will happen when tabbing across the fields. This is because we have not defined the triggers for the validator and the actual implementation of the validator.<br />
We will put this on the last input with focusOut. The implementation for the validator is for tutorial purpose simple.</p>
<p><b><font size="2">&lt;local:BirthdayValidator<br />
id=&quot;birthdayVal&quot;<br />
required=&quot;true&quot;<br />
source=&quot;{birthdayValidationModel}&quot;<br />
property=&quot;birthday&quot;<br />
listener=&quot;{errorMsgbirthdayValidationModel}&quot;<br />
trigger=&quot;{year}&quot;<br />
triggerEvent=&quot;focusOut&quot;/&gt;</font></b></p>
<p>We are now close to a working example.</p>
<p><font color="#FF0000">Step 5</font></p>
<p>Now we define the invalid handler and the valid handler. These methods will contain code to set/unset validation texts. Configure them into the validator and edit the label so that it responds to the errors in it. When you have done this, you will see validation results below the inputs when you enter no values and focusOut on the year input (last input field).</p>
<p><b><font size="2">&lt;local:BirthdayValidator<br />
id=&quot;birthdayVal&quot;<br />
required=&quot;true&quot;<br />
source=&quot;{birthdayValidationModel}&quot;<br />
property=&quot;birthday&quot;<br />
listener=&quot;{errorMsgbirthdayValidationModel}&quot;<br />
trigger=&quot;{year}&quot;<br />
triggerEvent=&quot;focusOut&quot;<br />
invalid=&quot;onInvalidHandler(event)&quot;<br />
valid=&quot;onValidHandler(event)&quot;/&gt;<br />
</font></b><br />
And the methods….</p>
<p>/<b><font size="2">**<br />
* Validationresult event handler. This function<br />
* places the validation results into the appropriate<br />
* label for error text placement beneath an input<br />
* text.<br />
*<br />
* @param event Results of the input box(es) validation<br />
*/<br />
public static function onInvalidHandler( event:ValidationResultEvent ):void {<br />
var _error:String = &quot;&quot;;<br />
var validator:Validator = event.target as Validator;<br />
for each ( var result:ValidationResult in event.results ) {<br />
_error+=result.errorCode;<br />
}<br />
// All validation results will be displayed in a label component<br />
var errorLabel:Label = validator.listener as Label;<br />
errorLabel.text = _error;<br />
event.stopImmediatePropagation();<br />
}</p>
<p>/**<br />
* Validation result handler. This function removes all<br />
* error texts from the error label for the current input<br />
* component.<br />
*<br />
* @param event Results of the input box(es) validation<br />
*/<br />
public static function onValidHandler( event:ValidationResultEvent ):void {<br />
var _error:String = &quot;&quot;;<br />
var validator:Validator = event.target as Validator;<br />
// All validation results will be displayed in a label component<br />
var errorLabel:Label = validator.listener as Label;<br />
errorLabel.text = _error;<br />
event.stopImmediatePropagation();<br />
}</font></b></p>
<p><font color="#FF0000">Step 6</font></p>
<p>Add styling. Just some nice sugar, but styling is everything. Add this styling to your  ValidationTutorial.mxml And add the following method to the script to use this styling.<br />Add to the 3 input field the following property</p>
<p><b><font size="2">styleName=&quot;{ValidatorUtil.showErrorBorder((birthdayValidationModel.birthday.valError<br />
as XML), this.day)}&quot;</font></b></p>
<p><font color="#FF0000">Step 7</font></p>
<p>Now comes the 4th element in the mx:model into focus. When you run the application you will see deep blue borders, but they do not change to red borders were there is an error detected by the validation. For this to work we need to programaticly fill the error element to reflect the inputs that are invalid.<br />This we will do in the validator and a helper method in our ValidationTutorial.mxml</p>
<p><font color="#0000FF">The BirthdayValidator</font></p>
<p><b><font size="2">package {<br />
import mx.validators.ValidationResult;<br />
import mx.validators.Validator;</p>
<p>public class BirthdayValidator extends Validator {</p>
<p>private static const ERROR_START_ELEMENT_TAG:String = &quot;&lt;errorElement&gt;&quot;;<br />
private static const ERROR_END_ELEMENT_TAG:String = &quot;&lt;/errorElement&gt;&quot;;<br />
private static const ERROR_DAY_TAG:String = &quot;&lt;error&gt;day&lt;/error&gt;&quot;;<br />
private static const ERROR_MONTH_TAG:String = &quot;&lt;error&gt;month&lt;/error&gt;&quot;;<br />
private static const ERROR_YEAR_TAG:String = &quot;&lt;error&gt;year&lt;/error&gt;&quot;;</p>
<p>public function BirthdayValidator() {<br />
super();<br />
}</p>
<p>override protected function doValidation(value:Object):Array {<br />
var day:String = value.day;<br />
var month:String = value.month;<br />
var year:String = value.year;<br />
var errorString:String = ERROR_START_ELEMENT_TAG;</p>
<p>// Init the results array with the basic validation <br />
var results:Array = super.doValidation(value);<br />
if (day == &quot;&quot; || day == null) {<br />
// Texts and codes need to be refactered out of this util<br />
// into a text file<br />
results.push(new ValidationResult(true,<br />
&quot;day&quot;, &quot;noDay&quot;, &quot; No day&quot;));<br />
errorString += ERROR_DAY_TAG;<br />
}<br />
// Check month field.<br />
if (month == &quot;&quot; || month == null) {<br />
// Texts and codes need to be refactered out of this util<br />
// into a text file<br />
results.push(new ValidationResult(true,<br />
&quot;month&quot;, &quot;noMonth&quot;, &quot; No month&quot;));<br />
errorString += ERROR_MONTH_TAG;<br />
}<br />
// Check month field.<br />
if (year == &quot;&quot; || year == null) {<br />
// Texts and codes need to be refactered out of this util<br />
// into a text file<br />
results.push(new ValidationResult(true,<br />
&quot;year&quot;, &quot;noYear&quot;, &quot; No year&quot;));<br />
errorString += ERROR_YEAR_TAG;<br />
}<br />
errorString += ERROR_END_ELEMENT_TAG;<br />
value.valError = new XML(errorString);<br />
return results;<br />
}</p>
<p>}<br />
}</font></b></p>
<p><font color="#0000FF">The ValidatorTutorial.mxml</font></p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;<br />
xmlns:local=&quot;*&quot;&gt;</p>
<p>&lt;mx:Style&gt;</p>
<p>.errorBorderStyle {</p>
<p>border-color: red;<br />
border-style: solid;<br />
border-thickness: 2px;<br />
border-thickness-bottom: 2px;<br />
border-thickness-left: 2px;<br />
border-thickness-right: 2px;<br />
border-thickness-top: 2px;</p>
<p>}</p>
<p>.defaultBorderStyle {</p>
<p>border-color: blue;<br />
border-style: solid;<br />
border-thickness: 2px;<br />
border-thickness-bottom: 2px;<br />
border-thickness-left: 2px;<br />
border-thickness-right: 2px;<br />
border-thickness-top: 2px;</p>
<p>}</p>
<p>&lt;/mx:Style&gt;</p>
<p>&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.core.UIComponent;<br />
import mx.validators.ValidationResult;<br />
import mx.validators.Validator;<br />
import mx.events.ValidationResultEvent;</p>
<p>/**<br />
* Validationresult event handler. This function<br />
* places the validation results into the appropriate<br />
* label for error text placement beneath an input<br />
* text.<br />
*<br />
* @param event Results of the input box(es) validation<br />
*/<br />
public static function onInvalidHandler( event:ValidationResultEvent ):void {<br />
var _error:String = &quot;&quot;;<br />
var validator:Validator = event.target as Validator;<br />
for each ( var result:ValidationResult in event.results ) {<br />
_error+=result.errorCode;<br />
}<br />
// All validation results will be displayed in a label component<br />
var errorLabel:Label = validator.listener as Label;<br />
errorLabel.text = _error;<br />
event.stopImmediatePropagation();<br />
}</p>
<p>/**<br />
* Validation result handler. This function removes all<br />
* error texts from the error label for the current input<br />
* component.<br />
*<br />
* @param event Results of the input box(es) validation<br />
*/<br />
public static function onValidHandler( event:ValidationResultEvent ):void {<br />
var _error:String = &quot;&quot;;<br />
var validator:Validator = event.target as Validator;<br />
// All validation results will be displayed in a label component<br />
var errorLabel:Label = validator.listener as Label;<br />
errorLabel.text = _error;<br />
event.stopImmediatePropagation();<br />
}</p>
<p>/**<br />
* Function reserved for complex objects. In this we mean mx:model<br />
* type objects for multi input validations. (dates where day,month,year<br />
* are seperated input controls).<br />
*<br />
* @param errors A xmllist of elements containing the controls that need<br />
* or do not need error styling.<br />
* @param input the control we like to style.<br />
* @return the new styling information.<br />
*/<br />
public static function showErrorBorder( errors:XML, input:UIComponent ):String {<br />
var styleName:String = &quot;defaultBorderStyle&quot;;<br />
// Check for not null, otherwise the flashplayer<br />
// will silently ignore the nullpointer and break off<br />
// any further styling for the target control<br />
if ( errors != null &amp;&amp; errors.error != null ) {<br />
for each ( var error:XML in errors.error ) {<br />
if ( error == input.id ) {<br />
styleName = &quot;errorBorderStyle&quot;;<br />
break;<br />
}<br />
}<br />
}<br />
return styleName;<br />
}</p>
<p>]]&gt;<br />
&lt;/mx:Script&gt;</p>
<p>&lt;mx:Model id=&quot;birthdayValidationModel&quot;&gt;<br />
&lt;date&gt;<br />
&lt;birthday&gt;<br />
&lt;day&gt;{day.text}&lt;/day&gt;<br />
&lt;month&gt;{month.text}&lt;/month&gt;<br />
&lt;year&gt;{year.text}&lt;/year&gt;<br />
&lt;valError&gt;&lt;/valError&gt;<br />
&lt;/birthday&gt;<br />
&lt;/date&gt;<br />
&lt;/mx:Model&gt;</p>
<p>&lt;mx:HBox&gt;</p>
<p>&lt;mx:TextInput id=&quot;day&quot; styleName=&quot;{showErrorBorder((birthdayValidationModel.birthday.valError<br />
as XML), this.day)}&quot;/&gt;<br />
&lt;mx:TextInput id=&quot;month&quot; styleName=&quot;{showErrorBorder((birthdayValidationModel.birthday.valError<br />
as XML), this.month)}&quot;/&gt;<br />
&lt;mx:TextInput id=&quot;year&quot; styleName=&quot;{showErrorBorder((birthdayValidationModel.birthday.valError<br />
as XML), this.year)}&quot;/&gt;</p>
<p>&lt;/mx:HBox&gt;</p>
<p>&lt;mx:Label id=&quot;errorMsgbirthdayValidationModel&quot; visible=&quot;{errorMsgbirthdayValidationModel.text!=&#8221;}&quot;<br />
includeInLayout=&quot;{errorMsgbirthdayValidationModel.text!=&#8221;}&quot;/&gt;</p>
<p>&lt;local:BirthdayValidator<br />
id=&quot;birthdayVal&quot;<br />
required=&quot;true&quot;<br />
source=&quot;{birthdayValidationModel}&quot;<br />
property=&quot;birthday&quot;<br />
listener=&quot;{errorMsgbirthdayValidationModel}&quot;<br />
trigger=&quot;{year}&quot;<br />
triggerEvent=&quot;focusOut&quot;<br />
invalid=&quot;onInvalidHandler(event)&quot;<br />
valid=&quot;onValidHandler(event)&quot;/&gt;</p>
<p>&lt;/mx:Application&gt;</font></b></font></p>
<h4><font color="#0000FF">Final note</font></h4>
<p><font face="Arial">And now the magic is complete. You have build a multiple input validator, with error message customization and placement. You can add many enhancement, that I will leave up to your imagination.</font></p>
<p><font face="Arial">I hope you enjoy coding Flex/ActionScript as I do.</font></p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/787/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=787&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/16/flex-drag-and-drop-the-definitive-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://flexpandit.wordpress.com/2010/06/16/hello-world/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/16/hello-world/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:33:11 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://flexpandit.wordpress.com/?p=1</guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=1&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=1&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/16/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>
	</item>
		<item>
		<title>Flex Tutorials &#8211; Drag-and-Drop in Flex</title>
		<link>http://flexpandit.wordpress.com/2010/06/14/flex-tutorials-using-image-inside-the-sprite-in-flex/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/14/flex-tutorials-using-image-inside-the-sprite-in-flex/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 18:42:13 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[Flex for Beginners]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=861</guid>
		<description><![CDATA[Drag-and-drop lets you move components and transfer data in a Flex application via the mouse and ubiquitous &#34;click-drag-drop&#34; paradigm. All Flex components support drag-and-drop operations with the proper enablement. Overview of Drag-and-Drop Drag-and-drop operations have three main stages: initiation, dragging, and dropping. Initiation, Dragging, and Dropping Initiation of a drag-and-drop operation occurs when a &#34;drag-enabled&#34; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=861&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">Drag-and-drop lets you move components and transfer data in a Flex application via the mouse and ubiquitous &quot;click-drag-drop&quot; paradigm. All Flex components support drag-and-drop operations with the proper enablement.</p>
<p>Overview of Drag-and-Drop</p>
<p>Drag-and-drop operations have three main stages: initiation, dragging, and dropping.<br />
Initiation, Dragging, and Dropping<br />
Initiation of a drag-and-drop operation occurs when a &quot;drag-enabled&quot; component is selected with the mouse and moved while holding down the mouse button. The component selected and dragged is called the drag initiator. A drag source object is created for holding data related to the drag session.</p>
<p>Dragging occurs when the user, still holding down the mouse button, moves the drag initiator component around the application. While a component is being dragged Flex will display an image called a drag proxy.<br />
Dropping is the action of releasing the drag initiator component over a drop target. A potential drop target can inspect the drag source and determine whether to allow (or accept) a drop.</p>
<p>Example:</p>
<p>We&#8217;re going to follow these steps to learn about Drag-and-Drop in Flex:<br />
1.Create a Project and Application<br />
2.Create some Boxes (one for dragging, one for dropping)<br />
3.Make the Red Box Draggable<br />
4.Make the Blue Box a Drop Target<br />
5.Handle the Drop<br />
6.Show Feedback<br />
7.Use Drag Source</p>
<p><font color="#0000FF"><b>Step 1: Create a Project and Application</b></font></p>
<p>Create a Flex Project: FlexTutorials<br />First we&#8217;ll want to create a Flex Project to hold this, and potentially other, tutorial applications. If you&#8217;ve already completed another Flex After Dark Tutorial, you can use the same project, or a different one.<br />
To create a new Flex project using Flex/Flash Builder:<br />
1. Select File &gt; New Flex Project<br />
2. Give your project a name (i.e. FlexTutorials)</p>
<p><font color="#FF0000">I&#8217;ve created a Flex Project for holding my tutorial application. </font></font></p>
<hr />
<p><font face="Arial"><b>Create a Flex Application: DragDrop.mxml</b><br />Next we&#8217;ll create a new MXML Application called &quot;DragDrop&quot; (or anything you want really). This MXML file will hold all of our code for this tutorial.<br />To create a new Flex project using Flex/Flash Builder:<br />
Select File &gt; New MXML Application<br />Give your application a filename (i.e. DragDrop)<br />
The fresh application will look something like the following code.</p>
<p>The fresh application will look something like the following code.</font></p>
<p><font face="Arial"><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot;&gt;</p>
<p>&lt;/mx:Application&gt;</font></b></font></p>
<p><font face="Arial">Let&#8217;s update the application code a little:<br />
Change the layout attribute to be &quot;vertical&quot;<br />
Add a name attribute with a value of &quot;Drag and Drop Tutorial&quot;</p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; <br />
name=&quot;Drag and Drop Tutorial&quot;&gt;</p>
<p>&lt;/mx:Application&gt;</font></b></font></p>
<p><font face="Arial"><font color="#FF0000">I&#8217;ve created a Flex Application for holding my Drag-and-Drop tutorial code.</font></font></p>
<hr />
<p><font face="Arial"><b>Add an init() function</b><br />
Next we&#8217;re going to finish our application setup by adding a &lt;mx:Script&gt; block and init() function. The &lt;mx:Script&gt; block will hold our application&#8217;s ActionScript and the init() function will be called when our application starts.<br />
Add the &lt;mx:Script&gt; and init() function:<br />
Add a &lt;mx:Script&gt; block to your application<br />
Add an init() function (empty for now)<br />
Call the init() function on creationComplete</p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; <br />
name=&quot;Drag and Drop Tutorial&quot;<br />
creationComplete=&quot;init()&quot;&gt;<br />
</font></b><br />
<b><font size="2">&lt;mx:Script&gt;<br />
&lt;![CDATA[</p>
<p>public function init():void<br />
{</p>
<p>}</p>
<p>]]&gt;<br />
&lt;/mx:Script&gt;<br />
&lt;/mx:Application&gt;</font></b></font></p>
<p><font face="Arial">We&#8217;re going to use the &lt;mx:Script&gt; block in a future step to setup listeners.<br />
<font color="#FF0000">I&#8217;ve added an init() function to my application&#8217;s &lt;mx:Script&gt;.</font></font></p>
<hr />
<p><font face="Arial"><b><font color="#0000FF">Step 2: Create some Boxes<br /></font></b><br />
Create a Red Box and a Blue Box<br />
Next were going to use MXML to create a Red Box and a Blue Box for our application. We&#8217;ll add the following code inside our &lt;mx:Application&gt; tag in application&#8217;s MXML file.</font></p>
<p><font face="Arial"><b><font size="2">&lt;mx:HBox horizontalGap=&quot;100&quot;&gt;<br />
&lt;mx:Canvas id=&quot;redBox&quot; width=&quot;100&quot; height=&quot;100&quot; backgroundColor=&quot;Red&quot; /&gt;<br />
&lt;mx:Canvas id=&quot;blueBox&quot; width=&quot;100&quot; height=&quot;100&quot; backgroundColor=&quot;Blue&quot; /&gt;<br />
&lt;/mx:HBox&gt;</font></b></font></p>
<p><font face="Arial">We can now launch our application for the first time and see the results.<br />
To launch your DragDrop application using Flex/Flash Builder:<br />
Select Run &gt; Run DragDrop from the main application menu<br />
The result should look like this, with a Red Box and Blue Box.<br />
We&#8217;ll start the fun drag-and-drop stuff in the next step.<br />
<font color="#FF0000">I&#8217;ve created two boxes, one red and one blue, in MXML.</font></font></p>
<hr />
<p><font face="Arial"><b><font color="#0000FF">Step 3: Make the Red Box Draggable </font></b> </p>
<p>Initiation of a drag-and-drop operation occurs when a &quot;drag-enabled&quot; component is selected with the mouse and moved while holding down the mouse button. The component selected and dragged is called the drag initiator.<br />
Red Box listens for Mouse Event<br />To kick off a drag-n-drop, we&#8217;ll need to listen for a &quot;mouse down&quot; MouseEvent for the component to be dragged.<br />
Add listener for MouseEvent.MOUSE_DOWN to the init() function<br />
Determine drag initiator and call DragManager&#8217;s beginDrag() function</font></p>
<p><font face="Arial"><b><font size="2">public function init():void<br />
{<br />
// a mouseDown event will start the drag<br />
this.redBox.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );<br />
}</p>
<p>public function beginDrag( mouseEvent:MouseEvent ):void<br />
{<br />
&#8230;<br />
}</font></b></font></p>
<p><font face="Arial">We&#8217;ll cover the beginDrag() method in the next step&#8230;<br /><font color="#FF0000">I&#8217;ve made the Red Box draggable by adding a &quot;mouse down&quot; listener. </font></font></p>
<hr />
<p><font face="Arial"><b>Start the Drag using DragManager</b><br />
Dragging occurs when the user, still holding down the mouse button, moves the drag initiator component around the application.<br />
The mx.managers.DragManager class is used for managing drag-and-drop operations for Flex applications. All its methods and properties are static, so you do not need to create an instance of it.</p>
<p>Here we&#8217;ll fill in our beginDrag() function that handles our &quot;mouse down&quot; event.</font></p>
<p><font face="Arial"><b><font size="2">import mx.core.DragSource;<br />
import mx.core.IUIComponent;<br />
import mx.managers.DragManager;<br />
&#8230;</p>
<p>public function beginDrag( mouseEvent:MouseEvent ):void<br />
{<br />
// the drag initiator is the object being dragged (target of the mouse event)<br />
var dragInitiator:IUIComponent = mouseEvent.currentTarget as IUIComponent;</p>
<p>// the drag source contains data about what&#8217;s being dragged<br />
var dragSource:DragSource = new DragSource();</p>
<p>// ask the DragManger to begin the drag<br />
DragManager.doDrag( dragInitiator, dragSource, mouseEvent, null );<br />
}</font></b></font></p>
<p><font face="Arial">The above code accomplishes the following:<br />
We use the mouse event&#8217;s currentTarget (the Red Box) as the drag initiator<br />
We create a drag source object (we&#8217;ll come back to this later in the tutorial)<br />
We call the DragManager.doDrag() function to begin the drag operation</p>
<p>The Red Box is now draggable (though you can&#8217;t yet drop it anywhere).<br />
<font color="#FF0000">I&#8217;ve drag-enabled the Red Box by passing it as a drag initiator to the DragManager.</font></font></p>
<p><font face="Arial">Note the new imports we used in the above code:</p>
<p>import mx.core.DragSource;<br />
import mx.core.IUIComponent;<br />
import mx.managers.DragManager;</font></p>
<hr />
<p><font face="Arial"><b><font color="#0000FF">Step 4: Make the Blue Box a Drop Target</font><br />
</b></p>
<p>Our next step is to make the Blue Box a drop target capable of accepting a drop. To do this we must first add an event listener for the DragEvent.DRAG_ENTER event to our Blue Box.<br />
The DragEvent.DRAG_ENTER event occurs when a drag initiator is dragged over another component during a drag-drop operation.</font></p>
<p><font face="Arial"><b><font size="2">import mx.events.DragEvent;</p>
<p>&#8230;</p>
<p>public function init():void<br />
{<br />
// a mouseDown event will start the drag<br />
this.redBox.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );</p>
<p>// accepting a drag/drop operation&#8230;<br />
this.blueBox.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );<br />
}</p>
<p>public function acceptDrop( dragEvent:DragEvent ):void<br />
{<br />
&#8230;<br />
}</font></b><br />
We&#8217;ll code out the acceptDrop function next to actually accept the drop.<br /><font color="#FF0000">By adding a &quot;drag enter&quot; event listener.<br />
</font>Note the new import we used in the above code:<br />
<b><font size="2">import mx.events.DragEvent;<br />
</font></b>Accept the Drop using DragManager<br />
To accept the drop we must notify the DragManager with a drop target (the Blue<br />
Box) in response to the DragEvent.DRAG_ENTER event.<br />
&nbsp;</font></p>
<p><font face="Arial"><b><font size="2">public function acceptDrop(<br />
dragEvent:DragEvent ):void<br />
{<br />
var dropTarget:IUIComponent = dragEvent.currentTarget as IUIComponent;</p>
<p>// accept the drop<br />
DragManager.acceptDragDrop( dropTarget );<br />
}</font></b></font></p>
<p><font face="Arial"><br />
Now that we have accepted the drop we can let go of the Red Box on the Blue Box. Nothing exciting happens when we drop, yet, that&#8217;ll be in our next step when we handle the drop.</p>
<p>The Red Box can be dragged to and dropped on the Blue Box.<br />
<font color="#FF0000">I&#8217;ve drop-enabled the Blue Box by passing it as a //drop target// to the DragManager.</font></font></p>
<hr />
<p><font face="Arial"><b><font color="#0000FF">Step 5: Handle the Drop<br /></font></b><br />
Handling the drop is the magic step of a drag-drop operation where your application performs the &quot;business logic&quot; of dragging an initiator to a target.<br />We are notified of a drop by adding a DragEvent.DRAG_DROP event listener on a drop target.</font></p>
<p><font face="Arial"><br />
<b><font size="2">public function init():void<br />
{<br />
// a mouseDown event will start the drag<br />
this.redBox.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );</p>
<p>// accepting a drag/drop operation&#8230;<br />
this.blueBox.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );</p>
<p>// handling the drop&#8230;<br />
this.blueBox.addEventListener( DragEvent.DRAG_DROP, handleDrop );<br />
}</p>
<p>public function handleDrop( dragEvent:DragEvent ):void<br />
{<br />
var dragInitiator:IUIComponent = dragEvent.dragInitiator;<br />
var dropTarget:IUIComponent = dragEvent.currentTarget as IUIComponent;</p>
<p>Alert.show( &quot;You dropped the Red Box on the Blue Box!&quot; );<br />
}</font></b></font></p>
<p><font face="Arial">When the listener function of a DragEvent.DRAG_DROP event is called we can get the drag initiator and drop target from the event as seen in the code above.<br />Our example for this tutorial simply shows an Alert message when a drop is completed.</p>
<p>When the Red Box is dropped on the Blue Box we get alerted.<br />
<font color="#FF0000">I&#8217;ve handled the drop by adding a &quot;drag drop&quot; event listener to the Blue Box.<br />
</font>Note the new import we used in the above code:</p>
<p>import mx.controls.Alert;</font></p>
<hr />
<p><font face="Arial"><font color="#0000FF"><b>Step 6: Show Feedback</b></font></p>
<p>The DragManager provides a static showFeedback() function that can be used to display what type of drop operation will be performed. The feedback is shown as a small icon next the cursor when the drag initiator is over an accepting drop target.<br />
DragManager feedback types:<br />
COPY &#8211; signifies that the drop will copy some data<br />
LINK &#8211; signifies that the drop will link some data<br />
MOVE &#8211; signifies that the drop will move some data<br />
NONE &#8211; no feedback (default)</font></p>
<p><font face="Arial"><b><font size="2">public function acceptDrop(<br />
dragEvent:DragEvent ):void<br />
{<br />
var dropTarget:IUIComponent = dragEvent.currentTarget as IUIComponent;</p>
<p>// accept the drop<br />
DragManager.acceptDragDrop( dropTarget );</p>
<p>// show feedback<br />
DragManager.showFeedback( DragManager.COPY );<br />
}</font></b></font></p>
<p><font face="Arial">The last line of code above shows how we call DragManager.showFeedback() passing the DragManager.COPY value. Notice now when the Red Box is held over the Blue Box we get a green &quot;copy&quot; icon next to the cursor showing the drag-drop operation will copy some data.</p>
<p>Thanks to feedback, the drop icon is now different, showing a &quot;copy&quot; action will<br />
be performed.<br />
<font color="#FF0000">I&#8217;ve enhanced the drag-drop by adding feedback support via the DragManager.</font></font></p>
<hr />
<p><font face="Arial"><font color="#0000FF"><b>Step 7: Use Drag Source</b></font></p>
<p>Back in Step 3 when we started the drag operation you may remember that we created a DragSource object to pass to the DragManager.doDrag() function.<br />A DragSource object is used to communicate data between the components of a drag-drop operation. We do this by putting data in the drag source when the drag begins that we can then inspect when deciding whether or not to accept a drop.<br />
Below we&#8217;ll modify our beginDrag() code to add data to the drag source using the addData() function.<br />
The addData() function takes two arguments:<br />
data:Object &#8211; object that specifies the drag data<br />
format:String &#8211; specifies the format of the data</font></p>
<p><b><font face="Arial" size="2">public function beginDrag(<br />
mouseEvent:MouseEvent ):void<br />
{<br />
// the drag initiator is the object being dragged (target of the mouse event)<br />
var dragInitiator:IUIComponent = mouseEvent.currentTarget as IUIComponent;</p>
<p>// the drag source contains data about what&#8217;s being dragged<br />
var dragSource:DragSource = new DragSource();</p>
<p>// add some information to the drag source<br />
dragSource.addData( &quot;Red&quot;, &quot;color&quot; );</p>
<p>// ask the DragManger to begin the drag<br />
DragManager.doDrag( dragInitiator, dragSource, mouseEvent, null );<br />
}</font></b></p>
<p><font face="Arial">Now we&#8217;ll modify our acceptDrop() function to only accept the drag-drop if the drag source has format data for the color (which we added above). To do this we get the dragSource property from the dragEvent and check if it has data of a specified format by calling dragSource.hasFormat() passing the format we&#8217;re looking for (&quot;color&quot;).</font></p>
<p><font face="Arial"><b><font size="2">public function acceptDrop(<br />
dragEvent:DragEvent ):void<br />
{<br />
var dropTarget:IUIComponent = dragEvent.currentTarget as IUIComponent;<br />
var dragSource:DragSource = dragEvent.dragSource;</p>
<p>// accept the drop if the drag source has a &quot;color&quot; format<br />
if( dragSource.hasFormat( &quot;color&quot; ) )<br />
{<br />
DragManager.acceptDragDrop( dropTarget );<br />
}<br />
}</font></b></font></p>
<p><font face="Arial">Obviously the drag source example we&#8217;ve used is quite simple, but we could put any data/format in the drag source to enable smart drag-drop operations.</p>
<p>Use DragSource to communicate data between the components of a drag-drop operation.<br /><font color="#FF0000">I&#8217;ve enhanced the drag-drop by adding information to the DragSource object.<br />
&nbsp;</font></font></p>
<p><a href='http://flexmaster.blog.co.in/files/2010/06/dragdrop1.swf'><strong>Click here to view the Demo</strong></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/861/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=861&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/14/flex-tutorials-using-image-inside-the-sprite-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>
	</item>
		<item>
		<title>AIR Tutorials &#8211; How to keep WindowApplication on top of the applications in AIR</title>
		<link>http://flexpandit.wordpress.com/2010/06/13/air-tutorials-how-to-keep-windowapplication-on-top-of-the-applications-in-air/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/13/air-tutorials-how-to-keep-windowapplication-on-top-of-the-applications-in-air/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 17:45:08 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[AIR]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=879</guid>
		<description><![CDATA[The following example shows how you can keep a WindowedApplication container on top of other windows in Adobe AIR by setting the Boolean alwaysInFront property. &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;mx:WindowedApplication name=&#34;WindowedApplication_alwaysInFront_test&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34; alwaysInFront=&#34;{checkBox.selected}&#34;&#62; &#60;mx:ApplicationControlBar dock=&#34;true&#34;&#62; &#60;mx:Form styleName=&#34;plain&#34;&#62; &#60;mx:FormItem label=&#34;alwaysInFront:&#34;&#62; &#60;mx:CheckBox id=&#34;checkBox&#34; /&#62; &#60;/mx:FormItem&#62; &#60;/mx:Form&#62; &#60;/mx:ApplicationControlBar&#62; &#60;/mx:WindowedApplication&#62;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=879&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">The following example shows how you can keep a WindowedApplication container on top of other windows in Adobe AIR by setting the Boolean <b><font color="#0000FF">alwaysInFront</font> </b>property.</p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:WindowedApplication name=&quot;WindowedApplication_alwaysInFront_test&quot;<br />
xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;<br />
layout=&quot;vertical&quot;<br />
verticalAlign=&quot;middle&quot;<br />
backgroundColor=&quot;white&quot;<br />
alwaysInFront=&quot;{checkBox.selected}&quot;&gt;<br />
&lt;mx:ApplicationControlBar dock=&quot;true&quot;&gt;<br />
&lt;mx:Form styleName=&quot;plain&quot;&gt;<br />
&lt;mx:FormItem label=&quot;alwaysInFront:&quot;&gt;<br />
&lt;mx:CheckBox id=&quot;checkBox&quot; /&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;/mx:Form&gt;<br />
&lt;/mx:ApplicationControlBar&gt;<br />
&lt;/mx:WindowedApplication&gt;</font></b></font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/879/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=879&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/13/air-tutorials-how-to-keep-windowapplication-on-top-of-the-applications-in-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>
	</item>
		<item>
		<title>AIR Tutorials &#8211; How to open a NativeWindow in  Adobe AIR?</title>
		<link>http://flexpandit.wordpress.com/2010/06/13/air-tutorials-how-to-open-a-nativewindow-in-adobe-air/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/13/air-tutorials-how-to-open-a-nativewindow-in-adobe-air/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 14:46:13 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[AIR]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=872</guid>
		<description><![CDATA[The following example shows how you can launch a new “normal” or “utility” NativeWindow container in Adobe AIR by creating a NativeWindowInitOptions object, specifying the type property to one of the static constants in the NativeWindowType class, and passing the NativeWindowInitOptions object to the NativeWindow constructor. And from the documentation: Constants for the valid values [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=872&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">The following example shows how you can launch a new “normal” or “utility” NativeWindow container in Adobe AIR by creating a NativeWindowInitOptions object, specifying the type property to one of the static constants in the NativeWindowType class, and passing the NativeWindowInitOptions object to the NativeWindow constructor.</p>
<p>And from the documentation:</p>
<p>Constants for the valid values of this property are defined in the NativeWindowType class:</p>
<p>* <font color="#0000FF">NativeWindowType.NORMAL</font> — A typical window. Normal windows use full-size chrome and appear on the Windows task bar and the Mac OS X window menu.<br />
* <font color="#0000FF">NativeWindowType.UTILITY</font> — A tool palette. Utility windows use a slimmer version of the system chrome and do not appear on the Windows task bar and the Mac OS-X window menu.<br />
<br />* <font color="#0000FF">NativeWindowType.LIGHTWEIGHT</font> — lightweight windows cannot have system chrome and do not appear on the Windows task bar and the Mac OS X window menu. In addition, lightweight windows do not have the System (Alt-Space) menu on Windows. Lightweight windows are suitable for notification bubbles and controls such as combo-boxes that open a short-lived display area. When the lightweight type is used, systemChrome must be set to none.<br />
<a href="http://flexpandit.files.wordpress.com/2010/06/normal.jpg"><img src="http://flexpandit.files.wordpress.com/2010/06/normal.jpg?w=500&#038;h=403" alt="" width="500" height="403" class="aligncenter size-full wp-image-875" /></a><br />Normal Window<br /><a href="http://flexpandit.files.wordpress.com/2010/06/utility.jpg"><img src="http://flexpandit.files.wordpress.com/2010/06/utility.jpg?w=500&#038;h=403" alt="" width="500" height="403" class="aligncenter size-full wp-image-876" /></a><br />Utility Window<br />
<br />
<b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</p>
<p>&lt;mx:WindowedApplication name=&quot;NativeWindowInitOptions_type_test&quot;<br />
xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;<br />layout=&quot;vertical&quot;&gt;</p>
<p>&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
private var opts:NativeWindowInitOptions;<br />
private var win:NativeWindow;</p>
<p>private function btn_click():void {<br />
opts = new NativeWindowInitOptions();<br />
opts.type = cBox.selectedItem.toString();</p>
<p>win = new NativeWindow(opts);<br />
win.title = opts.type;<br />
win.width = 320;<br />
win.height = 200;<br />
win.activate();<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;</p>
<p>&lt;mx:ApplicationControlBar dock=&quot;true&quot;&gt;<br />
&lt;mx:Label text=&quot;type:&quot; /&gt;<br />
&lt;mx:ComboBox id=&quot;cBox&quot; dataProvider=&quot;[normal,utility]&quot; /&gt;<br />
&lt;/mx:ApplicationControlBar&gt;</p>
<p>&lt;mx:Button label=&quot;Launch {cBox.selectedItem} window&quot;<br />
click=&quot;btn_click();&quot; /&gt;</p>
<p>&lt;/mx:WindowedApplication&gt;</font></b></p>
<p>Due to popular demand, here is the “same” example in a more ActionScript friendly format:</p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:WindowedApplication name=&quot;NativeWindowInitOptions_type_test&quot;<br />
xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;<br />
layout=&quot;vertical&quot;<br />
initialize=&quot;init();&quot;&gt;</p>
<p>&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.containers.ApplicationControlBar;<br />
import mx.controls.Button;<br />
import mx.controls.ComboBox;<br />
import mx.controls.Label;</p>
<p>private var opts:NativeWindowInitOptions;<br />
private var win:NativeWindow;<br />
private var cBox:ComboBox;</p>
<p>private function init():void {<br />
var arr:Array = [NativeWindowType.NORMAL, NativeWindowType.UTILITY];</p>
<p>var lbl:Label = new Label();<br />
lbl.text = &quot;type:&quot;;</p>
<p>cBox = new ComboBox();<br />
cBox.dataProvider = arr;</p>
<p>var appControlBar:ApplicationControlBar = new ApplicationControlBar();<br />
appControlBar.dock = true;<br />
appControlBar.addChild(lbl);<br />
appControlBar.addChild(cBox);<br />
addChildAt(appControlBar, 0);</p>
<p>var btn:Button = new Button();<br />
btn.label = &quot;Launch window&quot;;<br />
btn.addEventListener(MouseEvent.CLICK, btn_click);<br />
addChild(btn);<br />
}</p>
<p>private function btn_click(evt:MouseEvent):void {<br />
opts = new NativeWindowInitOptions();<br />
opts.type = cBox.selectedItem.toString();</p>
<p>win = new NativeWindow(opts);<br />
win.title = opts.type;<br />
win.width = 320;<br />
win.height = 200;<br />
win.activate();<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;</p>
<p>&lt;/mx:WindowedApplication&gt;</font></b></font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/872/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=872&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/13/air-tutorials-how-to-open-a-nativewindow-in-adobe-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>

		<media:content url="http://flexpandit.files.wordpress.com/2010/06/normal.jpg" medium="image" />

		<media:content url="http://flexpandit.files.wordpress.com/2010/06/utility.jpg" medium="image" />
	</item>
		<item>
		<title>Flex Tutorials &#8211; Module Based Application In Flex 3.0</title>
		<link>http://flexpandit.wordpress.com/2010/06/12/flex-tutorials-module-based-application-in-flex-30/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/12/flex-tutorials-module-based-application-in-flex-30/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 10:47:46 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[Flex for Beginners II]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=866</guid>
		<description><![CDATA[Flex Modules are code functionality compiled to dynamically-loadable SWF files that can be loaded and unloaded by an application at run-time. Modules let you split your application into several pieces, or modules. The main application, or loader, can dynamically load other modules that it requires, when it needs them. It does not have to load [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=866&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">Flex Modules are code functionality compiled to dynamically-loadable SWF files that can be loaded and unloaded by an application at run-time.<br />
<br />Modules let you split your application into several pieces, or modules. The main application, or loader, can dynamically load other modules that it requires, when it needs them. It does not have to load all modules when it starts, nor does it have to load any modules if the user does not interact with them.</p>
<p>Any number of applications can share a module, but a module cannot be run by itself, independently of an application.</p>
<p>Using Module in flex 3.0 based application is one of the best approach from the performance perspective. The importance of the module based application increases when this is a big one application.One of the major benifit by using module is the independecy during development phase. Let uppose I am dividing my Project in 3 modules for the assigment of development to 3 developers.Now these 3 people can develop their own module(here module is reffering general term of Software Engineering)by using the Module(Flex 3.0&#8242;s Module).The another and main benifit is related to the performance.Let suppose my final swf’s size is 3 MB. So for using the application we have to load this 3 MB’s SWf. But let suppose I divide my Application in 3 modules then definetly the size of the Module will be one third of the Application.Now when I have to use the first Module I will load only it.When I have to use Second Module I Will simply unload the first one and will Load Second one.Hence my memory Consumption will be One by third of the Earlear non Module based approach.Further we can also divide a Module in to the other Modules so this can be done up to any level.The important thing is to divide your needs in such small unit of requirements. This will increase your performance in a amazing way. Here one thing which should must added is that the swf generated after the compilation of the Module will not show you any thing if you will run it separetly. If you have to use it then it is must to load it at Application level. It is also allowed that if you load a module A into another module B then only after Loading B at Application level you can access module A.</p>
<p>Its all the theory related to the Modules now come to the implementation…………………………..</p>
<p>Open your Flex Builder and create a new Flex Project as I named it ‘ModuleBasedApplication’.Now<br />
under the ’src’ folder create the folder structure as I have created.Here I am creating three folders under ‘modules’ folder named ‘mod1&#8242;,’mod2&#8242; and ‘mod3&#8242; for putting three modules.Look at Below.<br /><a href="http://flexpandit.files.wordpress.com/2010/06/1.png"><img src="http://flexpandit.files.wordpress.com/2010/06/1.png?w=461&#038;h=436" alt="" width="461" height="436" class="aligncenter size-full wp-image-867" /></a></p>
<p>Now you Have to place Module inside mod1,mod2 and mod3 folders.Just goto File &gt; New &gt;MXML Module as below.Name it ‘Mod1&#8242; and then put it into ‘mod1&#8242;.Simlarly create ‘Mod2&#8242; Module in ‘mod2&#8242; folder and ‘Mod3&#8242; Module in ‘mod3&#8242; folder.</p>
<p><a href="http://flexpandit.files.wordpress.com/2010/06/2.png"><img src="http://flexpandit.files.wordpress.com/2010/06/2.png?w=400&#038;h=432" alt="" width="400" height="432" class="aligncenter size-full wp-image-868" /></a><br />
<br />Now you have added the modules and you can code according to your use,for example I have simply placed one Label inside each which is just showing the name of that particular Module i.e Mod1,Mod2 or Mod3.Now go to the ‘Properties‘ of you project on Right Mouse Pressing on it you will find a window on the left of which you can see the ‘Flex Modules’ tab.Just click on this tab.A window with title ‘Flex Modules’ will open.At the right corner of this window is a ‘Add’ button click on it,‘Add Module’ window will open.Click on the ‘Borwse’ button then you will find ‘Select Module‘ window.Now just select the Module which you have to add as here ‘Mod1.MXML’ is selected,and then click OK’.Again click ‘OK’ on ‘Add Module’ window.<br /><a href="http://flexpandit.files.wordpress.com/2010/06/3.png"><img src="http://flexpandit.files.wordpress.com/2010/06/3.png?w=300&#038;h=241" alt="" width="300" height="241" class="alignnone size-medium wp-image-869" /></a></p>
<p>Similarly add all other Modules.Yours Modules has been added and now just compile your project.After building it you will find the structure as below your project’s ‘bin-debug’ folder.</p>
<p>Now I am giving you the code related to the Application file in which I am showing these modules separetly on the click of a tab of TabBar.On click of each tab a separate module is can be seen.Just copy and paste the code below into your Application file i.e. main file.</p>
<hr />
<br />
<b><font size="2">&lt;?xml version=”1.0&#8243; encoding=”utf-8&#8243;?&gt;<br />
&lt;mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”horizontal”<br />
width=”60%” height=”60%” left=”15&#8243; right=”15&#8243; top=”15&#8243; bottom=”15&#8243;<br />
backgroundColor=”#000000&#8243;&gt;<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.collections.ArrayCollection;</p>
<p>private var acTabBar:ArrayCollection=new ArrayCollection([<br />
{data:'tab1',label:'tab1'},<br />
{data:'tab2',label:'tab2'},<br />
{data:'tab3',label:'tab3'}<br />
])<br />
]]&gt;</p>
<p>&lt;/mx:Script&gt;<br />
&lt;mx:VBox width=”100%” height=”100%” left=”150&#8243; right=”150&#8243; top=”150&#8243;<br />
bottom=”150&#8243;&gt;<br />
&lt;mx:TabBar id=”tabModules” width=”80%” height=”25&#8243; dataProvider=”{acTabBar}” /&gt;<br />
&lt;mx:ViewStack id=”v1Vstk” width=”100%” height=”100%” selectedIndex=”{tabModules.selectedIndex}”&gt;<br />
&lt;mx:ModuleLoader url=”com\myProject\modules\mod1\Mod1.swf” width=”100%”<br />
height=”100%”/&gt;<br />
&lt;mx:ModuleLoader url=”com\myProject\modules\mod2\Mod2.swf” width=”100%”<br />
height=”100%”/&gt;<br />
&lt;mx:ModuleLoader url=”com\myProject\modules\mod3\Mod3.swf” width=”100%”<br />
height=”100%”/&gt;<br />
&lt;/mx:ViewStack&gt;<br />
&lt;/mx:VBox&gt;<br />
&lt;/mx:Application&gt;</font></b></p>
<hr />
<br />After this once again compile your Application.You will find a TabBar there as below on the click of which’s tabs you will find different modules.</font></p>
<p><a href='http://flexmaster.blog.co.in/files/2010/06/modules.swf'><strong>Click here to view the Demo</strong></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/866/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=866&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/12/flex-tutorials-module-based-application-in-flex-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>

		<media:content url="http://flexpandit.files.wordpress.com/2010/06/1.png" medium="image" />

		<media:content url="http://flexpandit.files.wordpress.com/2010/06/2.png" medium="image" />

		<media:content url="http://flexpandit.files.wordpress.com/2010/06/3.png?w=300" medium="image" />
	</item>
		<item>
		<title>Flex Tutorial &#8211; Using Image Inside the Sprite in Flex</title>
		<link>http://flexpandit.wordpress.com/2010/06/12/flex-tutorial-using-image-inside-the-sprite-in-flex/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/12/flex-tutorial-using-image-inside-the-sprite-in-flex/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 09:41:25 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[Flex for Beginners II]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=864</guid>
		<description><![CDATA[If we want to add any Image inside the Sprite class in flex,then It is not possible to add image inside the sprite. But if your requirement is as such in that case you can achieve this by adding the Loader inside the sprite. Below is the code for the same. MainApplication.mxml &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=864&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">If we want to add any Image inside the Sprite class in flex,then It is not possible to add image inside the sprite. But if your requirement is as such in that case you can achieve this by adding the Loader inside the sprite. Below is the code for the same.</p>
<p><font color="#0000FF">MainApplication.mxml</font></p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;<br />
layout=&quot;absolute&quot; creationComplete=&quot;createSpriteWithBitmap()&quot;&gt;<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.controls.Image;<br />
private function createSpriteWithBitmap():void<br />
{<br />
var sp : SpriteWithBitmap = new SpriteWithBitmap();<br />
can.rawChildren.addChild( sp );<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
&lt;mx:Canvas id=&quot;can&quot; x=&quot;200&quot; y=&quot;200&quot;/&gt;<br />
&lt;/mx:Application&gt;<br />
</font></b><br />
<font color="#0000FF">SpriteWithBitmap (actionscript file)</font></p>
<p><b><font size="2">package<br />
{<br />
import flash.display.Loader;<br />
import flash.display.Sprite;<br />
import flash.events.*;<br />
import flash.net.URLRequest;</p>
<p>import mx.controls.Alert;</p>
<p>public class SpriteWithBitmap extends Sprite<br />
{<br />
//Pass the source path or url here.<br />
private var url:String = &quot;http://flexmaster.blog.co.in/files/2010/06/lotusflower.jpeg&quot;;</p>
<p>public function SpriteWithBitmap()<br />
{<br />
loadImg();<br />
}<br />
private function loadImg():void<br />
{<br />
var loader:Loader = new Loader();<br />
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadFailure);<br />
var request:URLRequest = new URLRequest(url);<br />
loader.load(request);<br />
this.addChild(loader);<br />
}</p>
<p>private function loadFailure(event:IOErrorEvent):void<br />
{<br />
Alert.show(&quot;Can&#8217;t load :&quot; + url);<br />
}<br />
}</p>
<p>}</font></b></font></p>
<p><a href='http://flexmaster.blog.co.in/files/2010/06/new2.swf'><strong>Click here to view the Demo</strong></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/864/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/864/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/864/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=864&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/12/flex-tutorial-using-image-inside-the-sprite-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>
	</item>
		<item>
		<title>Adobe AIR and SQLite Connectivity</title>
		<link>http://flexpandit.wordpress.com/2010/06/12/adobe-air-and-sqlite-connectivity/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/12/adobe-air-and-sqlite-connectivity/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 09:25:09 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[AIR]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=858</guid>
		<description><![CDATA[Abode AIR provides very easy mechanism to connect to the SQLite.I am doing the connectivity by coding. Here nothing different just create the connection and create the SQLConnection,open it, create SQLStatement and execute them, close connection.Upto my experience I think this is the same common way which we used in any database connectivity. So there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=858&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">Abode AIR provides very easy mechanism to connect to the SQLite.I am doing the connectivity by coding. Here nothing different just create the connection and create the SQLConnection,open it, create SQLStatement and execute them, close connection.Upto my experience I think this is the same common way which we used in any database connectivity. So there is nothing special. I found this process very cool especially due the portable size of the SQLite and creating and deleting the database in just one mouse click. Apart form this you don’t require any thing else Flex Builder IDE with AIR. There is no software requirement for the SQLite.<br />I am just putting some line of code for your better understanding. You can just copy and paste it. Although Its just a small code but hope it will give you the over all idea about dealing with the database in an AIR application.<br />
<a href="http://flexpandit.files.wordpress.com/2010/06/new.jpg"><img src="http://flexpandit.files.wordpress.com/2010/06/new.jpg?w=500&#038;h=423" alt="" width="500" height="423" class="aligncenter size-full wp-image-859" /></a><br />
<br />Screen shot of Air and Sqlite Application<br />
<br />
<b><font color="#0000FF">Example: </font></b></p>
<p><b><font size="2">&lt;?xml version=”1.0&#8243; encoding=”utf-8&#8243;?&gt;</p>
<p>&lt;mx:WindowedApplication xmlns:mx=”http://www.adobe.com/2006/mxml”<br />
layout=”vertical” creationComplete=”init()”<br />
width=”500” height=”400” backgroundColor=”#000000“&gt;<br />
&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[<br />
import mx.controls.Alert;<br />
import mx.collections.ArrayCollection;<br />
import flash.data.*;</p>
<p>private var ob:Array=new Array();<br />
public var mysqlConnection:SQLConnection;<br />
public var _createProdct:SQLStatement;<br />
public var _insertProduct:SQLStatement;<br />
public var _selectProduct:SQLStatement;</p>
<p>private const _counterProduct:int = 1;<br />
private var databaseFile:File =<br />
File.applicationStorageDirectory.resolvePath(&quot;data.db&quot;);<br />
private const CREATE_PRODUCT_TABLE:String =<br />
&quot;CREATE TABLE product (id INTEGER PRIMARY KEY,name TEXT,&quot; +<br />
&quot;department TEXT, title TEXT, description TEXT);&quot;</p>
<p>private var _id:int;<br />
private var _name:String;<br />
private var _department:String;<br />
private var _title:String;<br />
private var _description:String;</p>
<p>private var INSERT_PRODUCT:String;<br />
private const SELECT_PRODUCT:String = &quot;SELECT * FROM product&quot;;</p>
<p>public function createDatabase(databaseFile:File, productCount:int):void<br />
{<br />
if ((databaseFile != null) &amp;&amp; (databaseFile.exists))<br />
{<br />
databaseFile.deleteFile();<br />
dg1.dataProvider=null;<br />
Alert.show(&quot;Database Created Successfully.&quot;);<br />
}</p>
<p>if (productCount &lt; 1)<br />
{<br />
productCount = 1;<br />
}</p>
<p>mysqlConnection = new SQLConnection();<br />
mysqlConnection.open(databaseFile, SQLMode.CREATE);<br />
mysqlConnection.close();<br />
schemaGeneration();<br />
}</p>
<p>public function deleteDatabase():void<br />
{<br />
if ((databaseFile != null) &amp;&amp; (databaseFile.exists))<br />
{<br />
databaseFile.deleteFile();<br />
dg1.dataProvider=null;<br />
Alert.show(&quot;Database Deleted Successfully.&quot;);<br />
}<br />
else<br />
{<br />
Alert.show(&quot;There is no database to Delete.&quot;);<br />
}<br />
}</p>
<p>private function schemaGeneration():void<br />
{<br />
var sqlStatement:SQLStatement = new SQLStatement();<br />
mysqlConnection=new SQLConnection();<br />
sqlStatement.sqlConnection = mysqlConnection;<br />
mysqlConnection.open(databaseFile, SQLMode.CREATE);<br />
sqlStatement.text = CREATE_PRODUCT_TABLE;<br />
sqlStatement.execute();<br />
mysqlConnection.close();<br />
}</p>
<p>private function createInsertStatements():void<br />
{<br />
if((txt1.text !=&quot;&quot;)&amp;&amp;(txt2.text !=&quot;&quot;)&amp;&amp;(txt3.text !=&quot;&quot;)<br />
&amp;&amp;(txt4.text !=&quot;&quot;))<br />
{<br />
_id=0;<br />
_name=txt1.text;<br />
_department=txt2.text;<br />
_title=txt3.text;<br />
_description=txt4.text;</p>
<p>if((databaseFile != null) &amp;&amp; (databaseFile.exists))<br />
{<br />
INSERT_PRODUCT=&quot;INSERT INTO product (id, name, department, title, description)&quot;<br />
+<br />
&quot; VALUES (&quot;+&quot;((SELECT max(id) FROM product)+1)&quot;+&quot;,'&quot;+_name+&quot;','&quot;+_department+<br />
&quot;','&quot;+_title+&quot;','&quot;+_description+&quot;');&quot;;<br />
_insertProduct =new SQLStatement();<br />
mysqlConnection=new SQLConnection();<br />
_insertProduct.sqlConnection= mysqlConnection;<br />
mysqlConnection.open(databaseFile, SQLMode.CREATE);<br />
_insertProduct.text = INSERT_PRODUCT;<br />
_insertProduct.execute();<br />
mysqlConnection.close();<br />
createSelectStatements();<br />
clearAll();<br />
}<br />
else<br />
{<br />
Alert.show(&quot;There is no database so please create it First.&quot;);<br />
}<br />
}<br />
else<br />
{ <br />
Alert.show(&quot;Please enter the proper values For all the relative fields.&quot;);<br />
}<br />
}</p>
<p>private function createSelectStatements():void<br />
{<br />
_selectProduct =new SQLStatement();<br />
mysqlConnection=new SQLConnection();<br />
_selectProduct.sqlConnection = mysqlConnection;<br />
mysqlConnection.open(databaseFile,SQLMode.READ);<br />
_selectProduct.text = SELECT_PRODUCT;<br />
_selectProduct.execute();<br />
ob=_selectProduct.getResult().data;<br />
mysqlConnection.close();<br />
dg1.dataProvider=ob;<br />
}</p>
<p>private function clearAll():void<br />
{<br />
txt1.text=&quot;&quot;;<br />
txt2.text=&quot;&quot;;<br />
txt3.text=&quot;&quot;;<br />
txt4.text=&quot;&quot;;<br />
}<br />
]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p>&lt;mx:VBox width=”100%” height=”100%” horizontalAlign=”center“&gt;</p>
<p>&lt;mx:HBox width=”80%” height=”30” horizontalAlign=”center“&gt;</p>
<p>&lt;mx:Label width=”120” textAlign=”right” text=”Name” color=”#ff0000“/&gt;</p>
<p>&lt;mx:TextInput id=”txt1” width=”120” height=”35“/&gt;</p>
<p>&lt;/mx:HBox&gt;</p>
<p>&lt;mx:HBox width=”80%” height=”30” horizontalAlign=”center“&gt;</p>
<p>&lt;mx:Label width=”120” textAlign=”right” text=”Department” color=”#ff0000“/&gt;</p>
<p>&lt;mx:TextInput id=”txt2” width=”120” height=”35“/&gt;</p>
<p>&lt;/mx:HBox&gt;</p>
<p>&lt;mx:HBox width=”80%” height=”30” horizontalAlign=”center“&gt;</p>
<p>&lt;mx:Label width=”120” textAlign=”right” text=”Title” color=”#ff0000“/&gt;</p>
<p>&lt;mx:TextInput id=”txt3” width=”120” height=”35“/&gt;</p>
<p>&lt;/mx:HBox&gt;</p>
<p>&lt;mx:HBox width=”80%” height=”30” horizontalAlign=”center“&gt;</p>
<p>&lt;mx:Label width=”120” textAlign=”right” text=”Description” color=”#ff0000“/&gt;</p>
<p>&lt;mx:TextInput id=”txt4” width=”120” height=”35“/&gt;</p>
<p>&lt;/mx:HBox&gt;</p>
<p>&lt;mx:HBox width=”80%” height=”100%” horizontalAlign=”center“&gt;</p>
<p>&lt;mx:DataGrid id=”dg1” width=”100%” height=”100%“&gt;</p>
<p>&lt;mx:columns&gt;</p>
<p>&lt;mx:DataGridColumn id=”idCol” width=”50” dataField=”id” headerText=”Id”<br />
textAlign=”center“/&gt;</p>
<p>&lt;mx:DataGridColumn id=”nameCol” width=”100” dataField=”name”<br />
headerText=”Name” textAlign=”center“/&gt;</p>
<p>&lt;mx:DataGridColumn id=”departmentCol” width=”100” dataField=”department”<br />
headerText=”Department” textAlign=”center“/&gt;</p>
<p>&lt;mx:DataGridColumn id=”titleCol” width=”100” dataField=”title“<br />
headerText=”Title” textAlign=”center“/&gt;</p>
<p>&lt;mx:DataGridColumn id=”descriptionCol” width=”200” dataField=”description“<br />
headerText=”Description” textAlign=”center“/&gt;</p>
<p>&lt;/mx:columns&gt;</p>
<p>&lt;/mx:DataGrid&gt;</p>
<p>&lt;/mx:HBox&gt;</p>
<p>&lt;mx:HBox width=”80%” height=”50” horizontalAlign=”center“&gt;</p>
<p>&lt;mx:Button id=”btnCreateDataBase” label=”Create DataBase” width=”130“<br />
click=”createDatabase(databaseFile,_counterProduct)”/&gt;</p>
<p>&lt;mx:Button id=”btnInsertIntoDataBase” label=”Insert into DataBase” width=”150”<br />
click=”createInsertStatements()”/&gt;<br />
&lt;mx:Button id=”btnDeleteDataBase” label=”Delete DataBase” width=”130”<br />
click=”deleteDatabase()”/&gt;<br />
&lt;/mx:HBox&gt; <br />
&lt;/mx:VBox&gt;<br />
&lt;/mx:WindowedApplication&gt;</font></b></font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/858/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/858/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/858/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/858/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/858/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/858/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/858/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/858/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/858/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/858/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/858/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/858/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/858/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/858/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=858&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/12/adobe-air-and-sqlite-connectivity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>

		<media:content url="http://flexpandit.files.wordpress.com/2010/06/new.jpg" medium="image" />
	</item>
		<item>
		<title>Have you built any components with actionscript? If so explain how you did it?</title>
		<link>http://flexpandit.wordpress.com/2010/06/11/have-you-built-any-components-with-actionscript-if-so-explain-how-you-did-it/</link>
		<comments>http://flexpandit.wordpress.com/2010/06/11/have-you-built-any-components-with-actionscript-if-so-explain-how-you-did-it/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 17:21:41 +0000</pubDate>
		<dc:creator>flexshishak</dc:creator>
				<category><![CDATA[Flex for Beginners]]></category>
		<category><![CDATA[Flex Interview Questions]]></category>

		<guid isPermaLink="false">http://flexmaster.blog.co.in/?p=834</guid>
		<description><![CDATA[You can create reusable components that use ActionScript, and reference these components in your Flex applications as MXML tags. Components created in ActionScript can contain graphical elements, define custom business logic, or extend existing Flex components. They can inherit from any components available in Flex. Defining your own components in ActionScript has several benefits. Components [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=834&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Arial">You can create reusable components that use ActionScript, and reference these components in your Flex applications as MXML tags. Components created in ActionScript can contain graphical elements, define custom business logic, or extend existing Flex components. They can inherit from any components available in Flex.</p>
<p>Defining your own components in ActionScript has several benefits. Components let you divide your applications into individual modules that you can develop and maintain separately. By implementing commonly used logic within custom components, you can build a suite of reusable components that you can share among multiple Flex applications.</p>
<p>Also, you can base your custom components on the set of Flex components by extending from the Flex class hierarchy. You can create custom versions of Flex visual controls, as well as custom versions on nonvisual components, such as data validators, formatters, and effects.</p>
<p>For example, you can define a custom button, derived from the Button control, in the myControls package, as the following example shows: </p>
<p>Flex Builder also has a wizard to help you create ActionScript components. To use it, select File &gt; New &gt; ActionScript Class. Because all classes must be in packages (like Java), you have the option of selecting a package name (if you don&#8217;t, you get the default unnamed package). The wizard also allows you to select a superclass. In the following example I&#8217;ve specified that the wizard<br />
should automatically generate the framework for the constructor:</p>
<p><b><font size="2">package SimpleComponents {<br />
import mx.controls.Button;</p>
<p>public class ASRedButton extends Button {<br />
public function ASRedButton() {<br />
super();<br />
}<br />
}<br />
}</font></b></p>
<p>The import statement was automatically created by Flex Builder, and the file&#8217;s name is ASRedButton.as. Although the component is created in ActionScript, it is available as MXML:</p>
<p><b><font size="2">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;/2006/mxml&quot; layout=&quot;absolute&quot; xmlns:local=&quot;*&quot;<br />
xmlns:SimpleComponents=&quot;SimpleComponents.*&quot;&gt;<br />
&lt;SimpleComponents:ASRedButton label=&quot;Not so Red&quot;/&gt;<br />
&lt;/mx:Application&gt;</font></b></font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexpandit.wordpress.com/834/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexpandit.wordpress.com/834/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexpandit.wordpress.com/834/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexpandit.wordpress.com/834/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexpandit.wordpress.com/834/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexpandit.wordpress.com/834/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexpandit.wordpress.com/834/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexpandit.wordpress.com/834/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexpandit.wordpress.com/834/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexpandit.wordpress.com/834/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexpandit.wordpress.com/834/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexpandit.wordpress.com/834/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexpandit.wordpress.com/834/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexpandit.wordpress.com/834/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexpandit.wordpress.com&amp;blog=14231829&amp;post=834&amp;subd=flexpandit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://flexpandit.wordpress.com/2010/06/11/have-you-built-any-components-with-actionscript-if-so-explain-how-you-did-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb1c750bc000af1a7c3954bb32688ecd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">flexshishak</media:title>
		</media:content>
	</item>
	</channel>
</rss>
