<?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>developerwall.com</title>
	<atom:link href="http://developerwall.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://developerwall.com</link>
	<description>code, design and gossip</description>
	<lastBuildDate>Mon, 29 Jun 2009 16:06:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Introduction to the Alert Control in Flex</title>
		<link>http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/</link>
		<comments>http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 15:54:13 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=360</guid>
		<description><![CDATA[This article gives an introduction to the Alert Control in Flex. You can get to know here how to pass a message or a title or even an icon to the Alert Control that you want to display when the user interacts with your application.


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/' rel='bookmark' title='Permanent Link: Examples on Registering Events in Flex'>Examples on Registering Events in Flex</a> <small>We can register Event Handlers and Listeners in more than...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/' rel='bookmark' title='Permanent Link: Events in Flex'>Events in Flex</a> <small>What are Events and Listeners? Events are what make an...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/the-flex-builder-ide-for-beginners/' rel='bookmark' title='Permanent Link: The Flex Builder IDE for beginners'>The Flex Builder IDE for beginners</a> <small>The Flex software is built on the widely used Eclipse...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>We will now move on to the next topic &#8211; <strong>Alert box</strong> in Flex.</p>
<p>Please note that I have used the words Control, Box and Dialog interchangeably and therefore do not mean otherwise until and unless specified.</p>
<p>We are aware of the Alerts in JavaScript &#8211; which looks like in the image below<br />
<div id="attachment_361" class="wp-caption alignleft" style="width: 419px"><img src="http://developerwall.com/wp-content/uploads/2009/06/js-alert.jpg" alt="Alert box in JavaScript" title="Alert box in JavaScript" width="409" height="183" class="size-full wp-image-361" /><p class="wp-caption-text">Alert box in JavaScript</p></div></p>
<p>This Alert Box is available in Flex. Just like any other Alert Control in JavaScript, the Alert in Flex is a pop-up dialog box which can contain a message, a title, buttons(Ok/Canel/Yes/No) and an icon. And also, when the Alert dialog pops-up, the rest of the application will be inaccessible and out of focus.<br />
the Alert Dialog can be closed either by pressing the &#8220;Esc&#8221; key or by clicking on a button in the Dialog box.</p>
<p>To use the Alert control, we need to import a class that will define the Alert Box. We need to import <strong>mx.controls.Alert</strong> and then call the <code>show()</code> method to display the Alert Box.</p>
<p>The following is a small example on how a Alert Box looks like in Flex 3:</p>
<div><object width="610" height="200"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/alerts/alert_example.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/alerts/alert_example.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="200"></embed></object></div>
<p>The code for the above example is as follows:</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot;&gt;<br />
&lt;mx:Button label=&quot;Click Here&quot; fontSize=&quot;15&quot; fontFamily=&quot;Arial&quot; click=&quot;showAlert(event)&quot;/&gt;<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br/><br />
import mx.controls.Alert;<br />
public function showAlert(event:Event):void{<br />
Alert.show(&quot;This is an Alert Control!&quot;, &quot;DeveloperWall&quot;);<br />
}<br />
]]&gt;<br/><br />
&lt;/mx:Script&gt;<br/><br />
&lt;/mx:Application&gt;</code></div>
<p>As we can see from the above code, what we have is a button called &#8220;Click Here&#8221; for which we have an event called &#8220;click&#8221;. On clicking the button, the event is passed to a function <strong>showAlert()</strong> which calles the <strong>show()</strong> method from the <strong>Alert class</strong> to display the Alert Dialog Box.</p>
<p>Please go through my previous articles, for a better understanding of <a href="http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/">Registering Events</a>.</p>
<h2>Alert Control Syntax:</h2>
<p>The syntax for the show() method is as follows</p>
<div class="code"><code>Alert.show("message", "title", flags, parent, clickListener, iconClass, defaultButton)</code></div>
<p>Here is a short brief on the parameters of Alert.show():<br />
<strong>message: </strong> We can write here in quotes the message we want to display in the Alert Box.<br />
<strong>title: </strong> We can put here in quotes the title for the Alert Box.<br />
<strong>flags: </strong> We can specify here the buttons we want to be displayed in the Alert Box.<br />
<em>Examples are:</em></p>
<div class="code"><code>mx.controls.Alert.OK (OK button)<br/><br />
mx.controls.Alert.YES (Yes button)<br/><br />
mx.controls.Alert.NO (No button)<br/><br />
mx.controls.Alert.CANCEL (Cancel button)<br />
</code></div>
<p>Each option is a bit value and can be combined with other options by using the pipe &#8216;|&#8217; operator. The default value is mx.controls.Alert.OK.<br />
<strong>parent: </strong> The parent object of the Alert control.<br />
<strong>clickListener: </strong> This specifies the listener for click events from the buttons.<br />
<strong>iconClass: </strong> Specifies an icon to display to the left of the message text in the dialog box.<br />
<strong>defaultButton: </strong> We can set a default button for the Alert Box we create by using one of the valid values for the flags argument. This can help when the user doesn&#8217;t use a mouse to get through the Alert Box, but instead uses the &#8220;Enter&#8221; key on the keyboard. By giving this value, we can set what button is to be considered as default.</p>
<p>Let us now see the above listed values for the <strong>Alert.show()</strong> method in action.</p>
<p>Lets write a program where, say, I want to enter some Text in a <strong>TextInput</strong> and on the click of a button should be able to &#8220;publish&#8221; the text to a <strong>Text</strong> component. When I click on the button, an Alert box will pop-up asking me for a confirmation and the program should be able to publish or cancel the publishing based on what I click on the Alert Box Control.</p>
<p>So, here goes:<br />
<strong>1. The MXML:</strong><br />
First, we will use the necessary components for this program &#8211; the <strong>TextInput</strong>, the <strong>Button</strong> and the <strong>Text</strong> components. I have coded them as follows</p>
<div class="code"><code>&lt;mx:TextInput id=&quot;myText&quot; x=&quot;10&quot; y=&quot;129&quot; click=&quot;myText.text=''&quot;/&gt;<br />
&lt;mx:Text id=&quot;myOutput&quot; x=&quot;310&quot; y=&quot;10&quot; text=&quot;Publish Text Here&quot; width=&quot;280&quot; height=&quot;280&quot; /&gt;<br />
&lt;mx:Button id=&quot;myButton&quot; x=&quot;178&quot; y=&quot;129&quot; label=&quot;Publish Text&quot; click=&quot;myShowAlert(event)&quot;/&gt;</code></div>
<p>I have used the id&#8217;s &#8220;myText&#8221;, &#8220;myOutput&#8221; and &#8220;myButton&#8221; for the TextInput, Text and Button resspectively.<br />
The click event for &#8220;myText&#8221; makes sure that the TextInput area is cleared every time you are ready to input some text.<br />
&#8220;myOuput&#8221; has some text by default, which will be replaced when the user publishes the text.<br />
the Button, &#8220;myButton&#8221; has a click event which calls the myShowAlert() function. Let us move on to see what the myShowAlert() has got.</p>
<p><strong>2. The Script Block:</strong><br />
The code in the script tag is as follows</p>
<div class="code"><code>&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
<br/><br />
import mx.controls.Alert;<br />
import mx.events.CloseEvent;<br />
<br/><br />
[Embed(source=&quot;../assets/wordpress.png&quot;)]<br />
private var someIcon:Class;<br />
<br/><br />
public function myShowAlert(event:Event):void{<br />
Alert.show(&quot;Are you sure you want to Publish the text?&quot;, &quot;Please Confirm&quot;, Alert.YES | Alert.NO | Alert.CANCEL, this, listenToAlert, someIcon, Alert.YES); <br />
}<br />
<br/><br />
public function listenToAlert(someEvent:CloseEvent):void{<br />
if(someEvent.detail==Alert.YES)<br />
{<br />
myOutput.text=myText.text;<br />
}<br />
else if(someEvent.detail==Alert.NO)<br />
{<br />
myOutput.text=&quot;You clicked on NO. Text not publised.&quot;;<br />
}<br />
else if(someEvent.detail==Alert.CANCEL)<br />
{<br />
myOutput.text=&quot;You selected CANCEL. Text not published.&quot;;<br />
}<br />
}<br />
<br/><br />
]]&gt;<br />
&lt;/mx:Script&gt;</code></div>
<p><strong>3. The function which calls the Alert</strong><br />
Let us take a closer look at the myShowAlert() function</p>
<div class="code"><code>public function myShowAlert(event:Event):void{<br />
Alert.show(&quot;Are you sure you want to Publish the text?&quot;, &quot;Please Confirm&quot;, Alert.YES | Alert.NO | Alert.CANCEL, this, listenToAlert, someIcon, Alert.YES); <br />
}</code></div>
<p>An event is passed to the function myShowAlert() when the button &#8220;Publish Text&#8221; is clicked. This function contains the Alert.show() method where the following are its values:</p>
<ul>
<li><strong>Message displayed:</strong> &#8220;<code style="font-size:12px;">&quot;Are you sure you want to Publish the text?&quot;</code>&#8220;</li>
<li><strong>Title:</strong> &#8220;<code style="font-size:12px;">&quot;Please Confirm&quot;</code>&#8220;</li>
<li><strong>Buttons displayed:</strong> &#8220;<code style="font-size:12px;">Alert.YES | Alert.NO | Alert.CANCEL</code>&#8220;</li>
<li><strong>Parent:</strong> &#8220;<code style="font-size:12px;">this</code>&#8220;</li>
<li><strong>Close Event:</strong> &#8220;<code style="font-size:12px;">listenToAlert</code>&#8220;</li>
<li><strong>Icon Displayed:</strong> &#8220;<code style="font-size:12px;">someIcon</code>&#8220;</li>
<li><strong>Default Button:</strong> &#8220;<code style="font-size:12px;">Alert.YES</code>&#8220;</li>
</ul>
<p>The above list of values should be pretty self explanatory.</p>
<p><strong>4. The CloseEvent</strong><br />
Now, we have a close event in the the Alert.show() method for which we have to import the CloseEvent class as &#8220;import mx.events.CloseEvent&#8221;.<br />
The listener &#8220;listenToAlert&#8221; will be invoked when a button is clicked on the Alert Box. The code for &#8220;listenToAlert&#8221; is defined as</p>
<div class="code"><code>public function listenToAlert(someEvent:CloseEvent):void{<br />
if(someEvent.detail==Alert.YES)<br />
{<br />
myOutput.text=myText.text;<br />
}<br />
else if(someEvent.detail==Alert.NO)<br />
{<br />
myOutput.text=&quot;You clicked on NO. Text not publised.&quot;;<br />
}<br />
else if(someEvent.detail==Alert.CANCEL)<br />
{<br />
myOutput.text=&quot;You selected CANCEL. Text not published.&quot;;<br />
}<br />
}</code></div>
<p>As per the above code, &#8220;someEvent&#8221; is the event passed from the Buttons in the Alert Box and &#8220;someEvent.detail&#8221; will give us the Button clicked. Therefore, we can compare to see which Button is clicked and can perform necessary set of actions depending on the Button clicked.</p>
<p><strong>5. The IconClass</strong><br />
We then have the IconClass which is defined as</p>
<div class="code"><code>[Embed(source="../assets/wordpress.png")]<br />
private var someIcon:Class;</code></div>
<p>We have used some DataBinding here. We have used an image (I have taken a random image) which I have binded to the Class variable I have declared. We can now use the variable/class &#8220;someIcon&#8221; to directly refer to the IconClass in the Alert.show() method.</p>
<p><strong>6. The Default Button</strong><br />
Just in case the user doesn&#8217;t use the mouse to click on the Alert Buttons, but instead uses the &#8220;Enter&#8221; key on the keyboard, we can set a default button to be considered. Here we have set it as the &#8216;YES&#8217; button. So, when the Alert pops-up, try pressing the &#8220;Enter&#8221; Key &#8211; the application will take it as a &#8216;YES&#8217;</p>
<p>So, that should be it. The entire application code will look like this</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; width=&quot;600&quot; height=&quot;300&quot;&gt;<br /><br/><br />
&lt;mx:TextInput id=&quot;myText&quot; x=&quot;10&quot; y=&quot;129&quot; click=&quot;myText.text=''&quot;/&gt;<br />
&lt;mx:Text id=&quot;myOutput&quot; x=&quot;310&quot; y=&quot;10&quot; text=&quot;Publish Text Here&quot; width=&quot;280&quot; height=&quot;280&quot; /&gt;<br />
&lt;mx:Button id=&quot;myButton&quot; x=&quot;178&quot; y=&quot;129&quot; label=&quot;Publish Text&quot; click=&quot;myShowAlert(event)&quot;/&gt;<br />
<br/><br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
<br/><br />
import mx.controls.Alert;<br />
import mx.events.CloseEvent;<br />
<br/><br />
[Embed(source=&quot;../assets/wordpress.png&quot;)]<br />
private var someIcon:Class;<br />
<br/><br />
public function myShowAlert(event:Event):void{<br />
Alert.show(&quot;Are you sure you want to Publish the text?&quot;, &quot;Please Confirm&quot;, Alert.YES | Alert.NO | Alert.CANCEL, this, listenToAlert, someIcon, Alert.YES); <br />
}<br />
<br/><br />
public function listenToAlert(someEvent:CloseEvent):void{<br />
if(someEvent.detail==Alert.YES)<br />
{<br />
myOutput.text=myText.text;<br />
}<br />
else if(someEvent.detail==Alert.NO)<br />
{<br />
myOutput.text=&quot;You clicked on NO. Text not publised.&quot;;<br />
}<br />
else if(someEvent.detail==Alert.CANCEL)<br />
{<br />
myOutput.text=&quot;You selected CANCEL. Text not published.&quot;;<br />
}<br />
}<br />
<br/><br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
<br/><br />
&lt;/mx:Application&gt;<br /></code></div>
<p>And the output for the above code is </p>
<div><object width="610" height="300"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/alerts/alert_example2.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/alerts/alert_example2.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="300"></embed></object></div>
<p>Try giving some input and clicking on the button.</p>
<p>Hope you enjoyed this post. Do you have any feedback/questions? Please post it in the comments below.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/' rel='bookmark' title='Permanent Link: Examples on Registering Events in Flex'>Examples on Registering Events in Flex</a> <small>We can register Event Handlers and Listeners in more than...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/' rel='bookmark' title='Permanent Link: Events in Flex'>Events in Flex</a> <small>What are Events and Listeners? Events are what make an...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/the-flex-builder-ide-for-beginners/' rel='bookmark' title='Permanent Link: The Flex Builder IDE for beginners'>The Flex Builder IDE for beginners</a> <small>The Flex software is built on the widely used Eclipse...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Examples on Registering Events in Flex</title>
		<link>http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/</link>
		<comments>http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 19:29:16 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Event Handling in Flex]]></category>
		<category><![CDATA[Event Listeners in Flex]]></category>
		<category><![CDATA[Registering Events in Flex]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=332</guid>
		<description><![CDATA[We can register Event Handlers and Listeners in more than one way. Let us take a look at a few of the methods that can be helpful while writing Events.


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/' rel='bookmark' title='Permanent Link: Events in Flex'>Events in Flex</a> <small>What are Events and Listeners? Events are what make an...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/' rel='bookmark' title='Permanent Link: Introduction to the Alert Control in Flex'>Introduction to the Alert Control in Flex</a> <small>This article gives an introduction to the Alert Control in...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>We have seen in my <a href="http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/">previous post</a> about Event Handlers/Listeners. Let us now take a step ahead and explore the different methods of registering Events in Flex.</p>
<h2>Using inline Event Handler</h2>
<p>In the below example, the event is written directly to the Button component which when clicked calls the &#8220;myEvent&#8221; function</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot;&gt;<br />
<br />
&lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot; click=&quot;myEvent(event)&quot;/&gt;<br />
&lt;mx:Label id=&quot;myLabel&quot;/&gt;<br />
<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
<br />
public function myEvent(event:Event):void{<br />
myLabel.text=&quot;You Clicked on the Button.&quot;<br />
}<br />
<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
<br />
&lt;/mx:Application&gt;</code></div>
<p>The output is as follows:</p>
<div><object width="610" height="200"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/events/example_1.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/events/example_1.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="200"></embed></object></div>
<div style="width:100%; padding-top:15px;"> </div>
<h2>Using the addEventListener() method</h2>
<p>Using this method provides more flexibility and allows us to register multiple components to the same event. Using this method also enables us to use removeEventListener() method</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot; creationComplete=&quot;startApp()&quot;&gt;<br />
<br />
&lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot;/&gt;<br />
&lt;mx:Label id=&quot;myLabel&quot;/&gt;<br />
<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
<br />
public function startApp():void{<br />
myButton.addEventListener(MouseEvent.CLICK, myEvent);<br />
}<br />
public function myEvent(event:Event):void{<br />
myLabel.text=&quot;You Clicked on the Button.&quot;<br />
}<br />
<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
<br />
&lt;/mx:Application&gt;</code></div>
<p>The output is the same again:</p>
<div><object width="610" height="200"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/events/example_2.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/events/example_2.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="200"></embed></object></div>
<div style="width:100%; padding-top:15px;"> </div>
<h2>Using inline Event Listeners</h2>
<p>We can also add the Event Listener to the same button component which fires the Event.</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot;&gt;<br />
<br />
&lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot; click=&quot;myLabel.text='You Clicked on the Button.'&quot;/&gt;<br />
&lt;mx:Label id=&quot;myLabel&quot;/&gt;<br />
<br />
&lt;/mx:Application&gt;</code></div>
<p>Output, of course will be the same:</p>
<div><object width="610" height="200"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/events/example_3.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/events/example_3.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="200"></embed></object></div>
<div style="width:100%; padding-top:15px;"> </div>
<h2>Using specific Event type</h2>
<p>The following example passes the Event as type MouseEvent. It is a best practice to include a specific Event type.</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
      &lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot;&gt;<br />
<br />
&lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot; click=&quot;myEvent(event)&quot;/&gt;<br />
&lt;mx:Label id=&quot;myLabel&quot;/&gt;<br />
<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
<br />
public function myEvent(event:MouseEvent):void{<br />
myLabel.text=&quot;You Clicked on the Button.&quot;<br />
}<br />
<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
<br />
&lt;/mx:Application&gt;</code></div>
<p>Output:</p>
<div><object width="610" height="200"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/events/example_4.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/events/example_4.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="200"></embed></object></div>
<div style="width:100%; padding-top:15px;"> </div>
<h2>Using addEventListener() inline</h2>
<p>Having discussed all the above so far, this must be pretty obvious. We can include the addEventListener method inline to the Button component. However, we will be using the &#8220;initialize&#8221; property of the Button rather than the &#8220;click&#8221; property.</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot;&gt;<br />
<br />
&lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot; initialize=&quot;myButton.addEventListener(MouseEvent.CLICK, myEvent);&quot;/&gt;<br />
&lt;mx:Label id=&quot;myLabel&quot;/&gt; <br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
<br />
public function myEvent(event:Event):void{<br />
myLabel.text=&quot;You Clicked on the Button.&quot;<br />
}<br />
<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
<br />
&lt;/mx:Application&gt;</code></div>
<p>and the output, is the usual:</p>
<div><object width="610" height="200"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/events/example_5.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/events/example_5.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="200"></embed></object></div>
<div style="width:100%; padding-top:15px;"> </div>
<p>I hope that was informative. Please share your thoughts through the comments below.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/' rel='bookmark' title='Permanent Link: Events in Flex'>Events in Flex</a> <small>What are Events and Listeners? Events are what make an...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/' rel='bookmark' title='Permanent Link: Introduction to the Alert Control in Flex'>Introduction to the Alert Control in Flex</a> <small>This article gives an introduction to the Alert Control in...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Events in Flex</title>
		<link>http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/</link>
		<comments>http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 06:29:56 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[bubbling phase in flex]]></category>
		<category><![CDATA[capturing phase in flex]]></category>
		<category><![CDATA[Event handlers in flex]]></category>
		<category><![CDATA[events in flex]]></category>
		<category><![CDATA[flex events]]></category>
		<category><![CDATA[Flex for beginners]]></category>
		<category><![CDATA[listeners in flex]]></category>
		<category><![CDATA[targeting phase in flex]]></category>
		<category><![CDATA[three different phases in event flow]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=311</guid>
		<description><![CDATA[What are Events and Listeners?
Events are what make an application work. Actually, without Events, we cannot make an application. An Event can be described as anything from a mouse click to a return of a web service call. 
Any user interaction with the application can be treated as an Event. It can be a mouse [...]


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/' rel='bookmark' title='Permanent Link: Examples on Registering Events in Flex'>Examples on Registering Events in Flex</a> <small>We can register Event Handlers and Listeners in more than...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/' rel='bookmark' title='Permanent Link: Introduction to the Alert Control in Flex'>Introduction to the Alert Control in Flex</a> <small>This article gives an introduction to the Alert Control in...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<h2>What are Events and Listeners?</h2>
<p>Events are what make an application work. Actually, without Events, we cannot make an application. An Event can be described as anything from a mouse click to a return of a web service call. </p>
<p>Any user interaction with the application can be treated as an Event. It can be a mouse click or a keyboard button press, a change in a component, or when the data completes loading or even when an application is created. So, when an event is <em>fired</em> or <em>dispatched</em>, there has to be something to pick up the call &#8211; this is what we call a <strong>Listener</strong>. A Listener is just a method or a function which we write to receive an Event <em>fired</em> due to any user interaction.</p>
<p>Let us look at a small example of how an Event is fired and is taken up by an Event Listener or Event Handler. Try clicking on the button &#8220;Click Here&#8221; in the below application</p>
<div><object width="610" height="200"><param name="movie" value="http://developerwall.com/wp-content/uploads/2009/06/registering_events.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://developerwall.com/wp-content/uploads/2009/06/registering_events.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="200"></embed></object></div>
<p>The code for the above application is as follows:</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot;&gt;<br />
  &lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot; click=&quot;mySampleEvent(event)&quot; fontFamily=&quot;Arial&quot; fontSize=&quot;18&quot;/&gt;<br />
  &lt;mx:Label fontSize=&quot;18&quot; fontFamily=&quot;Arial&quot; id=&quot;sampleLabel&quot;/&gt;<br />
  &lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
public function mySampleEvent(event:Event):void{<br />
sampleLabel.text=&quot;You clicked on the button&quot;;<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
&lt;/mx:Application&gt;<br /></code></div>
<p>Observe the code writtent for the Button component. The button is waiting for a &#8216;click&#8217; event which when occurs is passed on to an event handler that updates the Label component with the text &#8220;You clicked on the button&#8221;. It is important to include the &#8216;event&#8217; keyword so that Flex passes it explicitly to the Event Handler or Event Listener.</p>
<p>What I have shown above is just a basic example of a simple Event. There are several Events that a button can have. To look at the complete list of Events, go the design mode in Flex Builder, click on the Button and in the &#8216;Flex Properties&#8217;, click on Category View as shown in the image below. This will display a complete list of available Events for a particular component</p>
<div id="attachment_323" class="wp-caption alignleft" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/06/events-in-flex.jpg" alt="Events in Flex" title="Events in Flex" width="610" height="698" class="size-full wp-image-323" /><p class="wp-caption-text">Events in Flex</p></div>
<p>Observe that there is already a value for the &#8216;click&#8217; event as I have written a Event handler for it.</p>
<p>We can also get the list of Events available in the Source Mode. In the Source Mode, just hit space after typing in <em><strong>&lt;mx:Button</strong></em> and we will get a auto completion box. The attributes with the gold colored symbol on the left are the Events for the Button Component.</p>
<h2>Event flow in Flex</h2>
<p>The Event flow in Flex comprises of 3 parts:</p>
<ol>
<li>Capturing Phase</li>
<li>Targeting Phase</li>
<li>Bubbling Phase</li>
</ol>
<h3>1. Capturing Phase</h3>
<p>In this phase, the Flash Player searches every node from the root node to the target node for any listeners and it stops when it finds one.</p>
<h3>2. Targeting Phase</h3>
<p>The Flash Player sets appropriate values to the target node and checks the target node for any listeners registered.</p>
<h3>3. Bubbling Phase</h3>
<p>In the third phase, the Flash Player searches for any Listeners starting from the target node to the root node and stops when it find listeners on the root node.</p>
<h2>Different methods of Registering Events</h2>
<p>There are two ways we can register Event Handlers in Flex. The first method is to include inline Handlers as in the example we discussed above. The second is to use the addEventListener() method.</p>
<h4>Using inline Event handlers:</h4>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot;&gt;<br />
  &lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot; click=&quot;mySampleEvent(event)&quot; fontFamily=&quot;Arial&quot; fontSize=&quot;18&quot;/&gt;<br />
  &lt;mx:Label fontSize=&quot;18&quot; fontFamily=&quot;Arial&quot; id=&quot;sampleLabel&quot;/&gt;<br />
  &lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
public function mySampleEvent(event:Event):void{<br />
sampleLabel.text=&quot;You clicked on the button&quot;;<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
&lt;/mx:Application&gt;<br /></code></div>
<h4>Using the addEventListener() method:</h4>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
      &lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; width=&quot;610&quot; height=&quot;200&quot; creationComplete=&quot;startApplication()&quot;&gt;<br />
  &lt;mx:Button id=&quot;myButton&quot; label=&quot;Click Here&quot; fontFamily=&quot;Arial&quot; fontSize=&quot;18&quot;/&gt;<br />
  &lt;mx:Label fontSize=&quot;18&quot; fontFamily=&quot;Arial&quot; id=&quot;sampleLabel&quot;/&gt;<br />
  &lt;mx:Script&gt;&lt;![CDATA[<br />
      public function startApplication():void {<br />
        myButton.addEventListener(MouseEvent.CLICK, mySampleEvent);<br />
        }<br />
        public function mySampleEvent(event:Event):void {<br />
        sampleLabel.text=&quot;You clicked on the button&quot;;<br />
        }<br />
        ]]&gt;&lt;/mx:Script&gt;<br />
      &lt;/mx:Application&gt;</code></div>
<p>Observe in the second method, where I have used an Event called &#8220;creationComplete&#8221; for the application tag. This Event is fired when the application completes loading in the browser. This calls the function &#8217;startApplication&#8217; that I have defined in the Script area. This function has an &#8220;addEventListener&#8221; method which is waiting for a mouse click written to the Button. So, the &#8220;addEventListener&#8221; is only called when the user clicks on the Button. When a mouseclick Event occurs, the addEventListener method calls the function &#8216;mySampleEvent&#8217; that defines the text to be updated in the Label.</p>
<p>Though this method might seem a bit tedious, this gives developers more flexibility and also, we can register multiple components to the same Handler.</p>
<p>So, that was about Events in short. It would be best to go through the Adobe Livedocs on Flex 3 for a more in-depth knowledge of the Events Propagation and stuff.</p>
<p>If there is any important thing related to Events that you think I should have included in the above post, please let me know through your comments below.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/' rel='bookmark' title='Permanent Link: Examples on Registering Events in Flex'>Examples on Registering Events in Flex</a> <small>We can register Event Handlers and Listeners in more than...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/' rel='bookmark' title='Permanent Link: Introduction to the Alert Control in Flex'>Introduction to the Alert Control in Flex</a> <small>This article gives an introduction to the Alert Control in...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Video Tutorial for ActionScript in Flex</title>
		<link>http://developerwall.com/video-tutorials/video-tutorial-for-actionscript-in-flex/</link>
		<comments>http://developerwall.com/video-tutorials/video-tutorial-for-actionscript-in-flex/#comments</comments>
		<pubDate>Tue, 19 May 2009 13:40:48 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Flex Videos]]></category>
		<category><![CDATA[Video Tutorials]]></category>
		<category><![CDATA[ActionScripting in Flex Video]]></category>
		<category><![CDATA[Video Tutorial on External ActionScripting]]></category>
		<category><![CDATA[Video Tutorial on Flex]]></category>
		<category><![CDATA[Video Tutorial on how to use the Script Tag]]></category>
		<category><![CDATA[Video tutorials for Inline ActionScripting]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=281</guid>
		<description><![CDATA[Watch and Learn - How to Include ActionScript in a Flex Application and the different methods like Inline ActionScripting, ActionScript in the Script tag and External ActionScript.


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-selectors-properties-and-values-for-beginners/' rel='bookmark' title='Permanent Link: CSS Selectors, Properties and Values for beginners'>CSS Selectors, Properties and Values for beginners</a> <small>This article descibes all about CSS Selectors, Properties and Values....</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I hope my post on <a href="http://developerwall.com/all-tutorial-posts/actionscripting-in-flex/" alt="ActionScript in Flex">ActionScript in Flex</a> was informative. I decided to make a video of it, so you would understand better. </p>
<p><strong><em>Note:</em></strong> I know this ain&#8217;t great quality which is why I am also giving away the higher resolution of the video. You can <a href="http://www.developerwall.com/wp-content/uploads/2009/05/AS_in_Flex.zip" target="_blank" alt="Download how to inclide ActionScript in Flex Video Tutorial">download the &#8216;How to include ActionScript in Flex&#8217; Video Tutorial here</a>. After all, this is my first video tut and I am just getting better <img src='http://developerwall.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.developerwall.com/wp-content/uploads/2009/05/AS_in_Flex.zip" target="_blank" alt="Download High Resolution Video Tutorial of How to include ActionScript in Flex" class="highlight">Download High Resolution Video Here</a></p>
<p><strong>How to include ActionScript in Flex for beginners:</strong></p>
<p><object width="610" height="494"><param name="movie" value="http://www.youtube.com/v/QW7VUcaoOog&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/QW7VUcaoOog&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="610" height="494"></embed></object></p>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-selectors-properties-and-values-for-beginners/' rel='bookmark' title='Permanent Link: CSS Selectors, Properties and Values for beginners'>CSS Selectors, Properties and Values for beginners</a> <small>This article descibes all about CSS Selectors, Properties and Values....</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/video-tutorials/video-tutorial-for-actionscript-in-flex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ActionScripting in Flex</title>
		<link>http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/</link>
		<comments>http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/#comments</comments>
		<pubDate>Sat, 16 May 2009 19:26:11 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript in flex]]></category>
		<category><![CDATA[actionscripting in flex]]></category>
		<category><![CDATA[cdata in flex]]></category>
		<category><![CDATA[external actionscript in flex]]></category>
		<category><![CDATA[flex and actionscript]]></category>
		<category><![CDATA[how to include a actionscript file in flex]]></category>
		<category><![CDATA[inline actionscript]]></category>
		<category><![CDATA[script tag in flex]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=256</guid>
		<description><![CDATA[It is important to know that Flex is not here to replace ActionScript. Moreover, Flex and ActionScript complement each other. Though Flex provides several built in components, we should not forget that these components were actually built in ActionScript. Let us look at how ActionScript can be used in Flex.


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/' rel='bookmark' title='Permanent Link: Introduction to the Alert Control in Flex'>Introduction to the Alert Control in Flex</a> <small>This article gives an introduction to the Alert Control in...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/' rel='bookmark' title='Permanent Link: Events in Flex'>Events in Flex</a> <small>What are Events and Listeners? Events are what make an...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/' rel='bookmark' title='Permanent Link: Examples on Registering Events in Flex'>Examples on Registering Events in Flex</a> <small>We can register Event Handlers and Listeners in more than...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<h2>Flex and ActionScript</h2>
<p>I have mentioned earlier in one of my <a href="http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-for-beginners/" alt="Flex 3 for Beginners">posts</a> that Flex uses ActionScript &#8211; in a big way. Actually the mxml code we see is converted to ActionScript in the back end and the final output is given to us as a SWF file.</p>
<p>I have heard several developers say that Flex is here to replace ActionScript. Well, they are wrong &#8211; Flex will <strong><em>not</em></strong> replace ActionScript, at least for now. Flex and ActionScript complement each other. While Flex makes it easy for developers by providing several built-in components that can be used with ease, we should not forget that these components are actually built in ActionScript.</p>
<p>Flex builder 3.0 accepts only the latest version, ActionScript 3.0 to be used in a Flex application as it sticks to Object Oriented Programming.</p>
<h2>How to use ActionScript in Flex?</h2>
<p>we can include ActionScript in Flex in more than one way:</p>
<ol>
<li>Inline ActionScript</li>
<li>ActionScript within the Script tag</li>
<li>External ActionScript</li>
</ol>
<h3>1. Inline Scripting</h3>
<p>ActionScript can be placed within an mxml tag. Let us consider a Button which says &#8220;Click Here&#8221; and an empty TextField. The code will be as follows:</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;&gt;<br />
&lt;mx:Button label=&quot;Click Here&quot;/&gt;<br />
&lt;mx:TextInput id=&quot;sampleText&quot;/&gt;<br />
&lt;/mx:Application&gt;</code></div>
<p>Observe that I have given an &#8216;<strong>id</strong>&#8216; to the TextInput component, so I can refer that component using the <strong>id</strong>.</p>
<p>Right Now, the code doesn&#8217;t perform any action. Let us now, include a script for the Button tag which will insert some text into the TextInput. Observe the <strong>Inline ActionScript</strong> below (in red):</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;&gt;<br />
&lt;mx:Button label=&quot;Click Here&quot; <strong style="color:red">click=&quot;sampleText.text='DeveloperWall'&quot;</strong>/&gt;<br />
&lt;mx:TextInput id=&quot;sampleText&quot;/&gt;<br />
&lt;/mx:Application&gt;</code></div>
<p>The above code says &#8211; on <strong>click</strong> of the Button, pass the value of &#8220;DeveloperWall&#8221; to the TextInput with the name &#8220;sampleText&#8221;.</p>
<p>So, when a user clicks on the button, the event of the button click is called and the value is passed to the TextField. the output will be like this:</p>
<div id="attachment_266" class="wp-caption alignleft" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/inline-actionscript-ouput.jpg" alt="Output of Inline ActionScript Example" title="Output of Inline ActionScript Example" width="610" height="108" class="size-full wp-image-266" /><p class="wp-caption-text">Output of Inline ActionScript Example</p></div>
<h3>2. ActionScripting in Flex using the &lt;/mx:Script&gt; tag</h3>
<p>Flex provides another great way of including ActionScript within the code &#8211; using the <strong>&lt;/mx:Script&gt;</strong> tag. The tag will start like any other normal tag in Flex. However, there is some &#8216;CDATA&#8217; stuff that should be included within the <strong>&lt;/mx:Script&gt;</strong> tag. Overall, the Script tag would look like this: </p>
<div class="code"><code>&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
]]&gt;<br />&lt;/mx:Script&gt;</code></div>
<p>The CDATA looks like nerdy stuff to remember, but again Flex Builder is handy to provide code auto-completion. You can simply type <strong>&lt;mx:Script</strong> and when you close the tag with <strong>&gt;</strong>, Flex inserts the rest of the code for you. Simple, ain&#8217;t it?</p>
<p>Anyway, <strong>what is the CDATA for? What does it do?</strong><br />
Flex renders the entire code as XML. So, to tell Flex that the ActionScript is <strong>not</strong> to be rendered as XML, we have to embed the ActionScript within the CDATA code. To put it simple, CDATA tells Flex <strong>not</strong> to render the code within as XML.</p>
<p>Let us now modify the code so that the ActionScript is written in the <strong>&lt;mx:Script&gt;</strong> tag. Observe the code below:</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;&gt;<br />
&lt;mx:Button label=&quot;Click Here&quot; <strong style="color:red">click=&quot;text()&quot;</strong>/&gt;<br />
&lt;mx:TextInput id=&quot;sampleText&quot;/&gt;<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
public function text():void{<br />
sampleText.text='DeveloperWall';<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt; <br />
&lt;/mx:Application&gt;</code></div>
<p>Observe that I have inserted a function for &#8220;<em>click</em>&#8221; in the button tag. This function is called when the button is clicked and is referenced in the &lt;mx:Script&gt; where the function is defined. The keywords &#8220;public&#8221; defines the scope of the function as public and &#8220;void&#8221; is to state that there is no return type for the function. Again, the output is the same as the Inline ActionScript.</p>
<h3>3. External ActionScript Files</h3>
<p>This is best way to include ActionScript code for a Flex application. To import an External ActionScript file, we can either use the <strong>source</strong> attribute for the Script tag or use the <strong>include</strong> directive. Both methods copy the contents of the specified file into your MXML file.</p>
<p>The <strong>source</strong> attribute for the Script tag is written as follows:</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;&gt;<br />
&lt;mx:Button label=&quot;Click Here&quot; click=&quot;text()&quot;/&gt;<br />
&lt;mx:TextInput id=&quot;sampleText&quot;/&gt;<br />
&lt;mx:Script source=&quot;actionscript/sample.as&quot;/&gt;<br />
&lt;/mx:Application&gt;<br />
</code></div>
<p>Using the above method makes the MXML files less cluttered and also promotes code reuse across different applications.</p>
<p>The <strong>include</strong> directive syntax is as follows:</p>
<div class="code"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;&gt;<br />
&lt;mx:Button label=&quot;Click Here&quot; click=&quot;text()&quot;/&gt;<br />
&lt;mx:TextInput id=&quot;sampleText&quot;/&gt;<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
include &quot;actionscript/sample.as&quot;;<br />
]]&gt;<br />
&lt;/mx:Script&gt; <br />
&lt;/mx:Application&gt;<br />
</code></div>
<p>The above two methods tell Flex to collect the contents of the <em>sample.as</em> file, which is in the folder &#8216;actionscript&#8217; to the current mxml file.</p>
<p><em>As an instance, I have created a AS file &#8211; sample.as (we can create AS files in Flex) and have placed it in a folder called &#8216;actionscript&#8217; within the &#8217;src&#8217; folder.</em></p>
<p>The folder structure I have given is as follows:</p>
<div id="attachment_276" class="wp-caption alignleft" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/external_actionscript_folde.jpg" alt="External ActionScript Folder Structure" title="External ActionScript Folder Structure" width="610" height="345" class="size-full wp-image-276" /><p class="wp-caption-text">External ActionScript Folder Structure</p></div>
<p>Once we run the application, we get the same output.</p>
<div id="attachment_266" class="wp-caption alignleft" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/inline-actionscript-ouput.jpg" alt="Output of External ActionScript Example" title="Output of External ActionScript Example" width="610" height="108" class="size-full wp-image-266" /><p class="wp-caption-text">Output of External ActionScript Example</p></div>
<p>I hope the above information was helpful. Please let me know your feedback by posting your comments below.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/introduction-to-the-alert-control-in-flex/' rel='bookmark' title='Permanent Link: Introduction to the Alert Control in Flex'>Introduction to the Alert Control in Flex</a> <small>This article gives an introduction to the Alert Control in...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/events-in-flex/' rel='bookmark' title='Permanent Link: Events in Flex'>Events in Flex</a> <small>What are Events and Listeners? Events are what make an...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/examples-on-event-handlers-in-flex/' rel='bookmark' title='Permanent Link: Examples on Registering Events in Flex'>Examples on Registering Events in Flex</a> <small>We can register Event Handlers and Listeners in more than...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CSS Selectors, Properties and Values for beginners</title>
		<link>http://developerwall.com/all-tutorial-posts/css-selectors-properties-and-values-for-beginners/</link>
		<comments>http://developerwall.com/all-tutorial-posts/css-selectors-properties-and-values-for-beginners/#comments</comments>
		<pubDate>Mon, 11 May 2009 17:24:15 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS selectors]]></category>
		<category><![CDATA[properties and values for beginners]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=231</guid>
		<description><![CDATA[This article descibes all about CSS Selectors, Properties and Values. Also listed and described are the different types of Selectors.


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners-part-2/' rel='bookmark' title='Permanent Link: CSS for Beginners part 2'>CSS for Beginners part 2</a> <small>This second installment of CSS for Beginners will give you...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners/' rel='bookmark' title='Permanent Link: CSS for Beginners'>CSS for Beginners</a> <small>Ever wondered what is behind a beautifully designed website? The...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/the-flex-builder-ide-for-beginners/' rel='bookmark' title='Permanent Link: The Flex Builder IDE for beginners'>The Flex Builder IDE for beginners</a> <small>The Flex software is built on the widely used Eclipse...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Having seen the different levels of CSS, where the styles can be written and stuff, in my <a href="http://developerwall.com/all-tutorial-posts/css-for-beginners-part-2/" alt="CSS for Beginners">previous post</a>, let us now look at the <strong>CSS syntax</strong>, <strong>CSS selectors</strong>, <strong>CSS rules</strong>, <strong>CSS properties and values</strong>, <strong>CSS declarations</strong> and other important technical jargon related to styles.</p>
<h2>What is a Rule in CSS?</h2>
<p>A Rule in CSS comprises of a selector, properties and values that define an HTML element as in the example below</p>
<div class="code"><code>p {<br />
 color: red;<br />
}</code></div>
<h2>CSS Selector, Property and Value</h2>
<p>The above rule is made up of 3 parts &#8211; Selector, Property and Value.<br />
<strong>p</strong> in the above code is the selector. The Property in the above code is <strong>color</strong> and the Value of the Property is <strong>red</strong>. The colon(:) is used to define the value for the property. And the semicolon(;) at the end of the value is to denote that the Property declaration has ended and that a new property can now be included for the same Selector.</p>
<p>The above code can be also written as </p>
<div class="code"><code>p { color: red; }</code></div>
<p>However, it would be best if we define each Property in one line.</p>
<h2>Syntax and Declaration</h2>
<p>This is the general syntax of a CSS statement when defining a rule. The code within the curly braces is called the CSS Declaration of a selector.</p>
<div class="code"><code>selector {<br />
property: value;<br />
}</code></div>
<p>We can include more than one property declaration for the same selector as in the example below:</p>
<div class="code"><code>p {<br />
color: red;<br />
font-size: 14px;<br />
font-weight: bold;<br />
}</code></div>
<p>The above style has 3 property declarations. The rule is to make any paragraph (the <strong>&lt;p&gt;</strong> tag &#8211; as the selector) to appear red in color, with a size of 14px and bolded. The output would be as follows (assuming &#8220;Lorem Ipsum&#8221; as the dummy text withing the <strong>&lt;p&gt;</strong> tag in HTML</p>
<div class="output"><code style="color: red; font-size: 14px; font-weight:bold;">Lorem Ipsum</code></div>
<h2>Types of Selectors</h2>
<p>The following are the different types of selectors in CSS</p>
<ol>
<li>Basic Selectors</li>
<li>Class Selectors</li>
<li>ID Selectors</li>
<li>Pseudo Selectors</li>
<li>Descendant Selectors</li>
</ol>
<h3>Basic Selectors</h3>
<p>Styles written to a HTML element with the element itself as a Selector is called Basic Selector. In the example below, <strong>h1</strong> is an HTML element which is used to display headings.</p>
<div class="code"><code>h1 {<br />
color: green;<br />
}</code></div>
<h3>Class Selectors</h3>
<p>These selectors do not correspond to any HTML tag and when written always start with a &#8216;<strong>.</strong>&#8216; (dot). These selectors can be given any name, preferrable something relevant. And this name is used in the HTML by using the &#8220;<em>class</em>&#8221; attribute.</p>
<div class="code"><code>.redtext {<br />
color: red;<br />
font-size: 10px;<br />
}</code></div>
<h3>ID Selectors (Identifiers)</h3>
<p>These Selectors are similar to the Class Selectors. However, instead of a &#8216;<strong>.</strong>&#8216;, the symbol &#8216;<strong>#</strong>&#8216; (hash) is used to denote an ID selector. Also, another major difference between a Class Selector and and ID Selector is that, Class Selectors can be used multiple number of times within the same page. But an ID Selector can only be used once in a page.</p>
<div class="code"><code>#red {<br />
color: red;<br />
font-size: 10px;<br />
}</code></div>
<h3>Pseudo Selectors</h3>
<p>These selectors help in defining the characteristics of an element. Mostly used with the link selector, it is defined as follows:</p>
<div class="code"><code>a:link {<br />
color: red;<br />
}<br />
a:hover {<br />
color: black;<br />
}<br />
a:active {<br />
color: green;<br />
}<br />
a:visited {<br />
color: blue;<br />
}</code></div>
<p>Applying the above style will format all links in a HTML page. It will originally display the link in red color. On hover with the cursor, the color of the link will change to black. On Click, it will change to green and when the link is visited, it will change to blue. You can test the above code <strong><a href="http://developerwall.com/wp-content/uploads/2009/05/CSS_Selectors.html">here</a></strong>.</p>
<h3>Descendant Selectors</h3>
<p>Selectors defined based upon their HTML tree appearance are called Descendant Selectors. The below example explains a Descendant Selector. It says that for every <strong>h3</strong> tag appearing in a table, change its color to red and make it bold.</p>
<div class="code"><code>table h3 {<br />
color: red;<br />
font-weight: bold;<br />
}</code></div>
<p>I hope the above was informative. Please let me know your feedback/comments.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners-part-2/' rel='bookmark' title='Permanent Link: CSS for Beginners part 2'>CSS for Beginners part 2</a> <small>This second installment of CSS for Beginners will give you...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners/' rel='bookmark' title='Permanent Link: CSS for Beginners'>CSS for Beginners</a> <small>Ever wondered what is behind a beautifully designed website? The...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/the-flex-builder-ide-for-beginners/' rel='bookmark' title='Permanent Link: The Flex Builder IDE for beginners'>The Flex Builder IDE for beginners</a> <small>The Flex software is built on the widely used Eclipse...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/all-tutorial-posts/css-selectors-properties-and-values-for-beginners/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Flex Builder IDE for beginners</title>
		<link>http://developerwall.com/all-tutorial-posts/the-flex-builder-ide-for-beginners/</link>
		<comments>http://developerwall.com/all-tutorial-posts/the-flex-builder-ide-for-beginners/#comments</comments>
		<pubDate>Mon, 11 May 2009 07:46:05 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Adobe Flex 3]]></category>
		<category><![CDATA[Flex Builder IDE]]></category>
		<category><![CDATA[Flex for beginners]]></category>
		<category><![CDATA[RIAs]]></category>
		<category><![CDATA[Rich Internet Applications]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=209</guid>
		<description><![CDATA[The Flex software is built on the widely used Eclipse IDE. The Flex standalone software offers a wide range of advantages for its developers like code-hinting, design mode editing, drag and drop of components etc. Lets take a closer look at the Flex Builder and see what the advantages are...


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-sample-code-in-depth/' rel='bookmark' title='Permanent Link: Flex 3 &#8211; A closer look at the MXML code in the sample application'>Flex 3 &#8211; A closer look at the MXML code in the sample application</a> <small>So far, we have created a sample application, which does...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-beginner-example/' rel='bookmark' title='Permanent Link: Flex 3 &#8211; Beginner example'>Flex 3 &#8211; Beginner example</a> <small>I will now show you a basic &#8220;Hello World&#8221; example...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-for-beginners/' rel='bookmark' title='Permanent Link: Flex 3 for beginners'>Flex 3 for beginners</a> <small>Lets start off with Flex 3, an Adobe product to...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<h1>The Flex 3 IDE</h1>
<p>The sample application in Flex, done/explained in the <a href="http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-beginner-example/">previous posts</a>, was to give you an experience of what is actually done with Flex. We will now take a complete look at the <strong>Flex Builder</strong> itself and see what are the several advantages that we have been provided with to create web/desktop applications.</p>
<p>I am assuming you have Flex installed and have the example from the previous post opened. If not, you can create one quickly.</p>
<p>So, we have coded our sample web application to create two <strong>Panels</strong> with different X and Y values. Great! Now, let&#8217;s take a look at the design mode within the Flex Builder. You can find the Source Mode-Design Mode buttons just above the coding area as shown in the image below:</p>
<div id="attachment_213" class="wp-caption alignnone" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/flex-source-design-modes.jpg" alt="Flex 3 Source/Design Modes" title="Flex 3 Source-Design Modes" width="610" height="115" class="size-full wp-image-213" /><p class="wp-caption-text">Flex 3 Source/Design Modes</p></div>
<p>Click on the &#8220;Design&#8221; button and you will get a preview of what we have coded as it would appear in the final output. Please refer the image below:</p>
<div id="attachment_214" class="wp-caption alignnone" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/flex-design-mode.jpg" alt="Flex 3 Design Mode" title="Flex 3 Design Mode" width="610" height="367" class="size-full wp-image-214" /><p class="wp-caption-text">Flex 3 Design Mode</p></div>
<p>The design mode offers a great advantage by allowing us to manipulate the layout of the application by moving the elements around. Try to drag the Panel within the blue background area, which is our root node-the application tag. When you move the panel around, you can also observe that the X and Y values of the panel are changed automatically in the source mode. Cool, isn&#8217;t it? There is more!</p>
<p>Now, observe the left and right panels of the Flex builder in the design mode. To the left of the design is the <strong>Flex Navigator</strong> and below that is <strong>Components Panel</strong> [Everything in flex Builder is made up of Panels. Just to avoid confusion with the Panel Component, I will call the flex Builder Panels as Sections, going forward]. You can simple drag any component on to the stage of the layout and Flex Builder will automatically adjust the code for the new component. Try playing around with the new components &#8211; select a component, drag it and drop it on the stage. Go back to the source mode and check the code that is added because of the new component. I will concentrate on each component individually in my articles to come. For now, let&#8217;s just look at the Flex Builder.</p>
<p>So, you can drag components and place them wherever you want. Let&#8217;s say you you want to delete the existing two Panels and want to insert a new one.<br/>Select the Panels, one by one as shown in the image below and press &#8220;delete&#8221;.</p>
<div id="attachment_215" class="wp-caption alignnone" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/flex-design-mode-2.jpg" alt="Flex Design Mode Editing" title="Flex Design Mode Editing" width="610" height="441" class="size-full wp-image-215" /><p class="wp-caption-text">Flex Design Mode Editing</p></div>
<p>Now, go to the components section, identify the Panel component and drag it on to the stage to the top-left. When you drag a component, the Flex Builder shows you guidelines which help you in aligning components when you are working with more than one. We now have a new Panel on the stage.</p>
<div id="attachment_223" class="wp-caption alignleft" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/flex-design-mode-editing.jpg" alt="Editing in Flex design mode" title="Editing in Flex design mode" width="610" height="441" class="size-full wp-image-223" /><p class="wp-caption-text">Editing in Flex design mode</p></div>
<p>What if you want to add a Title to the Panel and also you want to create a button in the Panel? You need not go back to the source code and add a &#8220;Title&#8221; attribute. You have something called <strong>Flex Properties</strong> section to your right where you can change the values as needed </p>
<div id="attachment_217" class="wp-caption alignleft" style="width: 268px"><img src="http://developerwall.com/wp-content/uploads/2009/05/flex-properties.jpg" alt="Flex Properties Section" title="Flex Properties Section" width="258" height="667" class="size-full wp-image-217" /><p class="wp-caption-text">Flex Properties Section</p></div>
<p>You can change properties of the Panel(like color,title, height, width, etc) as per requirement. We also have a Layout constraints section within the Flex Properties that helps us to set the position of components in complex layouts, so that the layout remains the undisturbed even the application is re sized.</p>
<p>I will set the &#8216;Title&#8217; in the Flex Properties section to <em>Another example of Panel</em>. And also, I will change the width and height to 450 and 200 respectively. Please refer the image below: </p>
<div id="attachment_221" class="wp-caption alignleft" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/flex-properties-editing.jpg" alt="Editing the Flex Properties section" title="Editing the Flex Properties section" width="610" height="655" class="size-full wp-image-221" /><p class="wp-caption-text">Editing the Flex Properties section</p></div>
<p>The final output in the browser would now look like this</p>
<div id="attachment_226" class="wp-caption alignleft" style="width: 620px"><img src="http://developerwall.com/wp-content/uploads/2009/05/final-ouput.jpg" alt="Final output of the flex application" title="Final output of the flex application" width="610" height="655" class="size-full wp-image-226" /><p class="wp-caption-text">Final output of the flex application</p></div>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-sample-code-in-depth/' rel='bookmark' title='Permanent Link: Flex 3 &#8211; A closer look at the MXML code in the sample application'>Flex 3 &#8211; A closer look at the MXML code in the sample application</a> <small>So far, we have created a sample application, which does...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-beginner-example/' rel='bookmark' title='Permanent Link: Flex 3 &#8211; Beginner example'>Flex 3 &#8211; Beginner example</a> <small>I will now show you a basic &#8220;Hello World&#8221; example...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/flex-3-for-beginners/' rel='bookmark' title='Permanent Link: Flex 3 for beginners'>Flex 3 for beginners</a> <small>Lets start off with Flex 3, an Adobe product to...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/all-tutorial-posts/the-flex-builder-ide-for-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search Engine Optimization</title>
		<link>http://developerwall.com/gossip/search-engine-optimization/</link>
		<comments>http://developerwall.com/gossip/search-engine-optimization/#comments</comments>
		<pubDate>Sun, 03 May 2009 10:16:42 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Gossip]]></category>
		<category><![CDATA[advantages of SEO]]></category>
		<category><![CDATA[how to increase a page rank]]></category>
		<category><![CDATA[introduction to seo]]></category>
		<category><![CDATA[keywords]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[meta data]]></category>
		<category><![CDATA[promote your blog]]></category>
		<category><![CDATA[search engine optimization]]></category>
		<category><![CDATA[search engines]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[seo tools]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=175</guid>
		<description><![CDATA[Introduction to SEO
Search Engine Optimization or SEO is the technique of increasing web traffic to a website from search engines. It is also the process of promoting a site to the top results in a search engine for specific keywords.
Advantages of SEO
As mentioned, SEO is a technique to increase web traffic to a particular website. [...]


Related posts:<ol><li><a href='http://developerwall.com/gossip/blogging/' rel='bookmark' title='Permanent Link: Blogging'>Blogging</a> <small>Blogs are fast catching up. There were days when the...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners/' rel='bookmark' title='Permanent Link: CSS for Beginners'>CSS for Beginners</a> <small>Ever wondered what is behind a beautifully designed website? The...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<h2>Introduction to SEO</h2>
<p>Search Engine Optimization or SEO is the technique of increasing web traffic to a website from search engines. It is also the process of promoting a site to the top results in a search engine for specific keywords.</p>
<h2>Advantages of SEO</h2>
<p>As mentioned, SEO is a technique to increase web traffic to a particular website. So, if a website is so popular on the search engines, then users are automatically driven to that website. This will obviously increase demand for that page and advertisers would like to have their ads on that site. And this obviously means money.</p>
<p>Having said that, it doesn&#8217;t really mean that you can&#8217;t do anything about it. You have to make sure that you put in all the keywords, meta data and stuff in the web page to make sure that it is indexed in the search engine database.</p>
<h2>How to make sure that your page is ranked at the top in all search engines?</h2>
<p>Big question! Let&#8217;s take a loook at what exactly happens with search engines.</p>
<p>Search engines like Google, Yahoo and MSN have their own algorithms to crawl a web page and then index it. When a search term is entered in the search engine by a user, the relevancy of the content is checked from the indexed pages and then the results are shown in order of relevancy. Since the algorithms used by the search engines are different, there is no guarantee that a page ranked 2 in Google has to be ranked 2 in Yahoo, it can be ranked 100 in Yahoo. There is no consistency in the search engines.</p>
<p>I bet you didn&#8217;t understand that. Let&#8217;s take a closer look. </p>
<p>Search engines are not humans. They can&#8217;t think nor can they see a web page the way a human does. All they can do is read the content of a web page. So, content is the first and foremost thing for a search engine.<br />
All search engines have softwares called <em><strong>Spiders</strong></em>, which crawl on a web page and go through the content. After they finish crawling, they <strong><em>index</em></strong> the page in a huge database that also contains the indexing results of other web pages. Now, when a user types a keyword in that particular search engine, it looks up the indexed pages in the database. If there is more than 1 page with the requested search keyword, it calculates the relevancy of the indexed pages against the search term and then displays the results in order of relevancy.</p>
<p>Again, the algorithms used by these search engines differ in logic from one search engine to the other. As a result, in most cases there is no rule that a particular web page has the same page rank in Google, Yahoo and MSN. </p>
<p>Having said that, you have to put in your efforts to make sure that the search engines spiders crawl your page and index it against relevant search words. How do we do that?</p>
<h2>Importance of Keywords, Meta data, and links</h2>
<p>Keywords are something which can keep your web page float in the current situation where we have billions of pages in the web. Keywords are a way to promote your page in search rankings. Let us, for example, say that a person has a website about <em>Food</em>. Given that it is one of the most frequently searched term, the person has to make sure that he includes all kinds of keywords related to the word &#8220;food&#8221; &#8211; like, &#8220;spicy food&#8221;, &#8220;junk food&#8221;, &#8220;fast food&#8221;, &#8220;chinese food&#8221;, &#8220;indian food&#8221; and so on. This will help the spiders to understand the relevancy of the food to your page and will hopefully put it in the top results next time.<br />
One great tool to search relevant keywords and put up in your website is the <a href="https://adwords.google.com/select/KeywordToolExternal">Google Keyword Search</a>.</p>
<p>We then have the Meta Data. Though this is an old technique to increase traffic to a page, this is still considered as a first step towards SEO. There were times when the search engines only used to look up the meta data and rank a page. Times have changed and so have search engine algorithms. Meta data is not the most important things to do these days but doing it will be no harm. So, please make sure that you have meta tags, meta description and meta keywords for your site.</p>
<p><strong>Links</strong> are now growing up to be one of the most important things to superior SEO. One has to make sure that there are no broken links in a website. Also, if possible keywords should be included in the Link itself along with a <em>title</em> tag that gives a description of where the link leads to. Spiders look for links in a web page so, they can search other pages in the website and index them through links. It is important to make sure that all pages in a website can be accessed through something called a &#8220;<strong>Sitemap</strong>&#8220;. A page that would explain the website structure.</p>
<h2>Content in a web page</h2>
<p>Making sure that keywords and links are present alone doesn&#8217;t guarantee you a spot in the top page ranks. The main thing is the Content. Search Engine algorithms, these days, are so mature that they can make out a fake website from the content itself. So, content is very important. Keep the content genuine and updated and the traffic will flow in automatically. Automatically? Will it?</p>
<h2>Promote your website</h2>
<p>Not literally automatic. But there are socail networking sites like Facebook, Digg, Delicious etc., in which you can promote your site. Present the first paragraph of your website in a very interesting way and link it to your webpage in a network like Digg. If people like it, they will visit your website and traffic will automatically flow. This will also ensure a good page rank. However, the content needs to be genuine or, you are bound to land in trouble and your website also might face a possible ban in search engines. </p>
<p>So, please go through SEO carefully and make sure that you do it the most genuine way and you will be rewarded with good page ranks.</p>
<p>Did I miss anything? Please let me know by discussing it in the comments section below.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/gossip/blogging/' rel='bookmark' title='Permanent Link: Blogging'>Blogging</a> <small>Blogs are fast catching up. There were days when the...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners/' rel='bookmark' title='Permanent Link: CSS for Beginners'>CSS for Beginners</a> <small>Ever wondered what is behind a beautifully designed website? The...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/gossip/search-engine-optimization/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Blogging</title>
		<link>http://developerwall.com/gossip/blogging/</link>
		<comments>http://developerwall.com/gossip/blogging/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 18:51:26 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[Gossip]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[Why Blog?]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=179</guid>
		<description><![CDATA[Blogs are fast catching up. There were days when the number of blogs could be easily counted. Well, that is not the situation anymore, with the number of blogs doubling almost every year.
So, what is it about? Why have people moved into blogs and blogging and all that stuff? Is it just the money or [...]


Related posts:<ol><li><a href='http://developerwall.com/gossip/search-engine-optimization/' rel='bookmark' title='Permanent Link: Search Engine Optimization'>Search Engine Optimization</a> <small>Introduction to SEO Search Engine Optimization or SEO is the...</small></li><li><a href='http://developerwall.com/about/' rel='bookmark' title='Permanent Link: About'>About</a> <small>Hi &#8211; I am Kalyan, a web developer and designer...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Blogs are fast catching up. There were days when the number of blogs could be easily counted. Well, that is not the situation anymore, with the number of blogs doubling almost every year.<br />
So, what is it about? Why have people moved into blogs and blogging and all that stuff? Is it just the money or is there more to it?</p>
<p>Four reasons why people <strong>blog</strong> these days</p>
<ol>
<li>Money</li>
<li>Fame</li>
<li>Fun</li>
<li>Others</li>
</ol>
<h2>Money</h2>
<p>Most people believe that they can earn lots of money through blogging. Some people come to know about one successful person who has earned well through their blog and therefore think blogging is an easy way to hit the jackpot. While it is true that blogs can ring in money, it isn&#8217;t completely true or at least, there is no thumb rule which states that <em>any</em> blog can make money.</p>
<p>There are many reasons why a blog can fail. Some of them are as listed below</p>
<ul>
<li><strong>Uniqueness:</strong> Most successful blogs are unique. Yes, a blog needs to be unique to earn big money. Not everyone can start off a blog, and write about their cat and dog and make it big. There are limitations set by readers. And without readers, your blog is no good.</li>
<li><strong>SEO:</strong> The right Search engine optimization techniques should be used to make sure the blog shows up on a good search engine. Any manipulation here can even result in the blog being removed from the search listing permanently. Therefore it is recommended to go through the valid techniques on the web and then optimize the website for search.</li>
<li><strong>Keywords, Tags, Links, Alternate text:</strong> A genuine blog with great content is of no use if the blogger doesn&#8217;t set the right keywords, tags, alternate text for images and link description. Any content in a blog should be accurately described with the tags. Links should be given the correct treatment like given the description in the &#8220;title&#8221; tag and images of course, should be given alternate text to make them optimized. All this comes under SEO, but this is so very important that I decided to write it as a separate point.</li>
<li><strong>Meta Content:</strong> Again, this is similar to the keywords. All websites and blogs must have the meta content as a part of SEO. Agreed that Meta content is getting outdated &#8211; but please note that it is still being considered and is of no harm if it is included.</li>
<li><strong>Domain Name:</strong> The domain name is as important as the content in the blog. One can not name a site &#8220;doglovers&#8221; and then write about all kinds of animals in the blog. It would be best if the domain name is related to the content and not just that a cool name will do the job. Trust me, there are people who just turn away from a site by looking at the domain name. <em>[Ya, I know - I named my blog "developerwall" and am writing about blogs. But hey, you are in the gossip section and moreover, I think every developer is related to blogs.]</em></li>
</ul>
<h2>Fame</h2>
<p>Fame, Celebrity Status, Influence are some of the things that many bloggers aim for. Although this is in a way related to Money, there is more to it. I have come across several people who look at fame as a path to success and money. Well, I won&#8217;t argue much on this as I have seen people becoming famous and then rich and also people who have become rich and then famous. So, lets just say this is one of the main reasons why there are blogs everywhere.</p>
<h2>Fun</h2>
<p>Some people blog for fun. They don&#8217;t expect anything in return nor do they blog seriously. But again, there are a few people who are so much obsessed with the idea of blogging and find it so much fun that they mantain around 3-4 blogs, peronally too. No wonder we see so many blogs around. </p>
<h2>Others</h2>
<p>Interaction, though it sounds like a silly point, can very well be a straight forward point. My colleague at work enjoys working less and interacting more with other people. These people enjoy social attention and just want to be recognized by others hoping it would pay off in the future.<br />
Then there are socially active bloggers who blog for charity with a point of helping the needy. They make money through blogging and then donate the money to an organization or sometimes, they ask people to donate money straight forward. While there are some genuine blogs which do this, there are also blogs which is just cloaking the actual intention. So, a little research before donating will help.</p>
<p>Keeping the above in mind, we now know why there are an increasing number of bloggers.</p>
<p>The trend right now is fast changing. People are quitting jobs to become full time bloggers. This gives them more time to concentrate on their blog and earn more money. And also, if it is fun to do that, would you not quit your job to become a blogger?</p>
<p>What do you think can be additional reasons for increase in blogs and bloggers? Leave your comments below to discuss this.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/gossip/search-engine-optimization/' rel='bookmark' title='Permanent Link: Search Engine Optimization'>Search Engine Optimization</a> <small>Introduction to SEO Search Engine Optimization or SEO is the...</small></li><li><a href='http://developerwall.com/about/' rel='bookmark' title='Permanent Link: About'>About</a> <small>Hi &#8211; I am Kalyan, a web developer and designer...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/gossip/blogging/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS for Beginners part 2</title>
		<link>http://developerwall.com/all-tutorial-posts/css-for-beginners-part-2/</link>
		<comments>http://developerwall.com/all-tutorial-posts/css-for-beginners-part-2/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 17:47:34 +0000</pubDate>
		<dc:creator>Kalyan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS for beginners]]></category>
		<category><![CDATA[CSS for HTML]]></category>
		<category><![CDATA[CSS levels priority]]></category>
		<category><![CDATA[different levels of styles]]></category>
		<category><![CDATA[Different types of styles]]></category>
		<category><![CDATA[external css]]></category>
		<category><![CDATA[external styles]]></category>
		<category><![CDATA[how to link external css in html page]]></category>
		<category><![CDATA[how to write css]]></category>
		<category><![CDATA[how to write external css]]></category>
		<category><![CDATA[how to write external styles]]></category>
		<category><![CDATA[how to write inline css]]></category>
		<category><![CDATA[how to write internal css]]></category>
		<category><![CDATA[how to write internal styles]]></category>
		<category><![CDATA[how to write intline styles]]></category>
		<category><![CDATA[inline css]]></category>
		<category><![CDATA[Inline CSS is accepted first and then Internal and then at last External]]></category>
		<category><![CDATA[Inline styles]]></category>
		<category><![CDATA[Inline vs Internal vs External]]></category>
		<category><![CDATA[internal css]]></category>
		<category><![CDATA[internal styles]]></category>
		<category><![CDATA[levels of styles]]></category>
		<category><![CDATA[style levels]]></category>
		<category><![CDATA[styles in HTML]]></category>
		<category><![CDATA[stylesheets]]></category>

		<guid isPermaLink="false">http://developerwall.com/?p=151</guid>
		<description><![CDATA[This second installment of CSS for Beginners will give you an overview of the different kinds of CSS levels and the priorities of the different levels. Also given are a few examples to show the difference between the 3 levels of CSS - Inline, Internal, External.


Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/css-selectors-properties-and-values-for-beginners/' rel='bookmark' title='Permanent Link: CSS Selectors, Properties and Values for beginners'>CSS Selectors, Properties and Values for beginners</a> <small>This article descibes all about CSS Selectors, Properties and Values....</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners/' rel='bookmark' title='Permanent Link: CSS for Beginners'>CSS for Beginners</a> <small>Ever wondered what is behind a beautifully designed website? The...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Having discussed the advantages and the disadvantages of CSS in my <a href="http://developerwall.com/?p=141" alt="CSS for Beginners" title="CSS for Beginners">earlier post</a>, let us know see what the different types or levels of CSS are. </p>
<p>There are 3 ways we can write styles.</p>
<ol>
<li>Inline</li>
<li>Internal</li>
<li>External</li>
</ol>
<h2>1. Inline CSS</h2>
<p><strong>Inline</strong> CSS is &#8211; writing the required style to a specific tag within the page.</p>
<p>For Example:</p>
<div class="code"><code>&lt;p style=&quot;color:red&quot;&gt;Developer Wall: CSS for Beginners&lt;/p&gt;</code></div>
<p>The above piece of code is to display anything within the paragraph tag in red color.</p>
<p>Output:</p>
<div class="output" style="color:red">Developer Wall: CSS for Beginners</div>
<h2>2. Internal CSS</h2>
<p><strong>Internal</strong> styles are written in the <strong>&lt;head&gt;</strong> tag of the HTML page as follows</p>
<p>For Example:</p>
<div class="code"><code>&lt;head&gt;<br/><br />
&lt;style type=&quot;text/css&quot;&gt;<br />
  &lt;!--<br />
  .redtext{ color: #FF0000; }<br />
  --&gt;<br />
&lt;/style&gt;<br/><br />
&lt;/head&gt;</code></div>
<p>This is now called a class and can be referred by any other tag in the HTML to inherit the properties. Example as below</p>
<div class="code"><code>&lt;p class=&quot;redtext&quot;&gt;Developer Wall: CSS for Beginners&lt;/p&gt;</code></div>
<p>The above code will also result in displaying the text in red as in the Inline example above.</p>
<h2>3. External CSS</h2>
<p><strong>External</strong> styles can be written by writing the code in a separate CSS file and then linking it in the HTML page.</p>
<p>For example:</p>
<p>The class &#8220;redtext&#8221; can be written in a separate file like say <em>styles.css</em> and then can be called in the HTML file with the following line in the <strong>&lt;head&gt;</strong> tag</p>
<div class="code"><code>&lt;link href=&quot;styles.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</code></div>
<p>The above line of code will actually link the external css file to the HTML page and all the classes defining the styles can be accessed using the &#8220;class&#8221; attribute for the HTML tags in the page.</p>
<p>Example:</p>
<p>Lets say we have the following styles in the CSS stylesheet <em>styles.css</em>:</p>
<div class="code"><code>.redtext{color:red;}<br/><br />
.boldtext{font-weight:bold;}<br/><br />
.textsize{font-size:13px;}</code></div>
<p>This stylesheet can now be linked into a HTML page by writing the following code in the <strong>&lt;head&gt;</strong> as follows [If you are using softwares like Adobe Dreamweaver, there are easier ways to link the stylesheet]:</p>
<div class="code"><code>&lt;link href=&quot;styles.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</code></div>
<p>Now, you can apply the available 3 classes in the stylesheet to 3 different tags in the HTML as follows:</p>
<div class="code"><code>&lt;p class=&quot;redtext&quot;&gt;DeveloperWall&lt;/p&gt;<br />
  &lt;p class=&quot;boldtext&quot;&gt;CSS&lt;/p&gt;<br />
&lt;p class=&quot;textsize&quot;&gt;Blog for Developers&lt;/p&gt;</code></div>
<p>The output of the above code will be:</p>
<div class="output"><code>
<p style="color:red">DeveloperWall</p>
<p style="font-weight:bold">CSS</p>
<p style="font-size:13px">Blog for Developers</p>
<p></code></div>
<p>There are also priorities for each CSS level. What if there is a style written for a paragraph tag in all three levels? Whcih level of CSS is accepted.</p>
<p>Inline CSS has top priority. Next comes Internal CSS and then at last is External CSS. So, if a paragraph tag has all three, it will accept Inline CSS first. If there is no Inline CSS, then it looks for Internal and then finally External CSS.</p>


<p>Related posts:<ol><li><a href='http://developerwall.com/all-tutorial-posts/css-selectors-properties-and-values-for-beginners/' rel='bookmark' title='Permanent Link: CSS Selectors, Properties and Values for beginners'>CSS Selectors, Properties and Values for beginners</a> <small>This article descibes all about CSS Selectors, Properties and Values....</small></li><li><a href='http://developerwall.com/all-tutorial-posts/css-for-beginners/' rel='bookmark' title='Permanent Link: CSS for Beginners'>CSS for Beginners</a> <small>Ever wondered what is behind a beautifully designed website? The...</small></li><li><a href='http://developerwall.com/all-tutorial-posts/adobe-flex-30/actionscripting-in-flex/' rel='bookmark' title='Permanent Link: ActionScripting in Flex'>ActionScripting in Flex</a> <small>It is important to know that Flex is not here...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://developerwall.com/all-tutorial-posts/css-for-beginners-part-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
