<?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>Flexism</title>
	<atom:link href="http://nishadmusthafa.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nishadmusthafa.wordpress.com</link>
	<description>Flash, flex and beyond</description>
	<lastBuildDate>Mon, 24 Oct 2011 10:19:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='nishadmusthafa.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/7b4d58e07aa8edb6897f3409ab2eb6d6?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Flexism</title>
		<link>http://nishadmusthafa.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nishadmusthafa.wordpress.com/osd.xml" title="Flexism" />
	<atom:link rel='hub' href='http://nishadmusthafa.wordpress.com/?pushpress=hub'/>
		<item>
		<title>The ActionScript&#8217;s in Keyword</title>
		<link>http://nishadmusthafa.wordpress.com/2010/04/15/the-actionscript-in-keyword/</link>
		<comments>http://nishadmusthafa.wordpress.com/2010/04/15/the-actionscript-in-keyword/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 12:53:03 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[ActionScript]]></category>

		<guid isPermaLink="false">http://nishadmusthafa.wordpress.com/?p=300</guid>
		<description><![CDATA[This is meant to be a very small blogpost. I was looking for some resources on what the ActionScript IN keyword achieves. I thought I&#8217;d put down my findings. Consider the statements: var Mapping:Object={hostComponent:&#8221;Button&#8221;,border:&#8221;3&#8243;,alpha:&#8221;.5&#8243;}; //var Mapping:Array=    new Array({hostComponent:&#8221;Button&#8221;,border:&#8221;3&#8243;,alpha:&#8221;.5&#8243;}); if(&#8220;hostComponent&#8221; in Mapping) { trace(&#8220;hostComponent exists as a key&#8221;); } else { trace(&#8220;hostComponent doesn&#8217;t exist as a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=300&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is meant to be a very small blogpost. I was looking for some resources on what the ActionScript IN keyword achieves. I thought I&#8217;d put down my findings.</p>
<p>Consider the statements:</p>
<p style="color:orange;"><strong>var Mapping:Object={hostComponent:&#8221;Button&#8221;,border:&#8221;3&#8243;,alpha:&#8221;.5&#8243;};<br />
//var Mapping:Array=    new Array({hostComponent:&#8221;Button&#8221;,border:&#8221;3&#8243;,alpha:&#8221;.5&#8243;});<br />
if(&#8220;hostComponent&#8221; in Mapping)<br />
{<br />
trace(&#8220;hostComponent exists as a key&#8221;);<br />
}<br />
else<br />
{<br />
trace(&#8220;hostComponent doesn&#8217;t exist as a key&#8221;);<br />
}<br />
if(&#8220;gradient&#8221; in Mapping)<br />
{<br />
trace(&#8220;gradient exists as a key&#8221;);<br />
}<br />
else<br />
{<br />
trace(&#8220;gradient doesn&#8217;t exist as a key&#8221;);<br />
}<br />
</strong></p>
<p>The statement</p>
<p style="color:orange;"><strong>if (&#8220;hostComponent&#8221; in Mapping)</strong></p>
<p>translates to &#8216;Is there a key in the hashmap <strong>Mapping</strong>(All Objects in Actionscript are hashmaps) that has the value &#8220;hostComponent&#8221;?&#8217;.</p>
<p>Notice that we use a string &#8220;hostComponent&#8221;. When you declare an Object like this:</p>
<p style="color:orange;"><strong>var Mapping:Object={hostComponent:&#8221;Button&#8221;,border:&#8221;3&#8243;,alpha:&#8221;.5&#8243;};<br />
</strong></p>
<p>The keys (hostComponent,border and alpha) to the left of the semicolon are converted to strings by the compiler. Hence, for our case of comparing the kind of keys we have used in our code, we need to use a string before the in keyword. Note that the LHS of the in keyword need not necessarily be a string. Please refer to Josh&#8217;s observations in the comments section.</p>
<p><a href="http://www.markedeals.com/" target="_blank">T</a>he output for the above section of code is</p>
<p><strong>hostComponent exists as a key</strong></p>
<p><strong>gradient doesn&#8217;t exist as a key</strong></p>
<p>The output is the same if Mapping is an Array instead of an object because the internal implementation is through Associative Arrays.</p>
<p><!--Session data--></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/300/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=300&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2010/04/15/the-actionscript-in-keyword/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>
	</item>
		<item>
		<title>Custom Spark Circular Menu using Flex 4</title>
		<link>http://nishadmusthafa.wordpress.com/2010/04/12/custom-spark-circular-menu-using-flex-4-2/</link>
		<comments>http://nishadmusthafa.wordpress.com/2010/04/12/custom-spark-circular-menu-using-flex-4-2/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 14:15:42 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[Circular Shapes in Flex]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Loading mulitple swfs using single SWFloader]]></category>
		<category><![CDATA[Spark Components]]></category>

		<guid isPermaLink="false">http://nishadmusthafa.wordpress.com/?p=282</guid>
		<description><![CDATA[I wanted to try my hand at creating a circular menu component using the new Spark components in Flex 4. Aesthetically, I felt a simple sector to represent each item of the menu wasn&#8217;t pleasing enough.  So instead, I went ahead and coded a primitive graphic called CircularTrapezoid. In simple terms, this is what you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=282&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:center;"><a href="http://nishadapps.appspot.com/CircularDataViewer.html" target="_blank"><img class="size-full wp-image-284 aligncenter" title="CDataViewer" src="http://nishadmusthafa.files.wordpress.com/2010/04/cdataviewer.png?w=453&#038;h=423" alt="" width="453" height="423" /></a></p>
<p>I wanted to try my hand at creating a circular menu component using the new Spark components in Flex 4. Aesthetically, I felt a simple <a href="http://en.wikipedia.org/wiki/Circular_sector" target="_blank">sector</a> to represent each item of the menu wasn&#8217;t pleasing enough.  So instead, I went ahead and coded a primitive graphic called CircularTrapezoid. In simple terms, this is what you would be left with if you removed a sector of smaller radius from a sector of larger radius.  The buttons in the picture of the component (See image above)  are of the Circular Trapezoidal shape.</p>
<p>So laying these CircularTrapezoids out in a circle, I got done with the menu and then I thought &#8220;Why not use the same component to represent hierarchical data?&#8221;:- Similar to the data in Ely Greenfield&#8217;s <a href="http://www.quietlyscheming.com/blog/components/randomwalk-component/" target="_blank">random walk component</a>. So I used the custom circular menu I&#8217;d made to represent the data at each level. The entire data can be fed in using XML and the component takes care of the internal splitting of input data into different layers. I also added a bread crumb for navigation and do note that I used the same CircularTrapezoid for skinning the buttons in the bread crumb.</p>
<p>I&#8217;ve used this hierarchical Data viewer in a simple application that categorizes a few music videos. The application requires a single SWFloader to load multiple youtube SWFs. I figured out how to do this thanks to a <a href="http://apiblog.youtube.com/2009/01/flex-embedded-player-christmas-story.html" target="_blank">blogpost</a> by Pamela Fox.</p>
<p>Here is a <a href="http://nishadapps.appspot.com/CircularDataViewer.html" target="_blank">Demo</a> of the component being used.</p>
<p>Click <a href="http://nishadapps.appspot.com/CircularDataViewerSource.zip" target="_blank">here</a> for the source code.</p>
<p><strong>Notes</strong></p>
<p>Here are a few things I made note of which I hope will prove useful to others.</p>
<ol>
<li><strong>Skin Contract:</strong> The skinning contract may sound like a lot of red tape initially. But looking back, it was the most useful feature I&#8217;ve ever worked it. The ease with which you can change the appearance of your component at a later stage is mind blowing.</li>
<li><strong>Shared Display Object:</strong> I had run into some unexpected behavior when I rotated the labels of the Circular Menu item buttons using the transformation matrix. Sometimes, whole CircularTrapezoids were not getting rendered. It&#8217;s then that I discovered the concept of Display Object Sharing among the elements of a group. Since I used matrix transformations in actionscript to perform the rotations, the framework could not make the necessary adjustments. I remedied this by enclosing the label in a Group exclusively meant for the label. Hence when changes were made to the layout of the label, the parent group made the necessary changes and rendered all its elements correctly.</li>
<li><strong>To code in Skin or not to code in Skin:</strong> With the new Skin architecture of flex 4, I had at many instances been confused about whether to write a particular segment of code within the skin or within the main component.  But later on, it became clear that any &#8220;visual&#8221; part of the component and especially one that can be subject to change should be coded in the skin.</li>
<li><strong>SkinPart</strong>: Despite the above argument, you do find some sections of skin declared again as a [SkinPart] within the main component. These should be items which you expect to find in all implementations of the component. For example, in &lt;s:Button/&gt; you will find a [SkinPart] labelDisplay declared with the component apart from being declared in the skin as all buttons have Labels.  They are probably declared as part of the main component for reasons like layouting or using data.</li>
<li><strong>Layout</strong>:  In my opinion, though layouting seems to be &#8220;visual&#8221; in nature, it must not be handled in the skin, unless if it’s for a part that’s exclusive to just that skin. It ought to handled in updateDisplayList() of the main component code.</li>
<li><strong>Difference between &lt;s:Wipe  and &lt; mx:Wipe : </strong>I tried using the new Spark Wipe effect by programmatically calling it using something like myWipe.play(). It didn&#8217;t work. I did some searching and found this <a href="http://forums.adobe.com/message/2026636" target="_blank">page</a>. So, to get the same behavior as the mx Wipe effect, you would have to use mx Wipe and the target should be enclosed within a halo container like mx:Box.</li>
</ol>
<p>I&#8217;m really looking forward to feedback on the component. Please do use the comments for feedback or queries if any.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/282/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=282&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2010/04/12/custom-spark-circular-menu-using-flex-4-2/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2010/04/cdataviewer.png" medium="image">
			<media:title type="html">CDataViewer</media:title>
		</media:content>
	</item>
		<item>
		<title>Reusing a Video stored in ByteArray format with the Flex VideoDisplay Component</title>
		<link>http://nishadmusthafa.wordpress.com/2010/02/17/reusing-a-video-stored-in-bytearray-format-with-the-flex-videodisplay-component/</link>
		<comments>http://nishadmusthafa.wordpress.com/2010/02/17/reusing-a-video-stored-in-bytearray-format-with-the-flex-videodisplay-component/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 06:33:51 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://nishadmusthafa.wordpress.com/?p=253</guid>
		<description><![CDATA[In my last blogpost, I had presented an application that would store audio, video and Image files as ByteArrays in a database. I explained there how to insert custom class objects into the database. In this post, I will show you how to reuse the Stored video(in the form of ByteArrays) and play it using [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=253&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my last blogpost, I had presented an application that would store audio, video and Image files as ByteArrays in a database. I explained there how to insert custom class objects into the database. In this post, I will show you how to reuse the Stored video(in the form of ByteArrays) and play it using the VideoDisplay component.</p>
<h3 style="color:black;"><strong>Reusing Video stored in ByteArray format using VideoDisplay Component</strong></h3>
<p>Assume the video is stored in the following variable</p>
<p style="color:orange;"><strong>var videoArray:ByteArray=new ByteArray();<br />
/*Code for storing the video in ByteArray format can be found in the Project Source, which is available at the end of the article*/</strong></p>
<p>I’ve added a VideoDisplay component with id <strong>PreviewedVideo</strong>. Open a temporary file like so</p>
<p style="color:orange;"><strong>Videofile=File.applicationStorageDirectory.resolvePath(<strong>&#8220;temp.flv&#8221;</strong>);</strong></p>
<p>If the file already exists it must be deleted</p>
<p style="color:orange;"><strong><strong>if</strong>(Videofile.exists)<br />
{<br />
Videofile.deleteFile();<br />
}</strong></p>
<p>The following code shows how the data in the byte array is transferred to the file and how the VideoDisplay uses the file to play the Video</p>
<p style="color:orange;"><strong><strong>var</strong> stream:FileStream = <strong>new</strong> FileStream();<br />
stream.open(Videofile, FileMode.WRITE);<br />
stream.writeBytes(videoArray, 0, videoArray.bytesAvailable );<br />
stream.close();<br />
PreviewedVideo.source=Videofile.nativePath;<br />
PreviewedVideo.play();</strong></p>
<p>To stop the video from playing, all you need to do is</p>
<p style="color:orange;"><strong>PreviewedVideo.close();<br />
</strong></p>
<p>This stops the streaming of data from the file to the VideoDisplay component.<br />
To get a complete idea please go through the source code.</p>
<p>-&gt;Find out how to use the application.</p>
<p>1. <a href="http://nishadfileupload.appspot.com/InsertUsage.png" target="_blank">Insertion</a></p>
<p>2. <a href="http://nishadfileupload.appspot.com/UpdateUsage.png" target="_blank">Updation</a></p>
<p>3. <a href="http://nishadfileupload.appspot.com/PreviewUsage.png" target="_blank">Preview</a></p>
<p>-&gt;<a href="http://nishadfileupload.appspot.com/DataBaseAirApp.zip" target="_blank">Click here</a> to download the full source code for the application. The Zip also contains the .air file which you can use to install the application</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/253/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=253&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2010/02/17/reusing-a-video-stored-in-bytearray-format-with-the-flex-videodisplay-component/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>
	</item>
		<item>
		<title>Storing Custom Class Objects in Databases using Adobe AIR’s SQLite Integration</title>
		<link>http://nishadmusthafa.wordpress.com/2010/02/02/storing-custom-class-objects-in-databases-using-adobe-air%e2%80%99s-sqlite-integration/</link>
		<comments>http://nishadmusthafa.wordpress.com/2010/02/02/storing-custom-class-objects-in-databases-using-adobe-air%e2%80%99s-sqlite-integration/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 03:35:15 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://nishadmusthafa.wordpress.com/?p=225</guid>
		<description><![CDATA[Consider the case where you have a Custom Class in which you had members as varied as strings to ByteArrays.  Something like the following Class description shown below. While working with the SQLite integration provided by the AIR, there are many times when you might want to insert an entire object into the database. While [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=225&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider the case where you have a Custom Class in which you had members as varied as strings to ByteArrays.  Something like the following Class description shown below.</p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2010/01/classexample.png"><img class="alignnone size-full wp-image-250" title="ClassExample" src="http://nishadmusthafa.files.wordpress.com/2010/01/classexample.png?w=532&#038;h=587" alt="" width="532" height="587" /></a></p>
<p>While working with the SQLite integration provided by the AIR, there are many times when you might want to insert an entire object into the database. While trying to search for a solution to how to do this, I found that there weren’t any articles detailing the exact Actionscript Syntax on how this can be done.  Hence I’ve created an application that takes as input Image, Video and Audio files and then converts them to ByteArrays and allows you to store retrieve and update the converted information using a database. To show that stored ByteArray files can still be used, I have included a portion in the application to preview the stored files.</p>
<h3 style="color:black;"><strong>Syntax for storing Custom Objects</strong></h3>
<p>I will not be getting into the details of how to create a connection to the SQLite database. For more information on that go to</p>
<p><a href="http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_06.html">http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_06.html</a></p>
<p>The only point to remember is that for an object, the data type is OBJECT or OBJE. Hence the CREATE statement for the database will look like this.</p>
<p style="color:orange;"><strong>CREATE TABLE IF NOT EXISTS MMCollection (Name STRING PRIMARY KEY,      MultimediaClass  OBJECT);</strong></p>
<p>Assuming that a connection has been established to the database using an instance of the SQLConnection class, the first thing to do is to create the insertion statement. This is done using the SQLStatement class as shown below. The code below is self explanatory. The statement is assigned to the required SQL connection and the query is also written to the text property of the statement.</p>
<p style="color:orange;"><strong>var insertStmt:SQLStatement=new SQLStatement();<br />
insertStmt.sqlConnection=conn;<br />
var sql:String = &#8220;INSERT INTO MMCollection (Name,MObj)  VALUES (@pkey,@obj)&#8221;;<br />
insertStmt.text = sql;</strong></p>
<p>While writing the query notice the portions @pkey and @obj.   These two are part of the implementation of a feature called named parameters detailed here at <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_09.html">http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_09.html</a></p>
<p>How the parameters are understood by the framework is shown in the code snippet below.</p>
<p style="color:orange;"><strong>insertStmt.parameters["@pkey"]=enteredName.text;//The input String from user<br />
insertStmt.parameters["@obj"]=MediaCollection;//The Custom Class Object-(In Source code)</strong></p>
<p>This is the only way possible to pass the parameter for complex types like Objects. It is also advised to use this even for simple data types like Strings as it is a good security measure to avoid SQL injection attacks.</p>
<p>After assigning the parameters the statement can be executed as shown below.</p>
<p style="color:orange;"><strong>&#8230;<br />
insertStmt.addEventListener(SQLEvent.RESULT,insertHandler);<br />
insertStmt.addEventListener(SQLErrorEvent.ERROR,insertFaultHandler);<br />
try{<br />
insertStmt.execute();<br />
}<br />
catch(error:Error)<br />
{<br />
Alert.show(error.details,&#8221;Error&#8221;);<br />
}<br />
&#8230;</strong></p>
<p style="color:orange;"><strong>protected function insertHandler(event:SQLEvent):void<br />
{<br />
trace(&#8220;INSERT statement succeeded&#8221;);<br />
Alert.show(&#8220;The Media was inserted&#8221;,&#8221;Acknowledgement&#8221;);<br />
}<br />
protected function insertFaultHandler(event:SQLErrorEvent):void<br />
{<br />
var error:Error=event.error;<br />
trace(&#8220;Error message:&#8221;, error.message);<br />
Alert.show(error.message,&#8221;Error&#8221;);<br />
}<br />
</strong></p>
<p>The above method is the asynchronous method of executing a query. It can also be done synchronously. But for more information on that go <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_09.html#1084949" target="_blank">here</a>. However for large object databases, it is advisable to use Asynchronous mode of execution.</p>
<p>To get a complete idea please go through the source code.</p>
<p>-&gt;Find out how to use the application.</p>
<p>1. <a href="http://nishadfileupload.appspot.com/InsertUsage.png" target="_blank">Insertion</a></p>
<p>2. <a href="http://nishadfileupload.appspot.com/UpdateUsage.png" target="_blank">Updation</a></p>
<p>3. <a href="http://nishadfileupload.appspot.com/PreviewUsage.png" target="_blank">Preview</a></p>
<p>-&gt;<a href="http://nishadfileupload.appspot.com/DataBaseAirApp.zip" target="_blank">Click here</a> to download the full source code for the application. The Zip also contains the .air file which you can use to install the application</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=225&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2010/02/02/storing-custom-class-objects-in-databases-using-adobe-air%e2%80%99s-sqlite-integration/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2010/01/classexample.png" medium="image">
			<media:title type="html">ClassExample</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Simple Parcel Tracking application with Model Driven Development using LiveCycle Data Services (LCDS) and Flash Builder 4</title>
		<link>http://nishadmusthafa.wordpress.com/2009/10/19/creating-a-simple-parcel-tracking-application-with-model-driven-development-using-livecycle-data-services-lcds-and-flash-builder-4/</link>
		<comments>http://nishadmusthafa.wordpress.com/2009/10/19/creating-a-simple-parcel-tracking-application-with-model-driven-development-using-livecycle-data-services-lcds-and-flash-builder-4/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 20:01:00 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[Data Centric Development(DCD)]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Google Maps Flash API]]></category>
		<category><![CDATA[LiveCycle Data Service(LCDS)]]></category>
		<category><![CDATA[Model Driven Development]]></category>

		<guid isPermaLink="false">http://nishadmusthafa.wordpress.com/?p=117</guid>
		<description><![CDATA[I have been very amazed by the data management capabilities of LCDS and have been tinkering around with it for a while now.  I shall now demonstrate how to create a simple parcel tracking application using model driven development.  Assume there is a parcel office and also assume there is a home that the parcel [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=117&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been very amazed by the data management capabilities of LCDS and have been tinkering around with it for a while now.  I shall now demonstrate how to create a simple parcel tracking application using model driven development.  Assume there is a parcel office and also assume there is a home that the parcel is to be delivered to. The customer will be able to enter the parcel number and find out where in the city the parcel is. Of course, in reality a GPS system would be needed to update the location of the package in the database. However for the purpose of the demo, ill update it using another flex application.  They say an image is worth a thousand words. Also, a video is actually a thousand or more images. So doing the math we conclude that I should show you a video of how the tracking application will look like rather than describing it here. Click <a href="http://www.youtube.com/watch?v=qwrpEdlImps" target="_blank">here</a> to view the video.  So now that we know what our end product is, let’s start making our application.</p>
<p><strong>Installing LCDS and Flash Builder </strong></p>
<p>Download and install the latest Beta Release of Flash Builder 4 from <a href="http://labs.adobe.com/technologies/flashbuilder4/">http://labs.adobe.com/technologies/flashbuilder4/</a> .</p>
<p>Download LiveCycle Data Services 3 from</p>
<p><a href="http://labs.adobe.com/technologies/livecycle_dataservices3/" target="_blank">http://labs.adobe.com/technologies/livecycle_dataservices3/</a>. Install the executable (<em>livecycle_dataservices3_b3_win_100509.exe</em>) using the option “with tomcat” to C:/lcds3</p>
<p>Download Fiber modeler plugin from</p>
<p><a href="http://labs.adobe.com/technologies/livecycle_dataservices3/" target="_blank">http://labs.adobe.com/technologies/livecycle_dataservices3/</a>. Extract the contents of the zip file (<em>livecycle_dataservices3_modelerplugin_100509.zip</em>) and copy the files under <em>livecycle_dataservices3_modelerplugin_100509/plugins</em> folder into <em>C:\Program Files\Adobe\Adobe Flash Builder Beta 2\plugins.</em></p>
<p>The required software is now installed.</p>
<p><strong>Google Maps Flash API</strong></p>
<p>I have used the Google Maps flash API for working with maps. Go to</p>
<p><a href="http://code.google.com/apis/maps/documentation/flash/">http://code.google.com/apis/maps/documentation/flash/</a></p>
<p>Sign up for an API key and download the SDK. You will need to put in the API key in your flex code. So store that safely. We will deal with how to make use of the library in the application in a later part of the post. You will be downloading a file called sdk.zip. Copy it to your desktop and extract to a folder called sdk.</p>
<p><strong>Existing Database in MySQL</strong></p>
<p>The database created using a simple MySQL command line client and is called Courier (Click here for .sql file). It comprises of 4 tables.</p>
<p>1.Centre – This is a list of all end points. They can be parcel offices or destinations of parcels. The schema is<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/centretable1.jpg"><img class="alignnone size-full wp-image-216" title="CentreTable" src="http://nishadmusthafa.files.wordpress.com/2009/10/centretable1.jpg?w=482&#038;h=111" alt="" width="482" height="111" /></a><br />
2.Location – This is a list of all intermediary points where the delivery man can be. In a real time case a relay from the GPS system should be sent to update this table. Just a number is enough as primary ID. You may argue that there is no need for two tables(Centre and Location) here. However, in a real time case, this table will be constantly updated with GPS coordinates whereas the Centre table is more or less static and has a fixed set of values.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/locationtable1.jpg"><img class="alignnone size-full wp-image-217" title="LocationTable" src="http://nishadmusthafa.files.wordpress.com/2009/10/locationtable1.jpg?w=550&#038;h=114" alt="" width="550" height="114" /></a><br />
3.Delivery Man- This is a simple table mapping a delivery man to his current location.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/deliverymantable1.jpg"><img class="alignnone size-full wp-image-218" title="DeliveryManTable" src="http://nishadmusthafa.files.wordpress.com/2009/10/deliverymantable1.jpg?w=550&#038;h=98" alt="" width="550" height="98" /></a><br />
4.PackageBox- This is the list of all packages.  The schema is shown below.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/packageboxtable1.jpg"><img class="alignnone size-full wp-image-219" title="PackageBoxTable" src="http://nishadmusthafa.files.wordpress.com/2009/10/packageboxtable1.jpg?w=550&#038;h=211" alt="" width="550" height="211" /></a></p>
<p>The important points to note here are the foreign key references. I’ve enlisted them here<br />
1.Between the source attribute of the PackageBox table and the Centre Table.<br />
2.Between the destination attribute of the PackageBox table and the Centre Table.<br />
3.Between the deliveryman attribute of the PackageBox table and the DeliveryManTable.<br />
4.Between the location attribute of the DeliveryMan table and the Location Table.</p>
<p>The Attributes have been named in such a way<br />
{Attribute name}_{Primary key of the table it is referenced to}<br />
So now that we have an idea of what the database is, let us see how to connect it to expose this database to the LCDS serve as data sources.</p>
<p><strong>Configuring LCDS to the existing database</strong></p>
<p>The fibre modeler plugin of Flash Builder uses the data sources configured on the web server to retrieve data from the tables of the database. Hence to make this data source, we must edit the configuration file of the web application. By default, there is a web application called lcds located at<br />
C:\lcds\tomcat\webapps\lcds</p>
<p>We shall use this to create our datasources. Since the name is lcds there is a file called lcds.xml  in<br />
C:\lcds\tomcat\conf\Catalina\localhost\</p>
<p>Make the following changes to the file<br />
&lt;Context privileged=&#8221;true&#8221; antiResourceLocking=&#8221;false&#8221; antiJARLocking=&#8221;false&#8221; reloadable=&#8221;true&#8221;&gt;<br />
&lt;Transaction factory=&#8221;org.objectweb.jotm.UserTransactionFactory&#8221; jotm.timeout=&#8221;60&#8243;/&gt;<br />
&lt;Resource name=&#8221;jdbc/courier&#8221; auth=&#8221;Container&#8221;<br />
type=&#8221;javax.sql.DataSource&#8221;<br />
username=&#8221;{your username}&#8221;<br />
password=&#8221;{your password}&#8221;<br />
driverClassName=&#8221;com.mysql.jdbc.Driver&#8221;<br />
url=&#8221;jdbc:mysql://localhost:3306/courier?autoReconnect=true&#8221;/&gt;<br />
&lt;/Context&gt;</p>
<p>Also, make sure that the MySQL Connector/J file is present in the tomcat’s lib folder.<br />
Next, we must enable the RDSDispatchServlet which is present on the LCDS server and is used by Flash Builder+ Fibre Modeler Plugin to read the data sources. Go to<br />
C:\lcds\tomcat\webapps\lcds\WEB-INF\web.xml</p>
<p>Uncomment the following section of the file<br />
&lt;servlet&gt;<br />
&lt;servlet-name&gt;RDSDispatchServlet&lt;/servlet-name&gt;<br />
&lt;display-name&gt;RDSDispatchServlet&lt;/display-name&gt;<br />
&lt;servlet-class&gt;flex.rds.server.servlet.FrontEndServlet&lt;/servlet-class&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;useAppserverSecurity&lt;/param-name&gt;<br />
&lt;param-value&gt;false&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;load-on-startup&gt;10&lt;/load-on-startup&gt;<br />
&lt;/servlet&gt;<br />
&lt;servlet-mapping id=&#8221;RDS_DISPATCH_MAPPING&#8221;&gt;<br />
&lt;servlet-name&gt;RDSDispatchServlet&lt;/servlet-name&gt;<br />
&lt;url-pattern&gt;/CFIDE/main/ide.cfm&lt;/url-pattern&gt;<br />
&lt;/servlet-mapping&gt;</p>
<p>The important point here is the parameter useAppServerSecurity is by default true. Set it to false. That is the entire configuration that is required.  The next step is starting the server.</p>
<p><strong>Starting the LCDS Server</strong></p>
<p>Either</p>
<ol>
<li>Go to Start-&gt;All Programs -&gt;Adobe-&gt; LiveCycle Data Services</li>
<li>Click on Start Samples Database</li>
<li>Click on Start LiveCycle Data Services Server.</li>
</ol>
<p>Or</p>
<p>Execute these scripts in succession</p>
<ol>
<li>C:\lcds\sampledb\startdb.bat</li>
<li>C:\lcds\tomcat\bin\startup.bat</li>
</ol>
<p>The above are the two ways to start the server.</p>
<p><strong>Start of application building</strong></p>
<p>We shall go through this step by step<br />
1.Open Flex Builder go to File-&gt;New Flex Project and give your project an appropriate name. I’ve named mine ParcelApplication. Under Server Technology choose<br />
a.Application server type: J2EE<br />
b.Check on Use remote object access service.<br />
c.Select  LiveCycle Data services ES.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/opennewproject1.jpg" target="_blank"><img class="alignnone size-full wp-image-134" title="OpennewProject" src="http://nishadmusthafa.files.wordpress.com/2009/10/opennewproject1.jpg?w=437&#038;h=480" alt="OpennewProject" width="437" height="480" /></a><br />
Leave the rest as default. Click Next.</p>
<p>2.Validate Configuration Screen: In this screen by the default path will be chosen. So unless there was a non standard installation no input needs to be given in this screen. Click on Validate Configuration and see if the the message “The web root folder and root URL are valid” appears on top. If it does, click Next. Else, there is something wrong with one of the paths. Check up for file path mistakes.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/validateconfig2.jpg" target="_blank"><img class="alignnone size-full wp-image-140" title="validateconfig" src="http://nishadmusthafa.files.wordpress.com/2009/10/validateconfig2.jpg?w=436&#038;h=478" alt="validateconfig" width="436" height="478" /></a></p>
<p>3.In the next menu, we shall include the libraries for the Google Maps Flash API. Click on the Add SWC button that has been highlighted in the picture below.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/swcinclude1.jpg" target="_blank"><img class="alignnone size-full wp-image-143" title="swcinclude" src="http://nishadmusthafa.files.wordpress.com/2009/10/swcinclude1.jpg?w=434&#038;h=527" alt="swcinclude" width="434" height="527" /></a><br />
In the add SWC menu, click on browse. In the file browser window that will appear, find the map_flex_{version number}.swc file which will be under<br />
Desktop\sdk\lib\   (if the sdk.zip folder was extracted to desktop)</p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2009/10/swcadd1.jpg" target="_blank"><img class="alignnone size-full wp-image-146" title="swcadd" src="http://nishadmusthafa.files.wordpress.com/2009/10/swcadd1.jpg?w=431&#038;h=522" alt="swcadd" width="431" height="522" /></a><br />
Click Open on the File browser Menu. Click Ok on the Add SWC menu. Click Finish on build path menu.</p>
<p>4. Now that the project workspace, we can work on the RDS configuration. Click On Window (Alt+W) -&gt; Preferences. On the list on the left of the Under Adobe, You will find RDS configuration window which looks like the image below.  Enter the configuration details as shown in the image and click on test connection (which has been highlighted in the image). If the connection is not established, then there must be an error in the path or the server must have stopped running.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/rdsconfig1.jpg" target="_blank"><img class="alignnone size-full wp-image-149" title="RDSconfig" src="http://nishadmusthafa.files.wordpress.com/2009/10/rdsconfig1.jpg?w=432&#038;h=461" alt="RDSconfig" width="432" height="461" /></a></p>
<p>5.We are now ready to create our Model</p>
<p><strong>Creating a Model</strong></p>
<p>We shall now look at how to use the fiber modeler plugin to make a model in Flash Builder.<br />
1.Go to Window (Alt+W) -&gt; Perspective -&gt; and click on Data Model. The following image(click for larger image) shows what the data model looks like.  Click on the view Open Data Model for Active Project button (highlighted below) and you will now have the design view of the Model. You will notice that a file called ParcelApplication.fml has been created.  This is called the model file.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/datamodelview1.jpg" target="_blank"><img class="alignnone size-large wp-image-151" title="DATAMODELview" src="http://nishadmusthafa.files.wordpress.com/2009/10/datamodelview1.jpg?w=408&#038;h=253" alt="DATAMODELview" width="408" height="253" /></a></p>
<p>2.As highlighted in the image below(click for larger image), the RDS Data View menu lets you see all the databases that are available as datasources.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/tables1.jpg" target="_blank"><img class="alignnone size-large wp-image-160" title="tables" src="http://nishadmusthafa.files.wordpress.com/2009/10/tables1.jpg?w=410&#038;h=246" alt="tables" width="410" height="246" /></a></p>
<p>3.We will need all the tables. So just drag and drop the tables into the design view of ParcelApplication.fml.  You will be able to view the entities in the design view of the data model as shown in the image below(click to view larger image). You will also notice in the package explorer that a new package has been created with same name as the application which contains the classes generated by LCDS fiber modeler plugin for Flash Builder 4.</p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2009/10/importedtables.jpg" target="_blank"><img class="alignnone size-large wp-image-164" title="importedtables" src="http://nishadmusthafa.files.wordpress.com/2009/10/importedtables.jpg?w=406&#038;h=223" alt="importedtables" width="406" height="223" /></a></p>
<p>4.Click on the Deploy Model to LCDS Server button which is highlighted in the image above. And you get the menu shown below. Select the Create/Recreate option marked in red in the image. If you were doing this for a second time (say after including another table), then you need to use the Overwrite existing model option.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/deploylcds.jpg" target="_blank"><img class="alignnone size-full wp-image-166" title="DeployLCDS" src="http://nishadmusthafa.files.wordpress.com/2009/10/deploylcds.jpg?w=413&#038;h=231" alt="DeployLCDS" width="413" height="231" /></a><br />
You can go to the tomcat command line output window and you will see the following lines displayed<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/deployproof.jpg" target="_blank"><img class="alignnone size-full wp-image-168" title="deployproof" src="http://nishadmusthafa.files.wordpress.com/2009/10/deployproof.jpg?w=418&#038;h=211" alt="deployproof" width="418" height="211" /></a><br />
This means that the model has been successfully deployed. Notice how it states that Fiber Assembler for all the four tables have been created.</p>
<p>5.Now switch back to Flash perspective. The image below(click for larger image) has a highlighted red box with a red circle inside it. The click the button in the circle and the menu that you see in the box drops down. Click on flash and the perspective changes. Select the ParcelApplication.mxml file.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/flashperspective.jpg" target="_blank"><img class="alignnone size-large wp-image-169" title="flashperspective" src="http://nishadmusthafa.files.wordpress.com/2009/10/flashperspective.jpg?w=414&#038;h=249" alt="flashperspective" width="414" height="249" /></a></p>
<p>6.If you select the data/services tab highlighted in the first image below(click to view larger image) and maximize it by double clicking on the tab, you will see that all the possible CRUD services have automatically been created. The list is also shown in the second image below(click to view larger image).<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/dataservices.jpg" target="_blank"><img class="alignnone size-large wp-image-170" title="dataservices" src="http://nishadmusthafa.files.wordpress.com/2009/10/dataservices.jpg?w=417&#038;h=250" alt="dataservices" width="417" height="250" /></a></p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2009/10/servicesgenerated.jpg" target="_blank"><img class="alignnone size-large wp-image-177" title="Servicesgenerated" src="http://nishadmusthafa.files.wordpress.com/2009/10/servicesgenerated.jpg?w=418&#038;h=231" alt="Servicesgenerated" width="418" height="231" /></a></p>
<p>7.Now, I have posted a link to the code for logic involved in the application.</p>
<p>1. <a href="http://nishadfileupload.appspot.com/ParcelApplicationmxmlsource.txt" target="_blank">ParcelApplication.mxml</a> &#8211; This is the source of the main application</p>
<p>2.<a href="http://nishadfileupload.appspot.com/ParcelApplicationFmlSource.txt" target="_blank">ParcelApplication.fml</a> &#8211; This is the model file&#8217;s source<br />
It is fairly simple to understand and has been heavily commented for proper understanding. Please do feel free to comment and ask if you have any doubts.  This is all that needs to be done for parcel tracking application.</p>
<p><strong>Creating the application to update the location of the parcel</strong><br />
Follow the same steps 1 and 2 of &#8220;<strong>Start of application building</strong>&#8221; as you did with the tracking application. Here, I have named the application ParcelLocationUpdater. We do not need to import any special libraries here. So we can click Finish at the Configure J2EE server page. Then follow these steps</p>
<p>1.Select Data(Alt+t)  -&gt; Connect to LCDS and you will get the following screen. Select ParcelApplication.DeliveryMan, which is the same Data Source that was used in the previous application and click Finish. Remember that only if the same data source that was used in the earlier application is used in this application, the Automatic Sync functionality of LCDS can be used. What is the automatic Syn feature. According to this, if there are two flex applications which use the same data source. Then if one of them has a Bindable data type(like arraycollection or Datagrid) bound to a service call, a change or update made by the other application will automatically be reflected in the bindable arraycollection or DataGrid.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/importlcds.jpg" target="_blank"><img class="alignnone size-full wp-image-174" title="importLCDS" src="http://nishadmusthafa.files.wordpress.com/2009/10/importlcds.jpg?w=441&#038;h=441" alt="importLCDS" width="441" height="441" /></a></p>
<p>2.If you now look at the Data/Services tab, you will see that the services have been imported. Similarly, import ParcelApplication.Location.</p>
<p>3.Switch to design view and from the components menu select Datagrid (look at the image below). Drag and drop it twice to the design view.  Look at the second image below to see if the result is the same.</p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2009/10/datagridsdragged.jpg" target="_blank"><img class="alignnone size-full wp-image-181" title="datagridsdragged" src="http://nishadmusthafa.files.wordpress.com/2009/10/datagridsdragged.jpg?w=422&#038;h=323" alt="datagridsdragged" width="422" height="323" /></a></p>
<p>4. I have named the first DataGrid locationDataGrid and the second one deliveryManDataGrid. Drag and drop the getAll() service under Location Services to locationDataGrid. See image below.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/dragdropservice.jpg" target="_blank"><img class="alignnone size-full wp-image-182" title="dragdropservice" src="http://nishadmusthafa.files.wordpress.com/2009/10/dragdropservice.jpg?w=413&#038;h=427" alt="dragdropservice" width="413" height="427" /></a></p>
<p>5.Repeat the process for the getAll() service of DeliveryMan Object as well.</p>
<p>6.If you look at the deliveryManDataGrid, it does not let you see the entire details of the location corresponding to the deliveryman. Let us generate a details form for this so that we can see what the exact data is. Right click on the dataGrid for location and click generate details form as shown below.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/detailsform.jpg" target="_blank"><img class="alignnone size-full wp-image-184" title="detailsform" src="http://nishadmusthafa.files.wordpress.com/2009/10/detailsform.jpg?w=421&#038;h=325" alt="detailsform" width="421" height="325" /></a></p>
<p>7.You will then be asked what type of form to choose. Choose Flex form which will enable the DCD form. Click OK<br />
<img class="alignnone size-full wp-image-185" title="chooseflexform" src="http://nishadmusthafa.files.wordpress.com/2009/10/chooseflexform.jpg?w=297&#038;h=195" alt="chooseflexform" width="297" height="195" /></p>
<p>8.In the following form, Master details have automatically been selected. The other options are to bind the form to a service call (input and output) as well as to bind the call to a data type. However for our example, we need only to select the Master details. Click Next.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/masterdetail.jpg" target="_blank"><img class="alignnone size-full wp-image-186" title="masterdetail" src="http://nishadmusthafa.files.wordpress.com/2009/10/masterdetail.jpg?w=296&#038;h=307" alt="masterdetail" width="296" height="307" /></a></p>
<p>9.In this menu, you can include what properties are shown. Since we want to see all the details of the location corresponding to the delivery man object that is selected in the data grid, click all details as shown in the image below.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/genformincludedproperties.jpg" target="_blank"><img class="alignnone size-full wp-image-187" title="genformincludedproperties" src="http://nishadmusthafa.files.wordpress.com/2009/10/genformincludedproperties.jpg?w=298&#038;h=309" alt="genformincludedproperties" width="298" height="309" /></a></p>
<p>10.You will see the generated form as shown below<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/generatedform.jpg" target="_blank"><img class="alignnone size-full wp-image-188" title="generatedform" src="http://nishadmusthafa.files.wordpress.com/2009/10/generatedform.jpg?w=443&#038;h=341" alt="generatedform" width="443" height="341" /></a></p>
<p>11.We shall now run the program and take a look at what we get. If you click on any one of the entries in the deliveryManDataGrid, you can view the corresponding values in the details form.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/midwayrunningupdater.jpg" target="_blank"><img class="alignnone size-full wp-image-191" title="midwayrunningupdater" src="http://nishadmusthafa.files.wordpress.com/2009/10/midwayrunningupdater.jpg?w=450&#038;h=305" alt="midwayrunningupdater" width="450" height="305" /></a><br />
12.Now what we will do is add a button to replace the value of the location attribute corresponding to the item selected in the deliveryManDataGrid with the selected item in the locationDataGrid. Drag and Drop a button from the components menu and right click to choose generate service call.(click to view larger image)<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/genservicecall.jpg?w=1024" target="_blank"><img class="alignnone size-large wp-image-192" title="genservicecall" src="http://nishadmusthafa.files.wordpress.com/2009/10/genservicecall.jpg?w=503&#038;h=303" alt="genservicecall" width="503" height="303" /></a><br />
13.In the next menu that appears choose, the service call to be generated and Click OK.<br />
<img class="alignnone size-full wp-image-193" title="chooseservicecalltobegen" src="http://nishadmusthafa.files.wordpress.com/2009/10/chooseservicecalltobegen.jpg?w=319&#038;h=179" alt="chooseservicecalltobegen" width="319" height="179" /><br />
14.The following is the Code that is generated.<br />
protected function button_clickHandler(event:MouseEvent):void<br />
{<br />
updateDeliverymanResult.token = deliverymanService.updateDeliveryman(/*enter the value for*/deliveryman);<br />
}<br />
15.We shall now take a look at what needs to be added to the code to perform the updation.</p>
<p>protected function button_clickHandler(event:MouseEvent):void<br />
{<br />
var deliveryman:Deliveryman=deliverManDataGrid.selectedItem as Deliveryman;<br />
deliveryman.locationLocationid=locationDataGrid.selectedItem as Location;<br />
updateDeliverymanResult.token = deliverymanService.updateDeliveryman(deliveryman);<br />
}</p>
<p>As you can see, what the code essentially does is assigns the value of the location object selected in the Location datagrid to the location attribute of the selected DeliveryMan Object in the other datagrid and calls the service to update that Delivery man object.<br />
16.    Presto!! The application for updating the location of the delivery man ready now. I have changed the text in the button to UPDATE for it be more in context.   Here are screen shots of it working.<br />
<a href="http://nishadmusthafa.files.wordpress.com/2009/10/appscreenshot1.png" target="_blank"><img class="alignnone size-full wp-image-197" title="appscreenshot1" src="http://nishadmusthafa.files.wordpress.com/2009/10/appscreenshot1.png?w=450&#038;h=360" alt="appscreenshot1" width="450" height="360" /></a></p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2009/10/appscreenshot2.png" target="_blank"><img class="alignnone size-full wp-image-198" title="appscreenshot2" src="http://nishadmusthafa.files.wordpress.com/2009/10/appscreenshot2.png?w=449&#038;h=353" alt="appscreenshot2" width="449" height="353" /></a></p>
<p><strong>Running both applications</strong></p>
<p>Please play the video whose link is given in the introduction section to see how to run the two applications together. Hence, we have created two applications.<br />
1.An application that accesses a database for a courier company and displays the location of a package on a map given the package number as input.<br />
2.An application that updates the location of the package in the database. Hence, in a real time situation, this application can be called by a system which is hooked to the GPS coordinates of the delivery truck and hence update the location of the delivery truck in the data base.<br />
We have demonstrated how to create a model from a MySQL database and also shown how useful the automatic data source sync feature of LCDS is. Please do post any comments if you experience any problems while trying out these <a href="http://europeanholidaysexplained.com/home/" target="_blank">features</a>.</p>
<p><!--Session data--></p>
<p><!--Session data--></p>
<p><!--Session data--></p>
<p><!--Session data--></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=117&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2009/10/19/creating-a-simple-parcel-tracking-application-with-model-driven-development-using-livecycle-data-services-lcds-and-flash-builder-4/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/centretable1.jpg" medium="image">
			<media:title type="html">CentreTable</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/locationtable1.jpg" medium="image">
			<media:title type="html">LocationTable</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/deliverymantable1.jpg" medium="image">
			<media:title type="html">DeliveryManTable</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/packageboxtable1.jpg" medium="image">
			<media:title type="html">PackageBoxTable</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/opennewproject1.jpg" medium="image">
			<media:title type="html">OpennewProject</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/validateconfig2.jpg" medium="image">
			<media:title type="html">validateconfig</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/swcinclude1.jpg" medium="image">
			<media:title type="html">swcinclude</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/swcadd1.jpg" medium="image">
			<media:title type="html">swcadd</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/rdsconfig1.jpg" medium="image">
			<media:title type="html">RDSconfig</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/datamodelview1.jpg?w=1024" medium="image">
			<media:title type="html">DATAMODELview</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/tables1.jpg?w=1024" medium="image">
			<media:title type="html">tables</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/importedtables.jpg?w=1024" medium="image">
			<media:title type="html">importedtables</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/deploylcds.jpg" medium="image">
			<media:title type="html">DeployLCDS</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/deployproof.jpg" medium="image">
			<media:title type="html">deployproof</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/flashperspective.jpg?w=1024" medium="image">
			<media:title type="html">flashperspective</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/dataservices.jpg?w=1024" medium="image">
			<media:title type="html">dataservices</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/servicesgenerated.jpg?w=1024" medium="image">
			<media:title type="html">Servicesgenerated</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/importlcds.jpg" medium="image">
			<media:title type="html">importLCDS</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/datagridsdragged.jpg" medium="image">
			<media:title type="html">datagridsdragged</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/dragdropservice.jpg" medium="image">
			<media:title type="html">dragdropservice</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/detailsform.jpg" medium="image">
			<media:title type="html">detailsform</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/chooseflexform.jpg" medium="image">
			<media:title type="html">chooseflexform</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/masterdetail.jpg" medium="image">
			<media:title type="html">masterdetail</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/genformincludedproperties.jpg" medium="image">
			<media:title type="html">genformincludedproperties</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/generatedform.jpg" medium="image">
			<media:title type="html">generatedform</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/midwayrunningupdater.jpg" medium="image">
			<media:title type="html">midwayrunningupdater</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/genservicecall.jpg?w=1024" medium="image">
			<media:title type="html">genservicecall</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/chooseservicecalltobegen.jpg" medium="image">
			<media:title type="html">chooseservicecalltobegen</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/appscreenshot1.png" medium="image">
			<media:title type="html">appscreenshot1</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/appscreenshot2.png" medium="image">
			<media:title type="html">appscreenshot2</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP .NET(C#) based HTTPService accessed from a Flex Application using the Data Centric Development (DCD) in Flash Builder 4</title>
		<link>http://nishadmusthafa.wordpress.com/2009/10/08/net-based-httpservice-accessed-from-a-flex-application-using-the-data-centric-development-dcd-in-flash-builder-4/</link>
		<comments>http://nishadmusthafa.wordpress.com/2009/10/08/net-based-httpservice-accessed-from-a-flex-application-using-the-data-centric-development-dcd-in-flash-builder-4/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 14:45:19 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[Data Centric Development(DCD)]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex and .NET]]></category>

		<guid isPermaLink="false">http://nishadmusthafa.wordpress.com/?p=58</guid>
		<description><![CDATA[This tutorial is also aimed at .NET developers who would like a Richer User Experience on their client sides by making use of Adobe Flex.  In my previous post I talked about a particular database that stores a list of Centers of a Courier company. We will use the same database here. Now suppose there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=58&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This tutorial is also aimed at .NET developers who would like a Richer User Experience on their client sides by making use of Adobe Flex.  In my previous post I talked about a particular database that stores a list of Centers of a Courier company. We will use the same database here. Now suppose there was a .NET based HTTPservice that returned this data in standard XML format. We shall take a look at what the possibilities are in Flash Builder 4 to access this HTTPService and use the  Data Centric Development(DCD) feature to represent the data returned by this HTTPService in the User Interface. As we shall see this consists of three phases</p>
<ol>
<li>Importing the Service to Flash builder.</li>
<li>Configuring the return type.</li>
<li>Binding the data to the UI component.</li>
</ol>
<p>However, we shall first take a look at the database and the backend service provider before doing that. As is usually the case with DCD, I shall show you how to do all the development on the flex side without writing any code.</p>
<p><strong>Database</strong></p>
<p>This Web Service accesses a MySQL database table called Centre which has the following schema.<img class="alignnone size-full wp-image-59" title="schema" src="http://nishadmusthafa.files.wordpress.com/2009/10/schema2.jpg?w=450&#038;h=89" alt="schema" width="450" height="89" /></p>
<p>The database is simple to create using a MySQL command line client.</p>
<p><strong>Backend</strong></p>
<p>The language used for coding is C#. There are three files here</p>
<ol>
<li><a href="http://sujitreddyg.com/fb4articles/beta2/Centre.cs.txt" target="_blank">Centre.cs</a> – This C# class represents a data tuple from the Centre table of the database.</li>
<li><a href="http://sujitreddyg.com/fb4articles/beta2/CentreInterface.cs.txt" target="_blank">CentreInterface.cs</a> –This C# class contains the method that establishes a connection to the database using Odbc classes and retrieves the list of Centre tuples.</li>
<li><a href="http://sujitreddyg.com/fb4articles/beta2/CentreXml.aspx.txt" target="_blank">CentreXml.aspx</a> – This is the aspx page that returns the XML file containing the required data.</li>
</ol>
<p>Click on the files to view the source. Essentially what CentreXML.aspx returns is an XML file which can be viewed as an equivalent of an array of Centre Classes.</p>
<p><strong>Importing the HTTP Service to Flex</strong></p>
<p>We can now turn our attention to Flex.</p>
<p>1.If you don’t already have Flash Builder, download and install Flash Builder 4 from this URL <a href="http://labs.adobe.com/technologies/flashbuilder4/" target="_blank">http://labs.adobe.com/technologies/flashbuilder4/</a>.</p>
<p>2.First create a new Project</p>
<p>Go to File-&gt;New -&gt; Flex Project.</p>
<p>3.In the Screen that appears, enter an appropriate Project name and click Finish.</p>
<p>4.Make sure that the perspective is Flash Perspective. In this perspective, there is a tab called Data/Services (shown in the image below). In the Data/Services window, choose Connect to Data/Service.(Click to view larger version of the image)</p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2009/10/step-2-pic-12.png" target="_blank"><img class="alignnone size-full wp-image-60" title="step-2-pic-1" src="http://nishadmusthafa.files.wordpress.com/2009/10/step-2-pic-12.png?w=397&#038;h=286" alt="step-2-pic-1" width="397" height="286" /></a></p>
<p>5.In the Connect to Data/Services Menu, click on HTTP and  then next as shown below</p>
<p><img class="alignnone size-full wp-image-64" title="connectmenu" src="http://nishadmusthafa.files.wordpress.com/2009/10/connectmenu1.jpg?w=395&#038;h=399" alt="connectmenu" width="395" height="399" /></p>
<p>6.The Connect to Http Service menu looks like this(shown below)</p>
<p><img class="alignnone size-full wp-image-74" title="httpconnect" src="http://nishadmusthafa.files.wordpress.com/2009/10/httpconnect1.jpg?w=405&#038;h=407" alt="httpconnect" width="405" height="407" /></p>
<p>The first option of “Do you want to use a base URL as a prefix for all operation URLs?” can be selected if all the operations come under the same URL. If the URL changes in this case the updation of the address has only to be done once. This is convenient if there are a lot of operations. However in our case we only have one operation and we will not specify a base URL.</p>
<p>As shown above, there is an Operations table. Under the Operation Name column, you can fill the name with which the operation will be known as on the flex side. Under the method column, choose GET. Under the URL column, give the path of your .aspx page. Then give a valid service name under Service details. For our example, I have chosen the name CentreService.</p>
<p>Click Finish.</p>
<p>7.If you now take a look at the Data/Services Tab, this is what you this is what you will see (image below).<a href="http://nishadmusthafa.files.wordpress.com/2009/10/dataservicestabbefore.jpg" target="_blank"><img class="alignnone size-full wp-image-66" title="dataservicestabbefore" src="http://nishadmusthafa.files.wordpress.com/2009/10/dataservicestabbefore.jpg?w=381&#038;h=72" alt="dataservicestabbefore" width="381" height="72" /></a></p>
<p>(Click on image to see full image)</p>
<p>If you notice, the data type returned by the GetCentres function is a generic type object. Now wouldn’t it be nice if you had the same data custom data type returned on flex as you had on your backend. This is possible now and we shall look into that in the next section.</p>
<p class="MsoNormal"><strong>Configuring the return type</strong></p>
<p>As said in the last point we can make a class equivalent that we had on the .NET side on the flex side. DCD now lets you automatically generate Value Objects(VOs). Lets see how this is done. For this, right click on the GetCentres():Object function highlighted in the previous picture and click Configure Return Type. The following is the menu you will end up with.</p>
<p><img class="alignnone size-full wp-image-80" title="configurereturntype" src="http://nishadmusthafa.files.wordpress.com/2009/10/configurereturntype1.jpg?w=386&#038;h=383" alt="configurereturntype" width="386" height="383" /></p>
<p class="MsoNormal">Select Auto-detect the return type as this is the first time the data is going to be introspected. If the destination is authenticated, then choose authentication required and it will prompt for username and password. The &#8220;Use an existing data type&#8221; (second option) can be selected in two cases</p>
<p class="MsoNormal">1.    A Built in data type<br />
2.    A custom data type which has already been configured before.<br />
Click on Next and you get the menu shown below.<br />
<img class="alignnone size-full wp-image-93" title="autodetectreturn" src="http://nishadmusthafa.files.wordpress.com/2009/10/autodetectreturn1.jpg?w=379&#038;h=374" alt="autodetectreturn" width="379" height="374" /></p>
<p class="MsoNormal">There are two ways you can make the Value Object(VO) which is the equivalent Actionscript class.  The first way involves Flash Builder communicating with the back end and doing introspection. If it’s a service that requires parameters, there are two ways.<br />
1.    Entering into the table. This is the first option shown in the image above.<br />
2.    Entering the URL (query string) which contains the parameters. This is more convenient if you don’t want to enter the values in the table<br />
The Second method is resorted to if your backend has not been developed fully (but you know the XML format that is returned) or if the server is down. In both these cases flash builder cannot introspect the back end directly. For that, choose the “Enter a sample XML/JSON response” option. Here you can enter the format of the data that is returned.<br />
In our example there are no parameters required. Hence directly click Next and the menu below is got.<br />
<img class="alignnone size-full wp-image-94" title="preconfiguring" src="http://nishadmusthafa.files.wordpress.com/2009/10/preconfiguring.jpg?w=403&#038;h=400" alt="preconfiguring" width="403" height="400" /></p>
<p class="MsoNormal">What we get from the back end is an array of Centre Classes. Hence, we are interested in the Centre data. Go to the Select root Combo box and choose “Centre” like shown below</p>
<p class="MsoNormal"><img class="alignnone size-full wp-image-95" title="selectingcentre" src="http://nishadmusthafa.files.wordpress.com/2009/10/selectingcentre.jpg?w=402&#038;h=399" alt="selectingcentre" width="402" height="399" /></p>
<p class="MsoNormal">You will get the following screen after selection</p>
<p class="MsoNormal"><img class="alignnone size-full wp-image-98" title="selectedcentre" src="http://nishadmusthafa.files.wordpress.com/2009/10/selectedcentre.jpg?w=395&#038;h=390" alt="selectedcentre" width="395" height="390" /></p>
<p class="MsoNormal">Click on finish and you will now see how the Data/Services tab has changed(Click to view a larger image).</p>
<p class="MsoNormal"><a href="http://nishadmusthafa.files.wordpress.com/2009/10/dataservicestabafter.jpg" target="_blank"><img class="alignnone size-full wp-image-99" title="dataservicestabafter" src="http://nishadmusthafa.files.wordpress.com/2009/10/dataservicestabafter.jpg?w=403&#038;h=76" alt="dataservicestabafter" width="403" height="76" /></a></p>
<p class="MsoNormal" style="text-align:justify;"><strong>Data Binding</strong></p>
<p class="MsoNormal" style="text-align:justify;">Under the components menu (highlighted in red in the image below), choose Controls-&gt; DataGrid. Click the image to view a larger image.<strong> </strong></p>
<p class="MsoNormal" style="text-align:justify;"><a href="http://nishadmusthafa.files.wordpress.com/2009/10/components4.jpg?w=1024" target="_blank"><strong><img class="alignnone size-large wp-image-102" title="components" src="http://nishadmusthafa.files.wordpress.com/2009/10/components4.jpg?w=386&#038;h=232" alt="components" width="386" height="232" /></strong></a></p>
<p class="MsoNormal" style="text-align:justify;">Choose DataGrid and drag and drop it into the design view. Right click on the Data Grid and click Bind to data. You will get a menu that looks like the image  below.<strong> </strong></p>
<p class="MsoNormal" style="text-align:justify;"><strong><img class="alignnone size-full wp-image-103" title="bindtodata" src="http://nishadmusthafa.files.wordpress.com/2009/10/bindtodata2.jpg?w=378&#038;h=264" alt="bindtodata" width="378" height="264" /></strong></p>
<p class="MsoNormal" style="text-align:justify;">Enter the name of the service as CentreService and the function as GetCentres() as shown in the image above. Click Ok.<strong> </strong></p>
<p class="MsoNormal" style="text-align:justify;"><strong><img class="alignnone size-full wp-image-104" title="Datagrid" src="http://nishadmusthafa.files.wordpress.com/2009/10/datagrid.jpg?w=309&#038;h=168" alt="Datagrid" width="309" height="168" /></strong></p>
<p class="MsoNormal" style="text-align:justify;">The above image shows what the datagrid will look like. The columns have automatically named according to the name of the members of the Custom type Centre.  All you need to do now is run the program (CTRL + F11) and you will see how the data from the database is completely populated in the Datagrid. <strong> </strong></p>
<p><strong>No code written again<br />
</strong>We managed to connect to a .NET based HTTP service from the Data/Services menu. We were able to configure the returned XML to a strong data type through automatically generated VOs. We ultimately connected the data returned from the backend to a Visual component (Data Grid). This is my second post on DCD. All the flex coding yet again was done without writing a single line of code. The workflow is very smooth and user friendly. Please feel free to post any queries after you have tried it.<br />
<strong></strong></p>
<p>More articles on using Flash Builder 4 can be found at <a href="http://sujitreddyg.wordpress.com/flash-builder-4/" target="_blank">http://sujitreddyg.wordpress.com/flash-builder-4/</a></p>
<p class="MsoListParagraphCxSpLast" style="text-indent:-.25in;">
<p class="MsoListParagraphCxSpLast" style="text-indent:-.25in;">
<div id="_mcePaste" style="position:absolute;width:1px;height:1px;overflow:hidden;top:1563px;left:-10000px;">&lt;!&#8211;[if gte mso 9]&gt; Normal 0 false false false EN-US X-NONE X-NONE &lt;![endif]&#8211;&gt;&lt;!&#8211;[if gte mso 9]&gt; &lt;![endif]&#8211;&gt;<!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:.5in; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:.5in; 	margin-bottom:.0001pt; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:.5in; 	margin-bottom:.0001pt; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:.5in; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:465700905; 	mso-list-type:hybrid; 	mso-list-template-ids:-1294050628 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l0:level2 	{mso-level-number-format:alpha-lower; 	mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} --><!--[if gte mso 10]&gt; &lt;!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:&quot;Table Normal&quot;; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:&quot;&quot;; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} --> &lt;!&#8211;[endif]&#8211;&gt;</div>
<p class="MsoListParagraph" style="text-align:justify;text-indent:-.25in;"> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=58&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2009/10/08/net-based-httpservice-accessed-from-a-flex-application-using-the-data-centric-development-dcd-in-flash-builder-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/schema2.jpg" medium="image">
			<media:title type="html">schema</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/step-2-pic-12.png" medium="image">
			<media:title type="html">step-2-pic-1</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/connectmenu1.jpg" medium="image">
			<media:title type="html">connectmenu</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/httpconnect1.jpg" medium="image">
			<media:title type="html">httpconnect</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/dataservicestabbefore.jpg" medium="image">
			<media:title type="html">dataservicestabbefore</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/configurereturntype1.jpg" medium="image">
			<media:title type="html">configurereturntype</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/autodetectreturn1.jpg" medium="image">
			<media:title type="html">autodetectreturn</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/preconfiguring.jpg" medium="image">
			<media:title type="html">preconfiguring</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/selectingcentre.jpg" medium="image">
			<media:title type="html">selectingcentre</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/selectedcentre.jpg" medium="image">
			<media:title type="html">selectedcentre</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/dataservicestabafter.jpg" medium="image">
			<media:title type="html">dataservicestabafter</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/components4.jpg?w=1024" medium="image">
			<media:title type="html">components</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/bindtodata2.jpg" medium="image">
			<media:title type="html">bindtodata</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/datagrid.jpg" medium="image">
			<media:title type="html">Datagrid</media:title>
		</media:content>
	</item>
		<item>
		<title>Consuming a ASP .NET(C#) based web service from a Flex Application using the Data Centric Development (DCD) in Flash Builder 4</title>
		<link>http://nishadmusthafa.wordpress.com/2009/10/07/consuming-a-net-based-web-service-from-a-flex-application-using-the-data-centric-development-dcd-in-flash-builder-4/</link>
		<comments>http://nishadmusthafa.wordpress.com/2009/10/07/consuming-a-net-based-web-service-from-a-flex-application-using-the-data-centric-development-dcd-in-flash-builder-4/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 14:43:58 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[Data Centric Development(DCD)]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex and .NET]]></category>

		<guid isPermaLink="false">http://nishadmusthafa.wordpress.com/?p=8</guid>
		<description><![CDATA[This tutorial is aimed at .NET developers who would like a Richer User Experience on their client sides using Adobe Flex. Consider a .NET web service that is deployed locally. There is a MySQL database which contains the list of Centres that are used by a Courier company. The Web service is based around this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=8&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This tutorial is aimed at .NET developers who would like a Richer User Experience on their client sides using Adobe Flex. Consider a .NET web service that is deployed locally. There is a MySQL database which contains the list of Centres that are used by a Courier company. The Web service is based around this data base. The web service contains operations that can be used by Flex. First we shall describe the web service provider on the back end and the database. Then, we shall take a look at how these web services can be consumed from flex using the Data Centric Development (DCD) feature of Flash Builder 4. This consists of two phases: -</p>
<ol>
<li>Importing the Service to the Flex Client Side</li>
<li>Binding the services to UI components.</li>
</ol>
<p>All the development on the Flex side will be done without writing a single line of code.</p>
<p><strong>Database</strong></p>
<p>This Web Service accesses a MySQL database table called Centre which has the following schema.</p>
<p><img class="alignnone size-full wp-image-15" title="schema" src="http://nishadmusthafa.files.wordpress.com/2009/10/schema1.jpg?w=450&#038;h=89" alt="schema" width="450" height="89" /></p>
<p>The database was created using the MySQL command line client and the Odbc classes of .NET were used to connect to the database as shown in the code (refer next section for code).</p>
<p><strong>Backend</strong></p>
<p>The language used for coding on the back end is C#. For those who are not familiar with how to implement Web Services on .NET here is a tutorial</p>
<p><a href="http://msdn.microsoft.com/en-us/library/87h5xz7x%28VS.80%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/87h5xz7x%28VS.80%29.aspx</a></p>
<p>These are the files that you will need for reference.</p>
<ol>
<li><a href="http://sujitreddyg.com/fb4articles/beta2/Service.asmx.txt" target="_blank">Service.asmx</a></li>
<li><a href="http://sujitreddyg.com/fb4articles/beta2/service.cs.txt" target="_blank">Service.cs</a></li>
<li><a href="http://sujitreddyg.com/fb4articles/beta2/Centre.cs.txt" target="_blank">Centre.cs</a></li>
</ol>
<p>There are two functions called getCentres() and getCentreNames() in Service.cs. The first function retrieves all the tuples in the database and returns them as an Array of Centre Objects. The second function retrieves the list of CentreName attributes alone and returns them as an array of strings.</p>
<p><strong>WSDL</strong></p>
<p>Now, how does one access the two functions talked about above from the flex client by means of Web services? One way of doing that is using a WSDL.  WSDL (Web Service Description Language) is a standard XML based language used to describe or model web services. For more information, go to the <a href="http://en.wikipedia.org/wiki/Web_Services_Description_Language" target="_blank">wikipedia link</a>.</p>
<p>For all Web Services created in Visual Studio, the WSDL is automatically generated. If the Web Service is deployed on a server, then the path of the WSDL is usually (unless specified otherwise by the user)</p>
<p>http://{serverpath}/{context of the web application}/{Name of the services file- In our example, it is services.asmx}?WSDL</p>
<p>This fact is to be borne in mind. The above path will be referred as WSDL path henceforth.</p>
<p><strong>Importing the Web Services to Flex</strong></p>
<p>We can now turn our attention to Flex.</p>
<p>1. If you don’t already have Flash Builder, download and install Flash Builder 4 from this URL <a href="http://labs.adobe.com/technologies/flashbuilder4/" target="_blank">http://labs.adobe.com/technologies/flashbuilder4/</a>.</p>
<p>2.First create a new Project . Go to File-&gt;New -&gt; Flex Project.</p>
<p>3.In the Screen that appears, enter an appropriate Project name and click Finish.</p>
<p>4.Make sure that the perspective is Flash Perspective. In this perspective, there is a tab called Data/Services (shown in the image below). In the Data/Services window, choose Connect to Data/Service.</p>
<p><img class="alignnone size-full wp-image-19" title="step-2-pic-1" src="http://nishadmusthafa.files.wordpress.com/2009/10/step-2-pic-11.png?w=436&#038;h=324" alt="step-2-pic-1" width="436" height="324" /></p>
<p>5. In the Connect to Data/Service Window, select Web Service and click next.</p>
<p><img class="alignnone size-full wp-image-22" title="step-2-pic-2" src="http://nishadmusthafa.files.wordpress.com/2009/10/step-2-pic-22.png?w=425&#038;h=452" alt="step-2-pic-2" width="425" height="452" /></p>
<p>6. The next menu is a screen which prompts for the Specific WSDL to introspect. Remember the WSDL path that we defined in the previous section. Enter this in the box marked in Red below.  The Service name, service package and Data type package are filled in automatically by Flash Builder. Since the name of the .asmx file is Service, the Service name has the same value by default. Let us rename the service to CentreService so that the name sounds more specific.</p>
<p><img class="alignnone size-full wp-image-23" title="wsdlenter" src="http://nishadmusthafa.files.wordpress.com/2009/10/wsdlenter2.jpg?w=415&#038;h=434" alt="wsdlenter" width="415" height="434" /></p>
<p>7. In the next screen, the web services are introspected and it is possible to see the list of web service operations available. Check on the two function names.</p>
<p>8. Click on Finish and in the same Data/services tab we talked about in step 3, one can view the different operations that were imported.</p>
<p>Hence, in these simple steps, we have imported the operations from a .NET Based Web Service to a flex front end.</p>
<p><strong>DCD Data Binding</strong></p>
<p>For an example of how easy Data Centric Development has made things consider this.</p>
<p><strong>-&gt;</strong> Switch to design view (Ctrl+Shift+`).</p>
<p><strong>-&gt;</strong> Choose the component’s tab from the left(as higlighted in red in the image below- Click to see full image)</p>
<p><a href="http://nishadmusthafa.files.wordpress.com/2009/10/components3.jpg" target="_blank"><img class="alignnone size-large wp-image-46" title="components" src="http://nishadmusthafa.files.wordpress.com/2009/10/components3.jpg?w=553&#038;h=321" alt="components" width="553" height="321" /></a></p>
<p>-&gt; Drag and drop the list to the design view and resize it to on the basis of the number of values in the database.</p>
<p>-&gt; Right click on the List and click Bind To Data</p>
<p>-&gt; Since this is being done for the first time, in the Bind to Data Menu that appears, the Radio Button for New Service Call is checked. Here choose CentreService the Combo box titled Service and for Operation choose getCentreNames():String[].</p>
<p><img class="alignnone size-full wp-image-28" title="bindtodata" src="http://nishadmusthafa.files.wordpress.com/2009/10/bindtodata1.jpg?w=383&#038;h=338" alt="bindtodata" width="383" height="338" /></p>
<p>-&gt; That’s it. Flash builder has generated all the code that’s required. All you need to do is run the program(Ctrl + F11) and you can see how all the elements from the database are populated in the list.</p>
<p>-&gt; Not had enough? Here is more. The same way a list was drag and dropped into the Design View, drag and drop a DataGrid into the design view and repeat the same process.</p>
<p>-&gt; Instead of the getCentreNames():String[] option in under operations, choose getCentres():Centre[].</p>
<p>-&gt; Run the program again and you can see that the table is shown exactly how it was in the database except for the fact that it is flex and looks way better.</p>
<p>-&gt; The Value Object (VO) for the corresponding Class Centre in C# was automatically generated by Flash Builder. Here, a VO is essentially the C# class written in ActionScript. This can be reused for any other purpose as a strong type.</p>
<p><strong>Amazing Workflow</strong></p>
<p>If we consider that the back end work was already done, we managed to connect the web service to the UI components on the Flex Client side in a matter of no time. And all this without writing a single line of code in the Flash Builder.  Now isn’t that simply awesome. Flash Builder + DCD rocks!!</p>
<p>For more articles on Flash Builder 4, visit</p>
<p><a href="http://sujitreddyg.wordpress.com/flash-builder-4/" target="_blank">http://sujitreddyg.wordpress.com/flash-builder-4/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=8&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2009/10/07/consuming-a-net-based-web-service-from-a-flex-application-using-the-data-centric-development-dcd-in-flash-builder-4/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/schema1.jpg" medium="image">
			<media:title type="html">schema</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/step-2-pic-11.png" medium="image">
			<media:title type="html">step-2-pic-1</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/step-2-pic-22.png" medium="image">
			<media:title type="html">step-2-pic-2</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/wsdlenter2.jpg" medium="image">
			<media:title type="html">wsdlenter</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/components3.jpg?w=1024" medium="image">
			<media:title type="html">components</media:title>
		</media:content>

		<media:content url="http://nishadmusthafa.files.wordpress.com/2009/10/bindtodata1.jpg" medium="image">
			<media:title type="html">bindtodata</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://nishadmusthafa.wordpress.com/2009/09/26/hello-world/</link>
		<comments>http://nishadmusthafa.wordpress.com/2009/09/26/hello-world/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 09:09:41 +0000</pubDate>
		<dc:creator>nishadmusthafa</dc:creator>
				<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I hereby make my entry into the blogosphere. I work as a developer for Adobe Systems, Bangalore on flex and the flash platform. I hope to use this blog to share my discoveries and experiences as I work on this amazing technology. The views expressed on this blog are entirely my own and do not necessarily [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=1&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I hereby make my entry into the blogosphere. I work as a developer for Adobe Systems, Bangalore on flex and the flash platform. I hope to use this blog to share my discoveries and experiences as I work on this amazing technology. The views expressed on this blog are entirely my own and do not necessarily reflect the views of Adobe Systems Incorporated.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nishadmusthafa.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nishadmusthafa.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nishadmusthafa.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nishadmusthafa.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nishadmusthafa.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nishadmusthafa.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nishadmusthafa.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nishadmusthafa.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nishadmusthafa.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nishadmusthafa.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nishadmusthafa.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nishadmusthafa.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nishadmusthafa.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nishadmusthafa.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nishadmusthafa.wordpress.com&amp;blog=9660689&amp;post=1&amp;subd=nishadmusthafa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nishadmusthafa.wordpress.com/2009/09/26/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a71fc66fbcbd918de11b928d5b1a05c1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nishadmusthafa</media:title>
		</media:content>
	</item>
	</channel>
</rss>
