<?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/"
	>

<channel>
	<title>Horia Condrea</title>
	<atom:link href="http://horiacondrea.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://horiacondrea.com</link>
	<description>Programming has never been so easy!</description>
	<lastBuildDate>Fri, 11 May 2012 19:37:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Flex Subscriber Tutorial with PHP and SQL</title>
		<link>http://horiacondrea.com/2012/05/09/flex-subscriber-tutorial-with-php-and-sql/</link>
		<comments>http://horiacondrea.com/2012/05/09/flex-subscriber-tutorial-with-php-and-sql/#comments</comments>
		<pubDate>Wed, 09 May 2012 18:07:33 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[newsletter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[subscriber]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=290</guid>
		<description><![CDATA[In this tutorial I will show you how to make a Flex Subscriber(Newsletter), using Flex , PHP and of course SQL, because I will stock the informations in a database. First of all, I will show you the final result of this project and then I'll try to explain how it is made. I think [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will show you how to make a Flex Subscriber(Newsletter), using Flex , PHP and of course SQL, because I will stock the informations in a database. First of all, I will show you the final result of this project and then I'll try to explain how it is made. I think this is not such a complicated tutorial, but you need to stay focus.</p>
<h2>Final Result Preview</h2>
<p><CENTER><br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_SubscribeFlex_321755414"
			class="flashmovie"
			width="300"
			height="100">
	<param name="movie" value="http://www.horiacondrea.com/wp-content/uploads/article/FlexSubscriber/SubscribeFlex.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.horiacondrea.com/wp-content/uploads/article/FlexSubscriber/SubscribeFlex.swf"
			name="fm_SubscribeFlex_321755414"
			width="300"
			height="100">
	<!--<![endif]-->
		<br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
</CENTER></p>
<p><strong>This preview is not connected to any database, so it will not run as it should.</strong></p>
<h2>Database</h2>
<p>The first thing that we need to do, is to create a table inside the database.Go to your phpMyAdmin and create a new table, name it <strong>subscribe</strong>. And below is a picture of how this table should look.<br />
<a href="http://www.horiacondrea.com/wp-content/uploads/article/FlexSubscriber/database.jpg" rel="lightbox[917]" title="Create Table"><img class="size-medium wp-image-45" title="Create Table" src="http://www.horiacondrea.com/wp-content/uploads/article/FlexSubscriber/database.jpg" alt="Create Table" width="500" height="500" /></a></p>
<p>As you can see it's a very simple table, because we only need to store an email address. Now that we have our table, we can move to the next step.</p>
<h2>Code</h2>
<p>First of all, you will need to create a new Flex Project, by clicking File -> New - > Flex Project. Name the project however you want, and then click Finish.</p>
<pre class="brush: as3; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot;
			   width=&quot;299&quot; height=&quot;100&quot; backgroundAlpha=&quot;0&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot;
			   preloaderChromeColor=&quot;#000000&quot;&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			protected function sendEmail(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				var str:String = EmailTXT.text;
				if(checkEmail(str)==true)
				{
					var myData:URLRequest = new URLRequest(&quot;data.php&quot;);
					myData.method = URLRequestMethod.POST;
					var variables:URLVariables = new URLVariables();
					variables.email = EmailTXT.text;
					myData.data = variables;
					var loader:URLLoader = new URLLoader();
					loader.dataFormat = URLLoaderDataFormat.VARIABLES;
					loader.addEventListener(Event.COMPLETE,onComplete);
					loader.load(myData);
				}
				else
				{
					errorTXT.text = &quot;Invalid Email&quot;;
				}
			}

			protected function onComplete(event:Event):void
			{
				if(event.target.data.writing == &quot;Ok&quot;)
				{
					errorTXT.text = &quot;Thank You&quot;;
				}

				else
				{
					errorTXT.text = &quot;Server Error&quot;;
				}
			}

			protected function checkEmail(inputEmail:String):Boolean {
				//check for spaces
				if (inputEmail.indexOf(&quot; &quot;)&gt;0) {
					return false;
				}
				//bust the email apart into what comes before the @ and what comes after
				var emailArray:Array=inputEmail.split(&quot;@&quot;);
				//make sure there's exactly one @ symbol also make sure there's at least one character before and after the @
				if (emailArray.length != 2 || emailArray[0].length == 0 || emailArray[1].length ==0) {
					return false;
				}
				//bust apart the stuff after the @ apart on any . characters
				var postArray:Array=emailArray[1].split(&quot;.&quot;);
				//make sure there's at least one . after the @
				if (postArray.length &lt; 2) {
					return false;
				}
				//make sure there's at least 1 character in in each segment before, between and after each .
				for (var i:Number=0; i&lt;postArray.length; i++) {
					if (postArray[i].length &lt; 1) {
						return false;
					}
				}
				//get what is left after the last .
				var suffix=postArray[postArray.length-1];
				//make sure that the segment at the end is either 2 or 3 characters
				if (suffix.length &lt; 2 || suffix.length &gt; 3) {
					return false;
				}
				//it passed all tests, it's a valid email
				return true;
			}
		]]&gt;
	&lt;/fx:Script&gt;

	&lt;fx:Declarations&gt;
		&lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
	&lt;/fx:Declarations&gt;
	&lt;s:Rect width=&quot;100%&quot; height=&quot;100%&quot;&gt;
		&lt;s:fill&gt;&lt;s:SolidColor color=&quot;0xF7F6F6&quot;/&gt;&lt;/s:fill&gt;
	&lt;/s:Rect&gt;
	&lt;s:TextInput x=&quot;14&quot; y=&quot;10&quot; width=&quot;276&quot; borderColor=&quot;#00AAFF&quot; chromeColor=&quot;#F7F6F6&quot;
				 color=&quot;#000000&quot; contentBackgroundColor=&quot;#FFFFFF&quot; prompt=&quot;Email&quot; id=&quot;EmailTXT&quot;/&gt;
	&lt;s:Button x=&quot;119&quot; y=&quot;40&quot; label=&quot;Send&quot; color=&quot;#000000&quot; click=&quot;sendEmail(event)&quot;/&gt;
	&lt;s:Label id=&quot;errorTXT&quot; x=&quot;89&quot; y=&quot;69&quot; width=&quot;130&quot; color=&quot;#FF0000&quot; textAlign=&quot;center&quot;/&gt;
&lt;/s:Application&gt;
</pre>
<p>I don't think  this piece of code is hard to understand . As you can see I have a very simple design, which incorporates components:one button, a Label, one TextInput, where users will write their email address and a Rectangle that plays the role of a background.<br />
Let's see what is happening when the -Send- button is clicked: </p>
<pre class="brush: as3; title: ; notranslate">
protected function sendEmail(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				var str:String = EmailTXT.text;
				if(checkEmail(str)==true)
				{
					var myData:URLRequest = new URLRequest(&quot;data.php&quot;);
					myData.method = URLRequestMethod.POST;
					var variables:URLVariables = new URLVariables();
					variables.email = EmailTXT.text;
					myData.data = variables;
					var loader:URLLoader = new URLLoader();
					loader.dataFormat = URLLoaderDataFormat.VARIABLES;
					loader.addEventListener(Event.COMPLETE,onComplete);
					loader.load(myData);
				}
				else
				{
					errorTXT.text = &quot;Invalid Email&quot;;
				}
			}

			protected function onComplete(event:Event):void
			{
				if(event.target.data.writing == &quot;Ok&quot;)
				{
					errorTXT.text = &quot;Thank You&quot;;
				}

				else
				{
					errorTXT.text = &quot;Server Error&quot;;
				}
			}

			protected function checkEmail(inputEmail:String):Boolean {
				//check for spaces
				if (inputEmail.indexOf(&quot; &quot;)&gt;0) {
					return false;
				}
				//bust the email apart into what comes before the @ and what comes after
				var emailArray:Array=inputEmail.split(&quot;@&quot;);
				//make sure there's exactly one @ symbol also make sure there's at least one character before and after the @
				if (emailArray.length != 2 || emailArray[0].length == 0 || emailArray[1].length ==0) {
					return false;
				}
				//bust apart the stuff after the @ apart on any . characters
				var postArray:Array=emailArray[1].split(&quot;.&quot;);
				//make sure there's at least one . after the @
				if (postArray.length &lt; 2) {
					return false;
				}
				//make sure there's at least 1 character in in each segment before, between and after each .
				for (var i:Number=0; i&lt;postArray.length; i++) {
					if (postArray[i].length &lt; 1) {
						return false;
					}
				}
				//get what is left after the last .
				var suffix=postArray[postArray.length-1];
				//make sure that the segment at the end is either 2 or 3 characters
				if (suffix.length &lt; 2 || suffix.length &gt; 3) {
					return false;
				}
				//it passed all tests, it's a valid email
				return true;
			}
</pre>
<p>Let's imagine: A guy come thru my website, he likes what he sees, and he decides to give me his email address, in order to receive notification. This guy sees my Subscriber Form, and he is now writing his email address and then clicks the Send button. In that moment my application checks if his email address is correct or not. This function, that does this thing inside my application, is called <strong>checkEmail</strong>, and you can see it right above.<br />
Then, if the email address is incorrect a message will appear, if the email address is correct we can move to the next step.<br />
As I said, if the email address is correct, the program will connect to the PHP file and send that email address as a variable. Now is time to see how my PHP file looks: </p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$emailCopy = $_POST['email'];
$connect = mysql_connect(&quot;HOST&quot;, &quot;USER&quot;, &quot;PASSWORD&quot;);
mysql_select_db(&quot;DATABASE_NAME&quot;, $connect);

$result = mysql_query(&quot;INSERT INTO subscribe(email) VALUES('$emailCopy')&quot;);
if($result) echo &quot;writing=Ok&amp;&quot;;
else echo &quot;writing=Error&quot;;

$query = 'SELECT * FROM subscribe';

if($result = mysql_query($query)) {
	    $output = 'entries=';
	    while ($row = mysql_fetch_array($result)) {
	        $output .= &quot;{$row['email']}&lt;br /&gt;&quot;;
	    }
	    echo($output);
	}
?&gt;
</pre>
<p>If the PHP file can connect to my database, he will send this email address to my table named subscribe.<br />
This is a very simple way to create a Newsletter for your website, not very hard and easy to implement, and you have full control on your design. You can make it however you want. I will give you the source code, and of course if you have any question, feel free to ask and I will get back at you as soon as I can.<br />
<div id='wpdm_file_3' class='wpdm_file wpdm-only-button'><div class='cont'><div class='btn_outer'><div class='btn_outer_c'><a class='btn_left  has-counter' rel='3' title='FlexSubscriber' href='http://horiacondrea.com/?wpdmact=process&did=My5ob3RsaW5r'  >Download</a><span class='btn_right counter'>5 downloads</span></div></div><div class='clear'></div></div></div></p>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/05/09/flex-subscriber-tutorial-with-php-and-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Password Generator in AS 3.0 (Tutorial)</title>
		<link>http://horiacondrea.com/2012/05/02/simple-password-generator-in-as-3-0-tutorial/</link>
		<comments>http://horiacondrea.com/2012/05/02/simple-password-generator-in-as-3-0-tutorial/#comments</comments>
		<pubDate>Wed, 02 May 2012 12:46:27 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[action script]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[as3.0]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[do]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[generate]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=252</guid>
		<description><![CDATA[Welcome again to my website, I am here with a new and fresh lesson Simple Password Generator in AS 3.0 (Tutorial), I hope it will be helpful for many of you. In this tutorial I will show you how to make a simple password generator in Flash Builder using AS 3.0 and Flex. Final Result [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome again to my website, I am here with a new and fresh lesson <strong>Simple Password Generator in AS 3.0 (Tutorial)</strong>, I hope it will be helpful for many of you. In this tutorial I will show you how to make a simple password generator in Flash Builder using AS 3.0 and Flex.</p>
<h2>Final Result Preview</h2>
<p><CENTER><br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FlexPassGenerator_1914912134"
			class="flashmovie"
			width="450"
			height="150">
	<param name="movie" value="http://www.horiacondrea.com/wp-content/uploads/article/Simple%20Password%20Generator%20in%20AS%203.0/FlexPassGenerator.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.horiacondrea.com/wp-content/uploads/article/Simple%20Password%20Generator%20in%20AS%203.0/FlexPassGenerator.swf"
			name="fm_FlexPassGenerator_1914912134"
			width="450"
			height="150">
	<!--<![endif]-->
		<br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
</CENTER></p>
<p>First of all, you will need to create a new <strong>Flex Project</strong>, by clicking <em>File -&gt; New - &gt; Flex Project</em>. Name the project whatever you want, and then click <em>Finish</em>.</p>
<h2>Code</h2>
<p>Now, let's take a look at this code:</p>
<pre class="brush: as3; title: ; notranslate">

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot;
			   width=&quot;450&quot; height=&quot;150&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot; backgroundColor=&quot;#ACACAC&quot;
			   preloaderChromeColor=&quot;#D2D2D2&quot;&gt;

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

			protected function generatePass(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				var PassLenght:int = lenght.value;
			    var passArray:Array =  new Array();
			    var password:String;

				for(var i:int = 0; i &lt; PassLenght; i++)
				{
					var r:int;
					if(numbers.selected == false)
					{
						r = Math.floor(Math.random()*(1+122-65))+65;
					}
					else
					{
						r = Math.floor(Math.random()*(1+122-48))+48
					}

					passArray.push(String.fromCharCode(r));
					password = passArray.join(&quot;&quot;);

					txt.text = password;
				}
			}

			protected function savePass(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				var saveFile:FileReference =  new FileReference();

				saveFile.save(txt.text, &quot;myPass&quot;);
			}

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

	&lt;fx:Declarations&gt;
		&lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
	&lt;/fx:Declarations&gt;
	&lt;s:TextArea x=&quot;6&quot; y=&quot;10&quot; id=&quot;txt&quot; height=&quot;32&quot; editable=&quot;false&quot; fontFamily=&quot;Georgia&quot; fontSize=&quot;20&quot;/&gt;
	&lt;s:Button x=&quot;336&quot; y=&quot;9&quot; width=&quot;100&quot; height=&quot;32&quot; label=&quot;Generate&quot; click=&quot;generatePass(event)&quot;/&gt;
	&lt;s:CheckBox x=&quot;10&quot; y=&quot;66&quot; id=&quot;numbers&quot; width=&quot;101&quot; height=&quot;32&quot; label=&quot;Numbers&quot; enabled=&quot;true&quot; selected=&quot;true&quot;/&gt;
	&lt;s:Label x=&quot;9&quot; y=&quot;115&quot; id=&quot;Passlenght&quot; fontSize=&quot;15&quot; text=&quot;Password lenght:&quot;/&gt;
	&lt;s:HSlider id=&quot;lenght&quot; x=&quot;134&quot; y=&quot;110&quot; height=&quot;21&quot;
			   liveDragging=&quot;true&quot; maximum=&quot;24&quot; minimum=&quot;4&quot;/&gt;
	&lt;s:Button x=&quot;336&quot; y=&quot;112&quot; width=&quot;100&quot; height=&quot;32&quot; label=&quot;Save&quot; enabled=&quot;true&quot;
			  skinClass=&quot;spark.skins.spark.DefaultButtonSkin&quot; id=&quot;saveBtn&quot; click=&quot;savePass(event)&quot;/&gt;
&lt;/s:Application&gt;
</pre>
<p>So, first of all I will take the last part of my code and I'll explain it, this part is where our components are added to the stage.</p>
<pre class="brush: as3; title: ; notranslate">
&lt;s:TextArea x=&quot;6&quot; y=&quot;10&quot; id=&quot;txt&quot; height=&quot;32&quot; editable=&quot;false&quot; fontFamily=&quot;Georgia&quot; fontSize=&quot;20&quot;/&gt;
</pre>
<p>This is the text field where our password is generated, as you can see, the parameters that were used are very simple to understand(id, x ,y, etc.). I don't think you have any problem in understanding this.</p>
<pre class="brush: as3; title: ; notranslate">
&lt;s:Button x=&quot;336&quot; y=&quot;9&quot; width=&quot;100&quot; height=&quot;32&quot; label=&quot;Generate&quot; click=&quot;generatePass(event)&quot;/&gt;
</pre>
<p>Next is the button that generate our random password. We have a CLICK event that generate a function called <strong>generatePass</strong>. In fact this function  makes our application works, she is the main function that generate the password.</p>
<pre class="brush: as3; title: ; notranslate">
&lt;s:CheckBox x=&quot;10&quot; y=&quot;66&quot; id=&quot;numbers&quot; width=&quot;101&quot; height=&quot;32&quot; label=&quot;Numbers&quot; enabled=&quot;true&quot; selected=&quot;true&quot;/&gt;
</pre>
<p>If you want any number in your password, check this box, if not then unchecked this box. Is very simple.</p>
<pre class="brush: as3; title: ; notranslate">
&lt;s:Label x=&quot;9&quot; y=&quot;115&quot; id=&quot;Passlenght&quot; fontSize=&quot;15&quot; text=&quot;Password lenght:&quot;/&gt;
	&lt;s:HSlider id=&quot;lenght&quot; x=&quot;134&quot; y=&quot;110&quot; height=&quot;21&quot;
			   liveDragging=&quot;true&quot; maximum=&quot;24&quot; minimum=&quot;4&quot;/&gt;
</pre>
<p>Here, we have a Label that contains a string and a HSlider that return the number oh characters that the password will have.</p>
<pre class="brush: as3; title: ; notranslate">
&lt;s:Button x=&quot;336&quot; y=&quot;112&quot; width=&quot;100&quot; height=&quot;32&quot; label=&quot;Save&quot; enabled=&quot;true&quot;
			  skinClass=&quot;spark.skins.spark.DefaultButtonSkin&quot; id=&quot;saveBtn&quot; click=&quot;savePass(event)&quot;/&gt;
</pre>
<p>And finally another Button, that saves the password in your computer, in order not to forget it.</p>
<p>Now, let's take a look at our AS 3.0 code:</p>
<pre class="brush: as3; title: ; notranslate">
protected function generatePass(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				var PassLenght:int = lenght.value;
			    var passArray:Array =  new Array();
			    var password:String;

				for(var i:int = 0; i &lt; PassLenght; i++)
				{
					var r:int;
					if(numbers.selected == false)
					{
						r = Math.floor(Math.random()*(1+122-65))+65;
					}
					else
					{
						r = Math.floor(Math.random()*(1+122-48))+48
					}

					passArray.push(String.fromCharCode(r));
					password = passArray.join(&quot;&quot;);

					txt.text = password;
				}
			}
</pre>
<p>The first function, is that one that generate the password. At first I declare three variables, <strong>PassLenght</strong> => return the number that HSlider gives,<strong> passArray</strong> => this is only an array that will hold the password and <strong>password</strong> that is a String and finally this will be our password. </p>
<p>This loop is very easy to understand as well:</p>
<pre class="brush: as3; title: ; notranslate">
for(var i:int = 0; i &lt; PassLenght; i++)
				{
					var r:int;
					if(numbers.selected == false)
					{
						r = Math.floor(Math.random()*(1+122-65))+65;
					}
					else
					{
						r = Math.floor(Math.random()*(1+122-48))+48
					}

					passArray.push(String.fromCharCode(r));
					password = passArray.join(&quot;&quot;);

					txt.text = password;
				}
</pre>
<p>What I'm doing here is something like : "If the CheckBox is unchecked => generate a password without any number if the CheckBox is checked => generate a password with numbers". In order to do that I looked in ASCII code, and I saw that the letters are between (65 - 122) and the numbers are between (48 - 57), and this is how my "r" variable works. If  the CheckBox is unchecked, my "r" variable generate numbers between (65 - 122), if the CheckBox is checked my "r" variable generate numbers between (48 - 122).<br />
After that, I transformed my numbers into characters, and I push them into an array.</p>
<p>This line of code:</p>
<pre class="brush: as3; title: ; notranslate">
password = passArray.join(&quot;&quot;);
</pre>
<p>remove the comma between the characters.</p>
<p>Next function is a very very simple one:</p>
<pre class="brush: as3; title: ; notranslate">
protected function savePass(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				var saveFile:FileReference =  new FileReference();

				saveFile.save(txt.text, &quot;myPass&quot;);
			}
</pre>
<p>This, save your password in your computer.</p>
<p>I hope this tutorial will help you, and if you have any questions don't hesitate to ask.<br />
<div id='wpdm_file_4' class='wpdm_file wpdm-only-button'><div class='cont'><div class='btn_outer'><div class='btn_outer_c'><a class='btn_left  has-counter' rel='4' title='FlexPassGenerator' href='http://horiacondrea.com/?wpdmact=process&did=NC5ob3RsaW5r'  >Download</a><span class='btn_right counter'>3 downloads</span></div></div><div class='clear'></div></div></div></p>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/05/02/simple-password-generator-in-as-3-0-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HoriaCondrea.com on Google AdWords</title>
		<link>http://horiacondrea.com/2012/04/30/horiacondrea-com-on-google-adwords/</link>
		<comments>http://horiacondrea.com/2012/04/30/horiacondrea-com-on-google-adwords/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 12:15:10 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[ad]]></category>
		<category><![CDATA[advertising]]></category>
		<category><![CDATA[adwords]]></category>
		<category><![CDATA[condrea]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[horia]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=242</guid>
		<description><![CDATA[I'm happy to tell you that in the next days my Google AdWords campaign is about to start and I hope it will bring more people to my website. I want to show you how my ad looks, it was made by my beautiful girlfriend, who is a very talented designer. I hope you like [...]]]></description>
			<content:encoded><![CDATA[<p>I'm happy to tell you that in the next days my Google AdWords campaign is about to start and I hope it will bring more people to my website. I want to show you how my ad looks, it was made by my beautiful girlfriend, who is a very talented designer. I hope you like my ad, and I'm confident that it will bring a lot of interesting people to my website.</p>
<p>See you soon on my next tutorials, I promise you I will make a couple of new and fresh tutorial for advanced users.</p>
<p>Tell me what do you think:</p>
<p><center><br />
<img src="http://www.horiacondrea.com/wp-content/uploads/article/HoriaCondrea.com%20on%20Google%20AdWords/adv250x250..jpg" alt="adv" /></center></p>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/04/30/horiacondrea-com-on-google-adwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with C [4]</title>
		<link>http://horiacondrea.com/2012/04/09/getting-started-with-c-4/</link>
		<comments>http://horiacondrea.com/2012/04/09/getting-started-with-c-4/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 15:59:06 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[amount]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[divison]]></category>
		<category><![CDATA[do]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[printf]]></category>
		<category><![CDATA[scanf]]></category>
		<category><![CDATA[substract]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[while]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=221</guid>
		<description><![CDATA[Now that you know how C language works,I will show you how to create a function, I will tell you how to work with functions, and why are functions so important in any programming language. I will start with a very simple example, I will gather two numbers using a function. This was a very [...]]]></description>
			<content:encoded><![CDATA[<p>Now that you know how C language works,I will show you how to create a function, I will tell you how to work with functions, and why are functions so important in any programming language. I will start with a very simple example, I will gather two numbers using a function.</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int amount(int, int);

int main()
{
	int a = 0,b =0;

	printf(&quot;a:&quot;);
	scanf(&quot;%d&quot;, &amp;a);

	printf(&quot;b:&quot;);
	scanf(&quot;%d&quot;, &amp;b);

	printf(&quot;%d + %d = %d&quot;,a,b,amount(a,b));

	getchar();

    return 0;
}

int amount(int a, int b)
{
	int c;
	c = a + b;

	return c;
}
</pre>
<p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B4%5D/c1.png" alt="C++ Function" /><br />
This was a very simple example, now let's try to do something more fun and more complex.</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int amount(int, int);
int subtract(int, int);
int multiplication(int,int);
int division(int,int);

void menu();

int main()
{
	int a;
	int b;
	printf(&quot;a:&quot;);
	scanf(&quot;%d&quot;, &amp;a);

	printf(&quot;b:&quot;);
	scanf(&quot;%d&quot;, &amp;b);

	menu();

	int option;

	do{
	    printf(&quot;\\nChoose Option:&quot;);
	    scanf(&quot;%d&quot;,&amp;option);

		switch(option)
		{
		case 1:
			printf(&quot;a + b = %d&quot;, amount(a,b));
			break;

		case 2:
			printf(&quot;a - b = %d&quot;, subtract(a,b));
			break;

		case 3:
			printf(&quot;a * b = %d&quot;, multiplication(a,b));
			break;

		case 4:
			printf(&quot;a / b = %d&quot;, division(a,b));
			break;

		default:
			printf(&quot;Invalid Input&quot;);

		}
	}while(option != 5);

	getchar();

	return 0;
}

int amount(int a, int b)
{
	int c;
	c = a + b;

	return c;
}

int subtract(int a, int b)
{
	int c;
	c = a - b;

	return c;
}

int multiplication(int a, int b)
{
	int c;
	c = a * b;

	return c;
}

int division(int a, int b)
{
	int c;
	c = a / b;

	return c;
}

void menu()
{
	printf(&quot;**********************&quot;);
	printf(&quot;\\n1. +&quot;);
	printf(&quot;\\n2. -&quot;);
	printf(&quot;\\n3. *&quot;);
	printf(&quot;\\n4. /&quot;);
	printf(&quot;\\n**********************&quot;);
}
</pre>
<p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B4%5D/c2.png" alt="C++ Function" /><br />
Well, is not so complex after all, but is a very good example of how functions works. I don't know what to tell you more, but if you have any kind of questions don't hesitate to ask me. I will answer, and I will try to help you as much as I can. Working with functions is very important and you need to understand this very well in order to progress with any programing language.<br />
I made you another very simple and short example,  look at this code:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int max2(int, int);
int max3(int, int, int);

int main()
{
    int a,b,c;
    printf(&quot;a=&quot;);
    scanf(&quot;%d&quot;, &amp;a);
    printf(&quot;b=&quot;);
    scanf(&quot;%d&quot;, &amp;b);
    printf(&quot;c=&quot;);
    scanf(&quot;%d&quot;, &amp;c);

    printf(&quot;\\nMax2(%d,%d) = %d&quot;, a,b, max2(a,b));
    printf(&quot;\\nMax3(%d,%d,%d) = %d&quot;, a,b,c, max3(a,b,c));

	getchar();
	getchar();

    return 0;
}

int max2(int a, int b)
{
    return a &gt; b ? a:b;
}

int max3(int a, int b, int c)
{
    int m = max2(a,b);
    m = max2(m,c);
    return m;
}
</pre>
<p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B4%5D/c3.png" alt="C++ Function" /><br />
Maybe you don't understand this line:</p>
<pre class="brush: cpp; title: ; notranslate">
 return a &gt; b ? a:b;
</pre>
<p>This means: If a > b return a else return b</p>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/04/09/getting-started-with-c-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip:Use a matrix to multiply an object in AS 3.0</title>
		<link>http://horiacondrea.com/2012/03/21/quick-tipuse-a-matrix-to-multiply-an-object-in-as-3-0/</link>
		<comments>http://horiacondrea.com/2012/03/21/quick-tipuse-a-matrix-to-multiply-an-object-in-as-3-0/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 18:04:22 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[multiply]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[quick tip]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=210</guid>
		<description><![CDATA[This is a method frequently used among flash developers, when they want to multiply an object. Is not hard to understand I'm sure that this will be a piece of cake for you guys. First, create a new class in your project and name it Object, this will be the class that will draw the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a method frequently used among flash developers, when they want to multiply an object. Is not hard to understand I'm sure that this will be a piece of cake for you guys.</p>
<p>First, create a new class in your project and name it <strong>Object</strong>, this will be the class that will draw the object that we will multiply. Let's take a look in our file(Object.as):</p>
<pre class="brush: as3; title: ; notranslate">
package hc
{
	import flash.display.Sprite;

	public class Object extends Sprite
	{
		public function Object():void
		{
			with(this.graphics)
			{
				beginFill(0x333333,1);
				drawRect(10,10,10,10);
				endFill();
			}

		}
	}
}
</pre>
<p>As you can see in the Object class I only draw an object. Now let's see how our main class looks like:</p>
<pre class="brush: as3; title: ; notranslate">
package
{
	import flash.display.Sprite;

	import hc.Object;

	public class main extends Sprite
	{
		private static const DISTANCE_X:Number = 15;
		private static const DISTANCE_Y:Number = 15;

		private var container:Sprite = new Sprite();
		private var numberX:Number = 10;
		private var numberY:Number = 10;

		public function main()
		{
			for(var i:int = 0; i &lt; numberX; i++)
			{
				for(var j:int = 0; j &lt; numberY; j++)
				{
					var obj:hc.Object = new hc.Object();
					obj.x = DISTANCE_X * i;
					obj.y = DISTANCE_Y * j;
					container.addChild(obj);
					addChild(container);

				}

			}

		}
	}
}
</pre>
<p>Make sure that your Object class is inside a folder(package).<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Other_410716091"
			class="flashmovie"
			width="620"
			height="480">
	<param name="movie" value="http://www.horiacondrea.com/wp-content/uploads/article/Use%20a%20matrix%20to%20multiply%20an%20object/Other.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.horiacondrea.com/wp-content/uploads/article/Use%20a%20matrix%20to%20multiply%20an%20object/Other.swf"
			name="fm_Other_410716091"
			width="620"
			height="480">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/03/21/quick-tipuse-a-matrix-to-multiply-an-object-in-as-3-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adobe Shadow</title>
		<link>http://horiacondrea.com/2012/03/13/adobe-shadow/</link>
		<comments>http://horiacondrea.com/2012/03/13/adobe-shadow/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 21:44:19 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[devices]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[shadow]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=200</guid>
		<description><![CDATA[Adobe® Shadow is a new inspection and preview tool that allows front-end web developers and designers to work faster and more efficiently by streamlining the preview process, making it easier to customize websites for mobile devices. Shadow will be updated regularly to stay ahead of web standards, web browser updates and support for new mobile [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Adobe® Shadow is a new inspection and preview tool that allows front-end web developers and designers to work faster and more efficiently by streamlining the preview process, making it easier to customize websites for mobile devices.</p>
<p>Shadow will be updated regularly to stay ahead of web standards, web browser updates and support for new mobile devices entering the market, while incorporating user feedback to provide the best functionality and experience possible.</p></blockquote>
<p><iframe title='AdobeTV Video Player' width='600' height='360' src='http://tv.adobe.com/embed/877/12009/' frameborder='0' allowfullscreen scrolling='no'></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/03/13/adobe-shadow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s make some exercises in C</title>
		<link>http://horiacondrea.com/2012/02/29/lets-make-some-exercises-in-c/</link>
		<comments>http://horiacondrea.com/2012/02/29/lets-make-some-exercises-in-c/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 15:43:51 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[amicable]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[Checking Prime Number]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[prime numbers]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=180</guid>
		<description><![CDATA[In this article we will make some exercises, to see how C works. I hope this article will help you understand better how a program should look.Let's get to work! 1. Prime Numbers This program gives us all prime numbers down to a number that we choose. 2. Checking Prime Number In this example I [...]]]></description>
			<content:encoded><![CDATA[<p>In this article we will make some exercises, to see how C works. I hope this article will help you understand better how a program should look.Let's get to work!</p>
<h4><strong>1. Prime Numbers</strong></h4>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

using namespace std;

int main()
{
	int i,j,nr;

	printf(&quot;Number::&quot;);
	scanf(&quot;%d&quot;, &amp;nr);

	for(i = 2; i &lt; nr; i++)
	{
		for(j = 2; j &lt;= i/2; j++)
		{
			if(!(i % j))
				break;
		}
		if(j &gt; i / 2)
		{
			printf(&quot;  &quot;);
			printf(&quot;%d&quot;,i);
		}
	}
	getchar();
	return 0;
}
</pre>
<p>This program gives us all prime numbers down to a number that we choose.</p>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Let%27s%20make%20some%20exercises%20in%20C/number1.png" alt="" /></p></blockquote>
<h4><strong>2. Checking Prime Number</strong></h4>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

using namespace std;

int main()
{
	int nr, s = 0;;
	printf(&quot;Number:&quot;);
	scanf(&quot;%d&quot;,&amp;nr);

	for(int i = 1; i &lt;= nr; i++)
	{
		if(nr % i == 0)
			s =s + 1;
	}

	if(s == 2)
		printf(&quot;The number is prime&quot;);
	else
		printf(&quot;The number is not prime&quot;);

	getchar();

	return 0;
}
</pre>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Let%27s%20make%20some%20exercises%20in%20C/number2.png" alt="" /></p></blockquote>
<p>In this example I check if a number is prime or not. </p>
<h4><strong>3. Matrix</strong></h4>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
    int l, c, mat[10][10];

    printf(&quot;Number of lines:&quot;); scanf(&quot;%d&quot;, &amp;l);
    printf(&quot;Number of columns:&quot;); scanf(&quot;%d&quot;, &amp;c);

    if( l!= c)
    {
        printf(&quot;Matrix is ​​not square&quot;);
    }

    if(l == c)
    {
       for(int i = 0;i &lt; l;i++)
       {
           for(int j = 0 ;j &lt; c;j++)
           {
               printf(&quot;mat[%d][%d]=&quot;, i, j);
               scanf(&quot;%d&quot;, &amp;mat[i][j]);
           }

       }

       printf(&quot;Main diagonal elements:&quot;);
       for(int q = 0; q &lt; l; q++)
       {
           printf(&quot;%d&quot;, mat[q][q]);
           printf(&quot;   &quot;);
       }

    }
	getchar();

    return 0;
}
</pre>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Let%27s%20make%20some%20exercises%20in%20C/number3.png" alt="" /></p></blockquote>
<p>As you can see in this example I made an application, that returns us the main diagonal elements of a matrix with n lines and n columns (n < 10). </p>
<h4><strong>4. Amicable Numbers</strong></h4>
<p>Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number. For example, the smallest pair of amicable numbers is (220, 284); for the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110 - whose sum is 284; and the proper divisors of 284 are 1, 2, 4, 71 and 142- the sum of which is 220. </p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;
#include &lt;stdio.h&gt;

using namespace std;

int main()
{
    int nr,sd1,sd2;
    nr = 2;
    while(nr &lt; 10000)
    {
        sd1 = 0;
        for(int i = 1; i &lt;= nr / 2; i++)
        {
            if(nr % i == 0)
            {
                sd1 =  sd1 + i;
            }
        }

        sd2 = 0;
        for(int i = 1; i &lt;= sd1 / 2; i++)
        {
            if(sd1%i == 0)
            {
                sd2 =  sd2 + i;
            }
        }

        if(sd2 == nr &amp;&amp; nr &lt; sd1)
        {
            printf(&quot;%d - %d\n&quot;, nr,sd1);
        }

        nr++;
    }
	getchar();

    return 0;
}
</pre>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Let%27s%20make%20some%20exercises%20in%20C/number4.png" alt="" /></p></blockquote>
<p>Now we have all amicable numbers till 10000.</p>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/02/29/lets-make-some-exercises-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Develop Your First Flex Android Application</title>
		<link>http://horiacondrea.com/2012/02/25/develop-your-first-flex-android-application/</link>
		<comments>http://horiacondrea.com/2012/02/25/develop-your-first-flex-android-application/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 23:46:24 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=159</guid>
		<description><![CDATA[In this tutorial I will show you how to make a very simple application for Android devices, and for that we're gonna use Flash Builder 4.5, and we will make a Flex Mobile Project. First, create a new Flex Mobile Project and name it HelloWolrd, after that you will see these 2 .mxml files which [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will show you how to make a very simple application for Android devices, and for that we're gonna use <strong>Flash Builder 4.5</strong>, and we will make a <strong>Flex Mobile Project.</strong><br />
First, create a new Flex Mobile Project and name it HelloWolrd, after that you will see these 2 .mxml files which will be created: HelloWorld.mxml and HelloWorldHomeView.mxml.</p>
<h4><strong>Step 1</strong></h4>
<p>Open your HelloWorldHomeView.mxml file and put this code inside:</p>
<pre class="brush: as3; title: ; notranslate">

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:View xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
		xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot; title=&quot;HomeView&quot;&gt;
	&lt;fx:Declarations&gt;
		&lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
	&lt;/fx:Declarations&gt;

	&lt;s:VGroup width=&quot;100%&quot; height=&quot;100%&quot; verticalAlign=&quot;middle&quot; horizontalAlign=&quot;center&quot;&gt;
		&lt;s:Label text=&quot;Click to find something about me&quot;/&gt;
		&lt;s:Button label=&quot;Click Me!&quot; click=&quot;navigator.pushView(About)&quot; styleName=&quot;next&quot;/&gt;
		&lt;s:Label text=&quot;How are you?&quot;/&gt;
		&lt;s:Button label=&quot;Send me your name!&quot; click=&quot;navigator.pushView(Sending)&quot; styleName=&quot;next&quot;/&gt;
	&lt;/s:VGroup&gt;
&lt;/s:View&gt;
</pre>
<p>As you can see we created 2 buttons and 2 labels. When I click on the first button the About view will open, and when I click on the second button the Sending view will open, but we don't have any other view yet,than the HelloWorldHomeView.mxml. So now let's make the other 2 views: Click FIle-&gt;New&gt; MXML Component and name it About; make the same thing for Sending view.</p>
<h4><strong>Step 2</strong></h4>
<p>Now open the About view and put this code inside:</p>
<pre class="brush: as3; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:View xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
		xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot; title=&quot;About&quot;&gt;
	&lt;fx:Declarations&gt;
		&lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
	&lt;/fx:Declarations&gt;
	&lt;s:VGroup width=&quot;100%&quot; height=&quot;100%&quot; verticalAlign=&quot;middle&quot; horizontalAlign=&quot;center&quot;&gt;
		&lt;s:Label text=&quot;My name is Horia Condrea!&quot;/&gt;
		&lt;s:Button label=&quot;Back&quot; click=&quot;navigator.popView()&quot; styleName=&quot;back&quot;/&gt;
	&lt;/s:VGroup&gt;
&lt;/s:View&gt;
</pre>
<h4><strong>Step 3</strong></h4>
<p>Open the Sending.mxml and copy this code:</p>
<pre class="brush: as3; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:View xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
		xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot; title=&quot;Sending&quot;&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			protected function button1_clickHandler(event:MouseEvent):void
			{

				// TODO Auto-generated method stub
				alert.alpha = 1;
				alert.enabled = false;
				if(txt.text == &quot;&quot;)
				{
					alert.text = &quot;Please give me your name&quot;;
				}
				else
				{
					alert.text = &quot;Thanks for sending me you name &quot; + txt.text;
				}

			}
		]]&gt;
	&lt;/fx:Script&gt;

	&lt;fx:Declarations&gt;
		&lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
	&lt;/fx:Declarations&gt;
	&lt;s:VGroup width=&quot;100%&quot; height=&quot;100%&quot; verticalAlign=&quot;middle&quot; horizontalAlign=&quot;center&quot;&gt;
		&lt;s:TextInput id=&quot;txt&quot; mouseFocusEnabled=&quot;true&quot;/&gt;
		&lt;s:Button label=&quot;Send!&quot; click=&quot;button1_clickHandler(event)&quot;/&gt;
		&lt;s:TextArea id=&quot;alert&quot; alpha=&quot;0&quot; selectable=&quot;false&quot; mouseEnabled=&quot;false&quot; /&gt;
		&lt;s:Button label=&quot;Back&quot; click=&quot;navigator.popView()&quot; styleName=&quot;back&quot;/&gt;
	&lt;/s:VGroup&gt;
&lt;/s:View&gt;
</pre>
<p>if you test the application you will see this:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_First%20Android%20_controller_1119183981"
			class="flashmovie"
			width="620"
			height="480">
	<param name="movie" value="http://www.horiacondrea.com/wp-content/uploads/article/First%20Android/First%20Android%20_controller.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.horiacondrea.com/wp-content/uploads/article/First%20Android/First%20Android%20_controller.swf"
			name="fm_First%20Android%20_controller_1119183981"
			width="620"
			height="480">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
Download:<a class="downloadlink" href="http://horiacondrea.com/wp-content/plugins/download-monitor/download.php?id=1" title=" downloaded 37 times" >Develop Your First Flex Android Application (37)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/02/25/develop-your-first-flex-android-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: How to read an array in C</title>
		<link>http://horiacondrea.com/2012/02/22/quick-tip-how-to-read-an-array-in-c/</link>
		<comments>http://horiacondrea.com/2012/02/22/quick-tip-how-to-read-an-array-in-c/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 20:01:45 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[progamming]]></category>
		<category><![CDATA[read]]></category>
		<category><![CDATA[scanf]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=151</guid>
		<description><![CDATA[Because this is something that you should really know. And because I did not tell you this in my previous tutorials, I made this quick tip to show you how to read an array in C.]]></description>
			<content:encoded><![CDATA[<p>Because this is something that you should really know. And because I did not tell you this in my previous tutorials, I made this quick tip to show you how to read an array in C. </p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
	int a[10],i;

	for(i = 0; i &lt; 10; i++)
	{
		printf(&quot;a[%d]:&quot;,i);
		scanf(&quot;%d&quot;,&amp;a[i]);
	}

	for(i = 0; i &lt; 10; i++)
	{
		printf(&quot;a[%d]: %d&quot;,i,a[i]);
	}
	getchar();

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/02/22/quick-tip-how-to-read-an-array-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with C [3]</title>
		<link>http://horiacondrea.com/2012/02/20/getting-started-with-c-3/</link>
		<comments>http://horiacondrea.com/2012/02/20/getting-started-with-c-3/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 15:03:06 +0000</pubDate>
		<dc:creator>Horia Condrea</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[do]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[loops]]></category>
		<category><![CDATA[programmin]]></category>
		<category><![CDATA[while]]></category>

		<guid isPermaLink="false">http://horiacondrea.com/?p=131</guid>
		<description><![CDATA[In this part I will talk about arrays, control structures, iteration structures (loops) Arrays An array is a series of elements of the same type placed in contiguous memory locations. An array declaration looks like that: type name [elements];. For example if you want an array with 8 elements: int array[8] Number 1 In this [...]]]></description>
			<content:encoded><![CDATA[<p>In this part I will talk about <strong>arrays, control structures, iteration structures (loops)</strong></p>
<h4><em>Arrays</em></h4>
<p>An array is a series of elements of the same type placed in contiguous memory locations. An array declaration looks like that: <em>type name [elements];</em>. For example if you want an array with 8 elements: <em>int array[8]</em> </p>
<h4><em>Number 1</em></h4>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
	char a[15] = &quot;test&quot;;
	int b[4] = {1,2,3,4};
	double c[2]= {1.23,6.89};

	printf(&quot;%s&quot;,a);
	printf(&quot;   &quot;);
	printf(&quot;%d&quot;,b[0]);
	printf(&quot;%d&quot;,b[1]);
	printf(&quot;%d&quot;,b[2]);
	printf(&quot;%d&quot;,b[3]);
	printf(&quot;   &quot;);
	printf(&quot;%.2lf&quot;,c[0]);
	printf(&quot;   &quot;);
	printf(&quot;%.2lf&quot;,c[1]);
	printf(&quot;   &quot;);
	printf(&quot;%d + %d = %d&quot;,b[0],b[2],b[0] + b[2]);
	printf(&quot;   &quot;);
	printf(&quot;%.2lf * %.2lf = %lf&quot;,c[0],c[1],c[0] * c[1]); 

	getchar();
}
</pre>
<p>In this example you can see how an array looks, and  what you can do with them.</p>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number5.jpg" alt="" /></p></blockquote>
<h4><em>Conditional structure: if and else</em></h4>
<p>The if keyword is used to execute a statement only if a condition is fulfilled: <em>if (condition) statement</em>. This is very easy and I think it will not be any problem in understanding this.</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
	int a,b = 0;;

	printf(&quot;a:&quot;);
	scanf(&quot;%d&quot;,&amp;a);

	if(a &gt; 0)
		b = 10;
	else
		b = 100;

	printf(&quot;%d&quot;,b);

	getchar();

}
</pre>
<p>As you can see if a = 1 or 100,50 or any kind of positive number b = 10, if not b = 100;</p>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number6.jpg" alt="" /></p></blockquote>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number7.jpg" alt="" /></p></blockquote>
<p>This is a more complex example:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
	int a,b,c = 0;
	printf(&quot;a:&quot;);
	scanf(&quot;%d&quot;,&amp;a);

	printf(&quot;b:&quot;);
	scanf(&quot;%d&quot;,&amp;b);

	if(a &gt; 0 &amp;&amp; b &gt; 0)
	{
		c = 10;
	}
	else if(a &lt; 0 &amp;&amp; b &lt; 0)
	{
		c = 100;
	}
	else
	{
		c = 0;
	}

	printf(&quot;c:%d&quot;,c);

	getchar();

}
</pre>
<p>If a > 0 and b > 0:</p>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number8.jpg" alt="" /></p></blockquote>
<p>If a < 0 nad b < 0:</p>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number9.jpg" alt="" /></p></blockquote>
<p>Else:</p>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number10.jpg" alt="" /></p></blockquote>
<h4><em>The while loop</em></h4>
<p>Loops have as purpose to repeat a statement a certain number of times or while a condition is fulfilled.<br />
The while loop looks like that: <em>while (expression) statement</em></p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
	int a = 0;

	while(a &lt; 10)
	{
		printf(&quot;%d&quot;,a);
		a++;
	}

	getchar();

}
</pre>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number11.jpg" alt="" /></p></blockquote>
<h4><em>The do-while loop</em>h</h4>
<p>Its format is: <em>do statement while (condition);</em></p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
	int a = 0;

	do
	{

		printf(&quot;%d&quot;,a);
		a++;
	}while(a &lt; 10);

	getchar();

}
</pre>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number11.jpg" alt="" /></p></blockquote>
<p>As you can see the result is the same. The do-while loop is usually used when the condition that has to determine the end of the loop is determined within the loop statement itself.</p>
<h4><em>The for loop</em></h4>
<p>Its format is:<em> for (initialization; condition; increase) statement;</em></p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;

int main()
{
	int a = 10, i;

	for(i = 0; i &lt; a; i++)
	{
		printf(&quot;%d&quot;,i);
	}

	getchar();
}
</pre>
<blockquote><p><img src="http://www.horiacondrea.com/wp-content/uploads/article/Getting%20started%20with%20C%20%5B2%5D/number11.jpg" alt="" /></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://horiacondrea.com/2012/02/20/getting-started-with-c-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

