<?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>Flash CS3 and Flash CS4 tutorials &#187; Tutorials</title>
	<atom:link href="http://englishblog.flepstudio.org/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://englishblog.flepstudio.org</link>
	<description>Actionscript 3.0 Blog with Tutorials and free resources for Flash</description>
	<lastBuildDate>Wed, 01 Sep 2010 07:08:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using Flash CS5 TLF ( Text Layout Framework ) with Actionscript 3.0</title>
		<link>http://englishblog.flepstudio.org/tutorials/flash-cs5-tutorials/using-flash-cs5-tlf-text-layout-framework-with-actionscript-3-0/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flash-cs5-tutorials/using-flash-cs5-tlf-text-layout-framework-with-actionscript-3-0/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 07:08:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash CS5]]></category>
		<category><![CDATA[flash and tlf]]></category>
		<category><![CDATA[flash cs5 and tlf]]></category>
		<category><![CDATA[flash cs5 formatted text]]></category>
		<category><![CDATA[text layout framework]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=869</guid>
		<description><![CDATA[From Flash Professional CS5, you can add text to a FLA file using a new text engine called the Text Layout Framework (TLF). TLF supports a wide range of functions, layout and text formatting attributes. The text TLF gives you more control over text than the previous text engine, which is now called classic texts. [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs5-tutorials%2Fusing-flash-cs5-tlf-text-layout-framework-with-actionscript-3-0%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs5-tutorials%2Fusing-flash-cs5-tlf-text-layout-framework-with-actionscript-3-0%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>From Flash Professional CS5, <strong>you can add text to a FLA file using a new text engine called the Text Layout Framework (TLF)</strong>. <br />
  TLF supports a <strong>wide range of functions, layout and text formatting attributes</strong>. <br />
  The text TLF gives you <strong>more control over text than the previous text engine, which is now called classic texts</strong>. <br />
  Compared to the classic text, the text TLF provides the following improvements: </p>
<ul>
<li>Additional font styles, including spacing, ligatures, highlight color, underline, strikethrough, capitalization, type of figures and more. </li>
<li>Additional paragraph styles, including multi-column margin width central options justification of the last line, margins, indents, paragraph spacing and spacing values of the containers. </li>
<li>Control attributes of Asian text, including Tate Chu Yoko Mojikumi, Type Kinsoku Shore model spacing. </li>
<li>You can apply attributes such as 3D rotation, color effects and blending modes to insert text without TLF in a movie clip symbol. </li>
<li>The text can scroll across multiple text boxes, which are defined in this case linked or connected. </li>
<li>The ability to create text with direction from right to left for Arabic and Hebrew. </li>
<li>Support for bidirectional text, with the possibility of including elements of text from left to right in a text direction from right to left.<br />
This option is important, for example, when you need to incorporate English words Arabic numerals or in a text written in Arabic or Hebrew. </li>
</ul>
<p><strong>The text is in containers that can be physically drawn on the Stage using the Text tool</strong> and named instance, or as is more joint <strong>can be created at runtime with Actionscript</strong>. <br />
  Text can be <strong>formatted and manipulated through the Properties panel</strong>. <br />
  <strong>If there is a property pane, its counterpart is also found in ActionScript. </strong><br />
  The bad news of course is that ActionScript does not format the text until you tell it what to do. <br />
  Most projects will start telling Flash to create a configuration for the &#8216;object, which is used to tell Flash how to manage text layout. </p>
<p>The appearance of the text is run by <strong>TextFlow</strong> class, which takes its orders, so to speak, the configuration object. <br />
  The default format is set using a class property called <strong>textFlowInitialFormat</strong> configuration. <br />
  To change it, just use the class <strong>TextlayoutFormat</strong> to set the font, colors, alignment, and so on, and then say that its configuration textFlowInitialFormat has changed. <br />
  Instead, the class TextFlow has overall responsibility for all the words inside a container. <br />
With this information we go to work with <strong>TLF and ActionScript</strong>. </p>
<p align="right"><strong><a href="http://www.flepstudio.org/forum/cs5-tutorials/6396-using-tlf-text-layout-framework-actioscript-3-0-a.html" title="download files">Read more&#8230;</a></strong></p>

	Tags: <a href="http://englishblog.flepstudio.org/tag/flash-and-tlf/" title="flash and tlf" rel="tag">flash and tlf</a>, <a href="http://englishblog.flepstudio.org/tag/flash-cs5-and-tlf/" title="flash cs5 and tlf" rel="tag">flash cs5 and tlf</a>, <a href="http://englishblog.flepstudio.org/tag/flash-cs5-formatted-text/" title="flash cs5 formatted text" rel="tag">flash cs5 formatted text</a>, <a href="http://englishblog.flepstudio.org/tag/text-layout-framework/" title="text layout framework" rel="tag">text layout framework</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flash-cs5-tutorials/using-flash-cs5-tlf-text-layout-framework-with-actionscript-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 4 DateField component and XML</title>
		<link>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datefield-component-and-xml/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datefield-component-and-xml/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 06:49:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[flash builder 4]]></category>
		<category><![CDATA[flex 4 and xml]]></category>
		<category><![CDATA[flex 4 datefield]]></category>
		<category><![CDATA[mxml and actionscript]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=865</guid>
		<description><![CDATA[Using DateField component of Flex 4 with MXML, Actionscript 3.0 and external XML file Main.mxml: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:Application xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/mx&#34; minWidth=&#34;955&#34; minHeight=&#34;600&#34; addedToStage=&#34;init()&#34; pageTitle=&#34;Flex 4 DateField Tutorial&#34;&#62; &#60;fx:Script&#62; &#60;![CDATA[ import com.flepstudio.utils.*; import flash.events.*; import mx.collections.ArrayCollection; import mx.controls.*; import mx.events.*; private var XML_PATH:String=&#34;http://flepstudio.org/FlashBuilder/tut_5/XML/list.xml&#34;; private var xmlLoader:XMLLoader; private var xmlData:XML; private var datefield:DateField; private var [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fflex-4-datefield-component-and-xml%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fflex-4-datefield-component-and-xml%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Using DateField component of Flex 4 with MXML, Actionscript 3.0 and external XML file</p>
<p><a href="http://flepstudio.org/FlashBuilder/tut_5/tut_5.html" target="_new"><img src="http://flepstudio.org/FlashBuilder/images/demo.png" alt="view demo online" width="226" height="46" border="0"></a></p>
<p>Main.mxml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
               xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
               xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot; addedToStage=&quot;init()&quot; pageTitle=&quot;Flex 4 DateField Tutorial&quot;&gt;
    &lt;fx:Script&gt;
        &lt;![CDATA[
            import com.flepstudio.utils.*;

            import flash.events.*;

            import mx.collections.ArrayCollection;
            import mx.controls.*;
            import mx.events.*;

            private var XML_PATH:String=&quot;http://flepstudio.org/FlashBuilder/tut_5/XML/list.xml&quot;;
            private var xmlLoader:XMLLoader;
            private var xmlData:XML;
            private var datefield:DateField;
            private var label:Label;
            private var months_array:Array=new Array();
            private var current_selection:Date;

            private function init():void
            {
                loadXML();
            }

            private function loadXML():void
            {
                xmlLoader=new XMLLoader();
                xmlLoader.addEventListener(CustomEvent.ONLOADED,onXMLLoaded);
                xmlLoader.load(XML_PATH);
            }

            private function onXMLLoaded(evt:CustomEvent):void
            {
                evt.target.removeEventListener(Event.COMPLETE,onXMLLoaded);
                xmlData=new XML(evt.data);

                var months:int=xmlData.month.length();
                for(var i:int=0;i&lt;months;i++)
                {
                    months_array.push(xmlData.month[i].@name);
                }

                label=new Label();
                label.width=800;
                label.height=500;
                label.text=&quot;History:&quot;+&quot;\n&quot;;

                datefield=new DateField();
                var today:Date=new Date();
                datefield.selectedDate=today;

                hb1.addChild(datefield);
                hb2.addChild(label);

                datefield.addEventListener(Event.CHANGE,onDatefieldChange);
                datefield.addEventListener(DateChooserEvent.SCROLL,onMonthChange);
            }

            private function onDatefieldChange(evt:Event):void
            {
                label.text+=evt.target.selectedDate+&quot;\n&quot;;
                current_selection=evt.target.selectedDate;
            }

            private function onMonthChange(evt:DateChooserEvent):void
            {
                var month:int=evt.target.displayedMonth;
                label.text+=&quot;Scrolling months: &quot;+months_array[month]+&quot;  &quot;+evt.target.displayedYear+&quot;\n&quot;;
            }
        ]]&gt;
    &lt;/fx:Script&gt;
    &lt;fx:Declarations&gt;
        &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
    &lt;/fx:Declarations&gt;
    &lt;mx:HBox id=&quot;hb1&quot; x=&quot;10&quot; y=&quot;150&quot;/&gt;
    &lt;mx:HBox id=&quot;hb2&quot; x=&quot;10&quot; y=&quot;180&quot;/&gt;
    &lt;mx:Image x=&quot;10&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/53/cats/128/adobe_flex_3_folder.png&quot;/&gt;
    &lt;mx:Image x=&quot;140&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/1757/isabi/128/flash_player.png&quot;/&gt;
&lt;/s:Application&gt;</code></pre>
<p>XMLloader.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;
    import flash.net.*;
    import flash.xml.*

        /**
         * XMLLoader is a ValueObject for the FlepStudio API.
         * This class loads a parses an xml file - no XMLList used
         *
         * @author Filippo Lughi
         * @version Actionscript 3.0
         */
        public class XMLLoader extends EventDispatcher
        {
            private var _file_url:URLRequest;
            private var _file_xml:XML;
            private var _urlLoader:URLLoader;

            /**
             * Construct a new XMLLoader instance
             *
             * @param        .target                IEventDispatcher
             */
            public function XMLLoader(target:IEventDispatcher=null)
            {
                urlLoader=new URLLoader();
                super(target);
            }

            /**
             * The request to load the file
             */
            public function get file_url():URLRequest
            {
                return _file_url;
            }

            public function set file_url(file:URLRequest):void
            {
                _file_url=file;
            }

            /**
             * The XML file
             */
            public function get file_xml():XML
            {
                return _file_xml;
            }

            public function set file_xml(xml:XML):void
            {
                _file_xml=xml;
            }

            /**
             * The loader instance
             */
            public function get urlLoader():URLLoader
            {
                return _urlLoader;
            }

            public function set urlLoader(loader:URLLoader):void
            {
                _urlLoader=loader;
            }

            /**
             * Load the XML file
             *
             * @param        .strFileName                String
             */
            public function load(strFileName:String):void
            {
                file_url=new URLRequest(strFileName);
                urlLoader.load(file_url);
                urlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
            }

            /**
             * Finish loading
             *
             * @param        .evt                Event
             */
            private function onXMLLoaded(evt:Event):void
            {
                urlLoader.removeEventListener(Event.COMPLETE,onXMLLoaded);

                var dataLoader:URLLoader=evt.target as URLLoader;
                file_xml=new XML(dataLoader.data);
                dispatchEvent(new CustomEvent(CustomEvent.ONLOADED,file_xml));

                file_xml=null;
                dataLoader=null;
                urlLoader=null;
            }
        }
}</code></pre>
<p>CustomEvent.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;

    /**
     * CustomEvent is a ValueObject for the FlepStudio API.
     * Working and using custom events with custom constants
     *
     * @author Filippo Lughi
     * @version Actionscript 3.0
     */
    public class CustomEvent extends Event
    {
        private var _data:*;
        public static const ONLOADED:String=&quot;OnLoaded&quot;;

        /**
         * Construct a new CustomEvent instance
         *
         * @param        .type                String
         * @param        .data                *Universal
         */
        public function CustomEvent(type:String,data:*)
        {
            this.data=data;
            super(type);
        }

        /**
         * The data of the CustomEvent
         */
        public function get data():*
        {
            return _data;
        }

        public function set data(d:*):void
        {
            _data=d;
        }
    }
}</code></pre>
<p>external XML, list.xml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;list&gt;
    &lt;month name=&quot;January&quot;/&gt;
    &lt;month name=&quot;February&quot;/&gt;
    &lt;month name=&quot;March&quot;/&gt;
    &lt;month name=&quot;April&quot;/&gt;
    &lt;month name=&quot;May&quot;/&gt;
    &lt;month name=&quot;June&quot;/&gt;
    &lt;month name=&quot;July&quot;/&gt;
    &lt;month name=&quot;August&quot;/&gt;
    &lt;month name=&quot;September&quot;/&gt;
    &lt;month name=&quot;October&quot;/&gt;
    &lt;month name=&quot;November&quot;/&gt;
    &lt;month name=&quot;December&quot;/&gt;
&lt;/list&gt;</code></pre>

	Tags: <a href="http://englishblog.flepstudio.org/tag/flash-builder-4/" title="flash builder 4" rel="tag">flash builder 4</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-and-xml/" title="flex 4 and xml" rel="tag">flex 4 and xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-datefield/" title="flex 4 datefield" rel="tag">flex 4 datefield</a>, <a href="http://englishblog.flepstudio.org/tag/mxml-and-actionscript/" title="mxml and actionscript" rel="tag">mxml and actionscript</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-list-and-datagrid-components-of-flex-4/" title="Using List and DataGrid components of Flex 4 (July 2, 2010)">Using List and DataGrid components of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-datachooser-component-of-flex-4/" title="Using DataChooser component of Flex 4 (May 24, 2010)">Using DataChooser component of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-combobox-mxml-and-external-xml/" title="Flex 4 ComboBox MXML and external XML (May 31, 2010)">Flex 4 ComboBox MXML and external XML</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datefield-component-and-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embed SWF into HTML 5 pages and flashvars</title>
		<link>http://englishblog.flepstudio.org/tutorials/flash-cs3/mix/embed-swf-into-html-5-pages-and-flashvars/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flash-cs3/mix/embed-swf-into-html-5-pages-and-flashvars/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 05:45:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[embed swf html5]]></category>
		<category><![CDATA[flash and html5]]></category>
		<category><![CDATA[flashvars html5]]></category>
		<category><![CDATA[swf and html5]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=850</guid>
		<description><![CDATA[Version 5 of HTML supports the embed tag. This tag allows us to easily insert an SWF in our HTML5 page. Here is the code to insert a SWF. SWF with background &#60;embed src=&#34;main.swf&#34; width=&#34;550&#34; height=&#34;400&#34; /&#62; SWF with tansparent background &#60;embed src=&#34;main.swf&#34; width=&#34;550&#34; height=&#34;400&#34; wmode=&#34;transparent&#34; /&#62; SWF with Flashvars &#60;embed src=&#34;main.swf&#34; width=&#34;550&#34; height=&#34;400&#34; flashvars=&#34;id=hello [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs3%2Fmix%2Fembed-swf-into-html-5-pages-and-flashvars%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs3%2Fmix%2Fembed-swf-into-html-5-pages-and-flashvars%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Version 5 of HTML supports the <strong>embed</strong> tag. <br />
  This tag allows us to easily <strong>insert an SWF in our HTML5 page</strong>. <br />
  Here is the code to insert a SWF.</p>
<h3>SWF with background</h3>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;embed src=&quot;main.swf&quot; width=&quot;550&quot; height=&quot;400&quot; /&gt;</code></pre>
<h3>SWF with tansparent background</h3>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;embed src=&quot;main.swf&quot; width=&quot;550&quot; height=&quot;400&quot; wmode=&quot;transparent&quot; /&gt;</code></pre>
<h3>SWF with Flashvars</h3>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;embed src=&quot;main.swf&quot; width=&quot;550&quot; height=&quot;400&quot; flashvars=&quot;id=hello world&quot; wmode=&quot;transparent&quot; /&gt;</code></pre>
<p><strong>Important</strong>:</p>
<ul>
<li>You can NOT write text between the start and end tags</li>
<li>The embed tag also supports the Standard Attributes in HTML 5</li>
<li>The embed tag also supports the Event Attributes in HTML 5</li>
</ul>
<p><strong>PS</strong>:</p>
<p>I tested the embed tag  on MAC with the following browsers:</p>
<ul>
<li>Safari 5.0.1</li>
<li>Google Chrome 5.0.375.125</li>
<li>Firefox 3.6.6</li>
</ul>

	Tags: <a href="http://englishblog.flepstudio.org/tag/embed-swf-html5/" title="embed swf html5" rel="tag">embed swf html5</a>, <a href="http://englishblog.flepstudio.org/tag/flash-and-html5/" title="flash and html5" rel="tag">flash and html5</a>, <a href="http://englishblog.flepstudio.org/tag/flashvars-html5/" title="flashvars html5" rel="tag">flashvars html5</a>, <a href="http://englishblog.flepstudio.org/tag/swf-and-html5/" title="swf and html5" rel="tag">swf and html5</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flash-cs3/mix/embed-swf-into-html-5-pages-and-flashvars/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using List and DataGrid components of Flex 4</title>
		<link>http://englishblog.flepstudio.org/tutorials/flex-4/using-list-and-datagrid-components-of-flex-4/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flex-4/using-list-and-datagrid-components-of-flex-4/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 07:18:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Components]]></category>
		<category><![CDATA[custom events]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[EventDispatcher]]></category>
		<category><![CDATA[external xml]]></category>
		<category><![CDATA[flex 4 and xml]]></category>
		<category><![CDATA[flex 4 list and datagrid components]]></category>
		<category><![CDATA[mxml and actionscript]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=828</guid>
		<description><![CDATA[Using List and DataGrid components of Flex 4 with MXML, Actionscript 3.0 and external XML file. Main.mxml: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:Application xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/mx&#34; minWidth=&#34;955&#34; minHeight=&#34;600&#34; addedToStage=&#34;init()&#34; pageTitle=&#34;Flex 4 List and DataGrid Tutorial&#34;&#62; &#60;fx:Script&#62; &#60;![CDATA[ import com.flepstudio.utils.*; import flash.events.*; import mx.collections.ArrayCollection; import mx.controls.*; import mx.events.*; import mx.validators.ValidationResult; private var XML_PATH:String=&#34;http://flepstudio.org/FlashBuilder/tut_4/XML/list.xml&#34;; private var xmlLoader:XMLLoader; private var [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fusing-list-and-datagrid-components-of-flex-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fusing-list-and-datagrid-components-of-flex-4%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Using List and DataGrid components of Flex 4 with MXML, Actionscript 3.0 and external XML file.</p>
<p><a href="http://flepstudio.org/FlashBuilder/tut_4/tut_4.html" target="_new"><img src="http://flepstudio.org/FlashBuilder/images/demo.png" alt="view demo online" width="226" height="46" border="0"></a></p>
<p>Main.mxml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
               xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
               xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot; addedToStage=&quot;init()&quot; pageTitle=&quot;Flex 4 List and DataGrid Tutorial&quot;&gt;
    &lt;fx:Script&gt;
        &lt;![CDATA[
            import com.flepstudio.utils.*;

            import flash.events.*;

            import mx.collections.ArrayCollection;
            import mx.controls.*;
            import mx.events.*;
            import mx.validators.ValidationResult;

            private var XML_PATH:String=&quot;http://flepstudio.org/FlashBuilder/tut_4/XML/list.xml&quot;;
            private var xmlLoader:XMLLoader;
            private var xmlData:XML;
            private var list:List;
            private var datagrid:DataGrid;

            private var albums_array:Array=new Array();
            private var tracks_array:Array=new Array();

            private function init():void
            {
                loadXML();
            }

            private function loadXML():void
            {
                xmlLoader=new XMLLoader();
                xmlLoader.addEventListener(CustomEvent.ONLOADED,onXMLLoaded);
                xmlLoader.load(XML_PATH);
            }

            private function onXMLLoaded(evt:CustomEvent):void
            {
                evt.target.removeEventListener(Event.COMPLETE,onXMLLoaded);
                xmlData=new XML(evt.data);

                var albums:int=xmlData.album.length();
                for(var i:int=0;i&lt;albums;i++)
                {
                    var obj:Object=new Object();
                    obj.label=xmlData.album[i].@title+&quot;\n&quot;+&quot;Released &quot;+xmlData.album[i].@released+&quot;\n&quot;+&quot;Label &quot;+xmlData.album[i].@label;
                    albums_array.push(obj);

                    var xml_list:XMLList=new XMLList(xmlData.album[i].track);
                    tracks_array.push(xml_list);
                }

                list=new List();
                list.width=230;
                list.dataProvider=albums_array;
                list.selectedIndex=0;
                hb1.addChild(list);

                datagrid=new DataGrid();
                datagrid.width=900;
                hb2.addChild(datagrid);
                datagridDisplayData(0);

                list.addEventListener(Event.CHANGE,onListChange);
                datagrid.addEventListener(Event.CHANGE,onDatagridChange);
            }

            private function onListChange(evt:Event):void
            {
                datagridDisplayData(evt.target.selectedIndex);
            }

            private function datagridDisplayData(id:int):void
            {
                datagrid.dataProvider=tracks_array[id];
            }

            private function onDatagridChange(evt:Event):void
            {
                label.text=&quot;You selected:  &quot;+evt.target.selectedItem;
            }
        ]]&gt;
    &lt;/fx:Script&gt;
    &lt;fx:Declarations&gt;
        &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
    &lt;/fx:Declarations&gt;
    &lt;mx:HBox id=&quot;hb1&quot; x=&quot;10&quot; y=&quot;150&quot;/&gt;
    &lt;mx:HBox id=&quot;hb2&quot; x=&quot;250&quot; y=&quot;150&quot;/&gt;
    &lt;mx:Image x=&quot;10&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/53/cats/128/adobe_flex_3_folder.png&quot;/&gt;
    &lt;mx:Image x=&quot;140&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/1757/isabi/128/flash_player.png&quot;/&gt;
    &lt;s:Label x=&quot;250&quot; y=&quot;330&quot; width=&quot;499&quot; height=&quot;157&quot; id=&quot;label&quot;/&gt;
&lt;/s:Application&gt;</code></pre>
<p>XMLloader.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;
    import flash.net.*;
    import flash.xml.*

        /**
         * XMLLoader is a ValueObject for the FlepStudio API.
         * This class loads a parses an xml file - no XMLList used
         *
         * @author Filippo Lughi
         * @version Actionscript 3.0
         */
        public class XMLLoader extends EventDispatcher
        {
            private var _file_url:URLRequest;
            private var _file_xml:XML;
            private var _urlLoader:URLLoader;

            /**
             * Construct a new XMLLoader instance
             *
             * @param        .target                IEventDispatcher
             */
            public function XMLLoader(target:IEventDispatcher=null)
            {
                urlLoader=new URLLoader();
                super(target);
            }

            /**
             * The request to load the file
             */
            public function get file_url():URLRequest
            {
                return _file_url;
            }

            public function set file_url(file:URLRequest):void
            {
                _file_url=file;
            }

            /**
             * The XML file
             */
            public function get file_xml():XML
            {
                return _file_xml;
            }

            public function set file_xml(xml:XML):void
            {
                _file_xml=xml;
            }

            /**
             * The loader instance
             */
            public function get urlLoader():URLLoader
            {
                return _urlLoader;
            }

            public function set urlLoader(loader:URLLoader):void
            {
                _urlLoader=loader;
            }

            /**
             * Load the XML file
             *
             * @param        .strFileName                String
             */
            public function load(strFileName:String):void
            {
                file_url=new URLRequest(strFileName);
                urlLoader.load(file_url);
                urlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
            }

            /**
             * Finish loading
             *
             * @param        .evt                Event
             */
            private function onXMLLoaded(evt:Event):void
            {
                urlLoader.removeEventListener(Event.COMPLETE,onXMLLoaded);

                var dataLoader:URLLoader=evt.target as URLLoader;
                file_xml=new XML(dataLoader.data);
                dispatchEvent(new CustomEvent(CustomEvent.ONLOADED,file_xml));

                file_xml=null;
                dataLoader=null;
                urlLoader=null;
            }
        }
}</code></pre>
<p>CustomEvent.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;

    /**
     * CustomEvent is a ValueObject for the FlepStudio API.
     * Working and using custom events with custom constants
     *
     * @author Filippo Lughi
     * @version Actionscript 3.0
     */
    public class CustomEvent extends Event
    {
        private var _data:*;
        public static const ONLOADED:String=&quot;OnLoaded&quot;;

        /**
         * Construct a new CustomEvent instance
         *
         * @param        .type                String
         * @param        .data                *Universal
         */
        public function CustomEvent(type:String,data:*)
        {
            this.data=data;
            super(type);
        }

        /**
         * The data of the CustomEvent
         */
        public function get data():*
        {
            return _data;
        }

        public function set data(d:*):void
        {
            _data=d;
        }
    }
}</code></pre>
<p>External XML, list.xml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;list&gt;
    &lt;album title=&quot;T.N.T.&quot; released=&quot;December 1975&quot; label=&quot;Albert Productions&quot;&gt;
        &lt;track duration=&quot;5:15&quot;&gt;It's a Long Way to the Top (If You Wanna Rock 'n' Roll)&lt;/track&gt;
        &lt;track duration=&quot;5:04&quot;&gt;Rock 'n' Roll Singer&lt;/track&gt;
        &lt;track duration=&quot;5:52&quot;&gt;The Jack&lt;/track&gt;
        &lt;track duration=&quot;5:49&quot;&gt;Live Wire&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;T.N.T.&lt;/track&gt;
        &lt;track duration=&quot;2:51&quot;&gt;Rocker&lt;/track&gt;
        &lt;track duration=&quot;4:12&quot;&gt;Can I Sit Next to You Girl&lt;/track&gt;
        &lt;track duration=&quot;4:22&quot;&gt;High Voltage&lt;/track&gt;
        &lt;track duration=&quot;5:23&quot;&gt;School Days&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;High Voltage&quot; released=&quot;14 May 1976&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;5:15&quot;&gt;It's a Long Way to the Top (If You Wanna Rock 'n' Roll)&lt;/track&gt;
        &lt;track duration=&quot;5:04&quot;&gt;Rock 'n' Roll Singer&lt;/track&gt;
        &lt;track duration=&quot;5:52&quot;&gt;The Jack&lt;/track&gt;
        &lt;track duration=&quot;5:49&quot;&gt;Live Wire&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;T.N.T.&lt;/track&gt;
        &lt;track duration=&quot;4:12&quot;&gt;Can I Sit Next to You Girl&lt;/track&gt;
        &lt;track duration=&quot;5:37&quot;&gt;Little Lover&lt;/track&gt;
        &lt;track duration=&quot;4:51&quot;&gt;She's Got Balls&lt;/track&gt;
        &lt;track duration=&quot;4:03&quot;&gt;High Voltage&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Dirty Deeds Done Dirt Cheap&quot; released=&quot;17 December 1976&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;3:52&quot;&gt;Dirty Deeds Done Dirt Cheap&lt;/track&gt;
        &lt;track duration=&quot;3:12&quot;&gt;Love at First Feel&lt;/track&gt;
        &lt;track duration=&quot;2:38&quot;&gt;Big Balls&lt;/track&gt;
        &lt;track duration=&quot;2:50&quot;&gt;Rocker&lt;/track&gt;
        &lt;track duration=&quot;5:46&quot;&gt;Problem Child&lt;/track&gt;
        &lt;track duration=&quot;3:18&quot;&gt;There's Gonna Be Some Rockin&lt;/track&gt;
        &lt;track duration=&quot;6:57&quot;&gt;Ain't No Fun (Waiting Round to Be a Millionaire)&lt;/track&gt;
        &lt;track duration=&quot;5:53&quot;&gt;Ride On&lt;/track&gt;
        &lt;track duration=&quot;5:27&quot;&gt;Squealer&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Let There Be Rock&quot; released=&quot;23 June 1977&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;5:18&quot;&gt;Go Down&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;Dog Eat Dog&lt;/track&gt;
        &lt;track duration=&quot;6:06&quot;&gt;Let There Be Rock&lt;/track&gt;
        &lt;track duration=&quot;4:27&quot;&gt;Bad Boy Boogie&lt;/track&gt;
        &lt;track duration=&quot;5:24&quot;&gt;Problem Child&lt;/track&gt;
        &lt;track duration=&quot;6:09&quot;&gt;Overdose&lt;/track&gt;
        &lt;track duration=&quot;4:21&quot;&gt;Hell Ain't a Bad Place to Be&lt;/track&gt;
        &lt;track duration=&quot;5:24&quot;&gt;Whole Lotta Rosie&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Powerage&quot; released=&quot;25 May 1978&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;3:05&quot;&gt;Rock 'n' Roll Damnation&lt;/track&gt;
        &lt;track duration=&quot;3:00&quot;&gt;Gimme a Bullet&lt;/track&gt;
        &lt;track duration=&quot;5:50&quot;&gt;Down Payment Blues&lt;/track&gt;
        &lt;track duration=&quot;4:19&quot;&gt;Gone Shootin&lt;/track&gt;
        &lt;track duration=&quot;5:13&quot;&gt;Riff Raff&lt;/track&gt;
        &lt;track duration=&quot;4:47&quot;&gt;Sin City&lt;/track&gt;
        &lt;track duration=&quot;4:58&quot;&gt;Up to My Neck in You&lt;/track&gt;
        &lt;track duration=&quot;3:15&quot;&gt;What's Next to the Moon&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;Cold Hearted Man&lt;/track&gt;
        &lt;track duration=&quot;3:45&quot;&gt;Kicked in the Teeth&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Highway to Hell&quot; released=&quot;27 July 1979&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;3:28&quot;&gt;Highway to Hell&lt;/track&gt;
        &lt;track duration=&quot;3:23&quot;&gt;Girls Got Rhythm&lt;/track&gt;
        &lt;track duration=&quot;5:10&quot;&gt;Walk All Over You&lt;/track&gt;
        &lt;track duration=&quot;4:27&quot;&gt;Touch Too Much&lt;/track&gt;
        &lt;track duration=&quot;3:56&quot;&gt;Beating Around the Bush&lt;/track&gt;
        &lt;track duration=&quot;3:22&quot;&gt;Shot Down in Flames&lt;/track&gt;
        &lt;track duration=&quot;2:34&quot;&gt;Get It Hot&lt;/track&gt;
        &lt;track duration=&quot;4:37&quot;&gt;If You Want Blood (You've Got It)&lt;/track&gt;
        &lt;track duration=&quot;4:17&quot;&gt;Love Hungry Man&lt;/track&gt;
        &lt;track duration=&quot;6:27&quot;&gt;Night Prowler&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Back in Black&quot; released=&quot;25 July 1980&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;5:10&quot;&gt;Hells Bells&lt;/track&gt;
        &lt;track duration=&quot;5:17&quot;&gt;Shoot to Thrill&lt;/track&gt;
        &lt;track duration=&quot;3:33&quot;&gt;What Do You Do for Money Honey&lt;/track&gt;
        &lt;track duration=&quot;3:30&quot;&gt;Given the Dog a Bone&lt;/track&gt;
        &lt;track duration=&quot;4:16&quot;&gt;Let Me Put My Love into You&lt;/track&gt;
        &lt;track duration=&quot;4:14&quot;&gt;Back in Black&lt;/track&gt;
        &lt;track duration=&quot;3:30&quot;&gt;You Shook Me All Night Long&lt;/track&gt;
        &lt;track duration=&quot;3:57&quot;&gt;Have a Drink on Me&lt;/track&gt;
        &lt;track duration=&quot;4:06&quot;&gt;Shake a Leg&lt;/track&gt;
        &lt;track duration=&quot;4:15&quot;&gt;Rock and Roll Ain't Noise Pollution&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;For Those About to Rock&quot; released=&quot;23 November 1981&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;5:44&quot;&gt;For Those About to Rock (We Salute You)&lt;/track&gt;
        &lt;track duration=&quot;3:25&quot;&gt;Put the Finger on You&lt;/track&gt;
        &lt;track duration=&quot;3:54&quot;&gt;Let's Get It Up&lt;/track&gt;
        &lt;track duration=&quot;3:30&quot;&gt;Inject the Venom&lt;/track&gt;
        &lt;track duration=&quot;3:23&quot;&gt;Snowballed&lt;/track&gt;
        &lt;track duration=&quot;4:23&quot;&gt;Evil Walks&lt;/track&gt;
        &lt;track duration=&quot;3:19&quot;&gt;C.O.D.&lt;/track&gt;
        &lt;track duration=&quot;4:23&quot;&gt;Breaking the Rules&lt;/track&gt;
        &lt;track duration=&quot;3:25&quot;&gt;Night of the Long Knives&lt;/track&gt;
        &lt;track duration=&quot;4:39&quot;&gt;Spellbound&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Flick of the Switch&quot; released=&quot;15 August 1983&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;3:45&quot;&gt;Rising Power&lt;/track&gt;
        &lt;track duration=&quot;3:25&quot;&gt;This House Is on Fire&lt;/track&gt;
        &lt;track duration=&quot;3:15&quot;&gt;Flick of the Switch&lt;/track&gt;
        &lt;track duration=&quot;4:29&quot;&gt;Nervous Shakedown&lt;/track&gt;
        &lt;track duration=&quot;3:59&quot;&gt;Landslide&lt;/track&gt;
        &lt;track duration=&quot;3:26&quot;&gt;Guns for Hire&lt;/track&gt;
        &lt;track duration=&quot;3:21&quot;&gt;Deep in the Hole&lt;/track&gt;
        &lt;track duration=&quot;3:54&quot;&gt;Bedlam in Belgium&lt;/track&gt;
        &lt;track duration=&quot;3:40&quot;&gt;Badlands&lt;/track&gt;
        &lt;track duration=&quot;4:09&quot;&gt;Brain Shake&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Fly on the Wall&quot; released=&quot;28 June 1985&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;3:43&quot;&gt;Fly on the Wall&lt;/track&gt;
        &lt;track duration=&quot;4:10&quot;&gt;Shake Your Foundations&lt;/track&gt;
        &lt;track duration=&quot;3:40&quot;&gt;First Blood&lt;/track&gt;
        &lt;track duration=&quot;4:22&quot;&gt;Danger&lt;/track&gt;
        &lt;track duration=&quot;4:14&quot;&gt;Sink the Pink&lt;/track&gt;
        &lt;track duration=&quot;3:44&quot;&gt;Playing With Girls&lt;/track&gt;
        &lt;track duration=&quot;3:54&quot;&gt;Stand Up&lt;/track&gt;
        &lt;track duration=&quot;4:31&quot;&gt;Hell or High Water&lt;/track&gt;
        &lt;track duration=&quot;4:22&quot;&gt;Back in Business&lt;/track&gt;
        &lt;track duration=&quot;3:26&quot;&gt;Send for the Man&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Who Made Who&quot; released=&quot;24 May 1986&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;3:26&quot;&gt;Who Made Who&lt;/track&gt;
        &lt;track duration=&quot;3:30&quot;&gt;You Shook Me All Night Long&lt;/track&gt;
        &lt;track duration=&quot;2:53&quot;&gt;D.T.&quot; (A: Young, M. Young)&lt;/track&gt;
        &lt;track duration=&quot;4:13&quot;&gt;Sink the Pink&lt;/track&gt;
        &lt;track duration=&quot;5:51&quot;&gt;Ride On&lt;/track&gt;
        &lt;track duration=&quot;5:12&quot;&gt;Hells Bells&lt;/track&gt;
        &lt;track duration=&quot;4:10&quot;&gt;Shake Your Foundations&lt;/track&gt;
        &lt;track duration=&quot;3:01&quot;&gt;Chase the Ace&lt;/track&gt;
        &lt;track duration=&quot;5:53&quot;&gt;For Those About to Rock (We Salute You)&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Blow Up Your Video&quot; released=&quot;1 February 1988&quot; label=&quot;Epic Records&quot;&gt;
        &lt;track duration=&quot;3:50&quot;&gt;Heatseeker&lt;/track&gt;
        &lt;track duration=&quot;3:43&quot;&gt;That's the Way I Wanna Rock 'n' Roll&lt;/track&gt;
        &lt;track duration=&quot;4:08&quot;&gt;Meanstreak&lt;/track&gt;
        &lt;track duration=&quot;4:26&quot;&gt;Go Zone&lt;/track&gt;
        &lt;track duration=&quot;3:58&quot;&gt;Kissin' Dynamite&lt;/track&gt;
        &lt;track duration=&quot;4:16&quot;&gt;Nick of Time&lt;/track&gt;
        &lt;track duration=&quot;4:11&quot;&gt;Some Sin for Nuthin&lt;/track&gt;
        &lt;track duration=&quot;4:34&quot;&gt;Ruff Stuff&lt;/track&gt;
        &lt;track duration=&quot;5:19&quot;&gt;Two's Up&lt;/track&gt;
        &lt;track duration=&quot;4:23&quot;&gt;This Means War&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;The Razors Edge&quot; released=&quot;24 September 1990&quot; label=&quot;Atlantic Records&quot;&gt;
        &lt;track duration=&quot;4:53&quot;&gt;Thunderstruck&lt;/track&gt;
        &lt;track duration=&quot;2:54&quot;&gt;Fire Your Guns&lt;/track&gt;
        &lt;track duration=&quot;3:46&quot;&gt;Moneytalks&lt;/track&gt;
        &lt;track duration=&quot;4:23&quot;&gt;The Razors Edge&lt;/track&gt;
        &lt;track duration=&quot;4:00&quot;&gt;Mistress for Christmas&lt;/track&gt;
        &lt;track duration=&quot;4:07&quot;&gt;Rock Your Heart Out&lt;/track&gt;
        &lt;track duration=&quot;4:10&quot;&gt;Are You Ready&lt;/track&gt;
        &lt;track duration=&quot;4:30&quot;&gt;Got You by the Balls&lt;/track&gt;
        &lt;track duration=&quot;3:57&quot;&gt;Shot of Love&lt;/track&gt;
        &lt;track duration=&quot;3:32&quot;&gt;Let's Make It&lt;/track&gt;
        &lt;track duration=&quot;3:14&quot;&gt;Goodbye and Good Riddance to Bad Luck&lt;/track&gt;
        &lt;track duration=&quot;3:18&quot;&gt;If You Dare&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Ballbreaker&quot; released=&quot;22 September 1995&quot; label=&quot;Elektra Records&quot;&gt;
        &lt;track duration=&quot;4:31&quot;&gt;Hard as a Rock&lt;/track&gt;
        &lt;track duration=&quot;4:32&quot;&gt;Cover You in Oil&lt;/track&gt;
        &lt;track duration=&quot;4:10&quot;&gt;The Furor&lt;/track&gt;
        &lt;track duration=&quot;4:07&quot;&gt;Boogie Man&lt;/track&gt;
        &lt;track duration=&quot;5:34&quot;&gt;The Honey Roll&lt;/track&gt;
        &lt;track duration=&quot;5:05&quot;&gt;Burnin' Alive&lt;/track&gt;
        &lt;track duration=&quot;5:14&quot;&gt;Hail Caesar&lt;/track&gt;
        &lt;track duration=&quot;3:14&quot;&gt;Love Bomb&lt;/track&gt;
        &lt;track duration=&quot;4:14&quot;&gt;Caught With Your Pants Down&lt;/track&gt;
        &lt;track duration=&quot;4:35&quot;&gt;Whiskey on the Rocks&lt;/track&gt;
        &lt;track duration=&quot;4:31&quot;&gt;Ballbreaker&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Stiff Upper Lip&quot; released=&quot;25 February 2000&quot; label=&quot;Elektra Entertainment&quot;&gt;
        &lt;track duration=&quot;3:34&quot;&gt;Stiff Upper Lip&lt;/track&gt;
        &lt;track duration=&quot;3:41&quot;&gt;Meltdown&lt;/track&gt;
        &lt;track duration=&quot;3:56&quot;&gt;House of Jazz&lt;/track&gt;
        &lt;track duration=&quot;3:59&quot;&gt;Hold Me Back&lt;/track&gt;
        &lt;track duration=&quot;3:59&quot;&gt;Safe in New York City&lt;/track&gt;
        &lt;track duration=&quot;3:41&quot;&gt;Can't Stand Still&lt;/track&gt;
        &lt;track duration=&quot;4:02&quot;&gt;Can't Stop Rock 'n' Rol&lt;/track&gt;
        &lt;track duration=&quot;3:46&quot;&gt;Satellite Blues&lt;/track&gt;
        &lt;track duration=&quot;3:52&quot;&gt;Damned&lt;/track&gt;
        &lt;track duration=&quot;4:02&quot;&gt;Come and Get It&lt;/track&gt;
        &lt;track duration=&quot;4:36&quot;&gt;All Screwed Up&lt;/track&gt;
        &lt;track duration=&quot;3:54&quot;&gt;Give It Up&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Black Ice&quot; released=&quot;20 October 2008&quot; label=&quot;Columbia Records&quot;&gt;
        &lt;track duration=&quot;4:21&quot;&gt;Rock 'N Roll Train&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;Skies on Fire&lt;/track&gt;
        &lt;track duration=&quot;3:57&quot;&gt;Big Jack&lt;/track&gt;
        &lt;track duration=&quot;3:22&quot;&gt;Anything Goes&lt;/track&gt;
        &lt;track duration=&quot;3:09&quot;&gt;War Machine&lt;/track&gt;
        &lt;track duration=&quot;4:06&quot;&gt;Smash 'N Grab&lt;/track&gt;
        &lt;track duration=&quot;3:17&quot;&gt;Spoilin' for a Fight&lt;/track&gt;
        &lt;track duration=&quot;3:28&quot;&gt;Wheels&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;Decibel&lt;/track&gt;
        &lt;track duration=&quot;3:10&quot;&gt;Stormy May Day&lt;/track&gt;
        &lt;track duration=&quot;3:53&quot;&gt;She Likes Rock 'N Roll&lt;/track&gt;
        &lt;track duration=&quot;4:15&quot;&gt;Money Made&lt;/track&gt;
        &lt;track duration=&quot;4:41&quot;&gt;Rock 'N Roll Dream&lt;/track&gt;
        &lt;track duration=&quot;3:22&quot;&gt;Rocking All the Way&lt;/track&gt;
        &lt;track duration=&quot;3:25&quot;&gt;Black Ice&lt;/track&gt;
    &lt;/album&gt;
    &lt;album title=&quot;Iron Man 2&quot; released=&quot;19 April 2010&quot; label=&quot;Columbia Records&quot;&gt;
        &lt;track duration=&quot;5:17&quot;&gt;Shoot to Thrill&lt;/track&gt;
        &lt;track duration=&quot;3:37&quot;&gt;Rock 'n' Roll Damnation&lt;/track&gt;
        &lt;track duration=&quot;3:26&quot;&gt;Guns for Hire&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;Cold Hearted Man&lt;/track&gt;
        &lt;track duration=&quot;4:14&quot;&gt;Back in Black&lt;/track&gt;
        &lt;track duration=&quot;4:53&quot;&gt;Thunderstruck&lt;/track&gt;
        &lt;track duration=&quot;4:37&quot;&gt;If You Want Blood (You've Got It)&lt;/track&gt;
        &lt;track duration=&quot;3:23&quot;&gt;Evil Walks&lt;/track&gt;
        &lt;track duration=&quot;3:34&quot;&gt;T.N.T.&lt;/track&gt;
        &lt;track duration=&quot;4:15&quot;&gt;Hell Ain't a Bad Place to Be&lt;/track&gt;
        &lt;track duration=&quot;3:57&quot;&gt;Have a Drink on Me&lt;/track&gt;
        &lt;track duration=&quot;4:23&quot;&gt;The Razors Edge&lt;/track&gt;
        &lt;track duration=&quot;6:07&quot;&gt;Let There Be Rock&lt;/track&gt;
        &lt;track duration=&quot;3:10&quot;&gt;War Machine&lt;/track&gt;
        &lt;track duration=&quot;3:28&quot;&gt;Highway to Hell&lt;/track&gt;
    &lt;/album&gt;
&lt;/list&gt;</code></pre>

	Tags: <a href="http://englishblog.flepstudio.org/tag/actionscript/" title="actionscript" rel="tag">actionscript</a>, <a href="http://englishblog.flepstudio.org/tag/components/" title="Components" rel="tag">Components</a>, <a href="http://englishblog.flepstudio.org/tag/custom-events/" title="custom events" rel="tag">custom events</a>, <a href="http://englishblog.flepstudio.org/tag/event/" title="Event" rel="tag">Event</a>, <a href="http://englishblog.flepstudio.org/tag/eventdispatcher/" title="EventDispatcher" rel="tag">EventDispatcher</a>, <a href="http://englishblog.flepstudio.org/tag/external-xml/" title="external xml" rel="tag">external xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-and-xml/" title="flex 4 and xml" rel="tag">flex 4 and xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-list-and-datagrid-components/" title="flex 4 list and datagrid components" rel="tag">flex 4 list and datagrid components</a>, <a href="http://englishblog.flepstudio.org/tag/mxml-and-actionscript/" title="mxml and actionscript" rel="tag">mxml and actionscript</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-datachooser-component-of-flex-4/" title="Using DataChooser component of Flex 4 (May 24, 2010)">Using DataChooser component of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datagrid-using-mxml-actionscript-and-external-xml-file/" title="Flex 4 DataGrid using MXML, Actionscript and external XML file (May 22, 2010)">Flex 4 DataGrid using MXML, Actionscript and external XML file</a> (1)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-combobox-mxml-and-external-xml/" title="Flex 4 ComboBox MXML and external XML (May 31, 2010)">Flex 4 ComboBox MXML and external XML</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flash-cs3/sintax/describetype-method-with-custom-events/" title="describeType method with custom events (October 19, 2009)">describeType method with custom events</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/using-numericstepper/" title="Using NumericStepper (October 29, 2007)">Using NumericStepper</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flex-4/using-list-and-datagrid-components-of-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 4 ComboBox MXML and external XML</title>
		<link>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-combobox-mxml-and-external-xml/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-combobox-mxml-and-external-xml/#comments</comments>
		<pubDate>Mon, 31 May 2010 12:33:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[external xml]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[flex 4 and xml]]></category>
		<category><![CDATA[flex 4 combobox]]></category>
		<category><![CDATA[mxml and actionscript]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=802</guid>
		<description><![CDATA[Using Flex 4 ComboBox with MXML, Actionscript 3.0 and external XML file. Main.mxml: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:Application xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/mx&#34; minWidth=&#34;955&#34; minHeight=&#34;600&#34; addedToStage=&#34;init()&#34; pageTitle=&#34;Flex 4 ComboBox Tutorial&#34;&#62; &#60;fx:Script&#62; &#60;![CDATA[ import com.flepstudio.utils.*; import flash.events.*; import mx.collections.ArrayCollection; import mx.controls.*; import mx.events.*; private var XML_PATH:String=&#34;http://flepstudio.org/FlashBuilder/tut_3/XML/list.xml&#34;; private var xmlLoader:XMLLoader; private var xmlData:XML; private var combobox:ComboBox; private var label:Label; private [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fflex-4-combobox-mxml-and-external-xml%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fflex-4-combobox-mxml-and-external-xml%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Using Flex 4 ComboBox with MXML, Actionscript 3.0 and external XML file.</p>
<p><a href="http://flepstudio.org/FlashBuilder/tut_3/tut_3.html" target="_new"><img src="http://flepstudio.org/FlashBuilder/images/demo.png" alt="view demo online" width="226" height="46" border="0"></a></p>
<p>Main.mxml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
               xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
               xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot; addedToStage=&quot;init()&quot; pageTitle=&quot;Flex 4 ComboBox Tutorial&quot;&gt;
    &lt;fx:Script&gt;
        &lt;![CDATA[
            import com.flepstudio.utils.*;
            import flash.events.*;
            import mx.collections.ArrayCollection;
            import mx.controls.*;
            import mx.events.*;

            private var XML_PATH:String=&quot;http://flepstudio.org/FlashBuilder/tut_3/XML/list.xml&quot;;
            private var xmlLoader:XMLLoader;
            private var xmlData:XML;
            private var combobox:ComboBox;
            private var label:Label;
            private var states_array:ArrayCollection=new ArrayCollection();

            private function init():void
            {
                loadXML();
            }

            private function loadXML():void
            {
                xmlLoader=new XMLLoader();
                xmlLoader.addEventListener(CustomEvent.ONLOADED,onXMLLoaded);
                xmlLoader.load(XML_PATH);
            }

            private function onXMLLoaded(evt:CustomEvent):void
            {
                evt.target.removeEventListener(Event.COMPLETE,onXMLLoaded);
                xmlData=new XML(evt.data);

                var states:int=xmlData.state.length();
                for(var i:int=0;i&lt;states;i++)
                {
                    var obj:Object=new Object();
                    obj.label=xmlData.state[i];
                    obj.data=i;
                    states_array.addItemAt(obj,i);
                }

                label=new Label();
                label.width=800;
                label.height=500;
                label.text=&quot;History:&quot;+&quot;\n&quot;;
                combobox=new ComboBox();
                combobox.width=300;
                combobox.rowCount=8;
                combobox.dataProvider=states_array;

                hb1.addChild(combobox);
                hb2.addChild(label);

                combobox.addEventListener(Event.CHANGE,onSelection);
            }

            private function onSelection(evt:Event):void
            {
                label.text+=&quot;You selected: &quot;+evt.target.selectedItem.label+&quot;  &#124;  data: &quot;+evt.target.selectedItem.data+&quot;\n&quot;;
            }
        ]]&gt;
    &lt;/fx:Script&gt;
    &lt;fx:Declarations&gt;
        &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
    &lt;/fx:Declarations&gt;
    &lt;mx:HBox id=&quot;hb1&quot; x=&quot;10&quot; y=&quot;150&quot;/&gt;
    &lt;mx:HBox id=&quot;hb2&quot; x=&quot;10&quot; y=&quot;350&quot;/&gt;
    &lt;mx:Image x=&quot;10&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/53/cats/128/adobe_flex_3_folder.png&quot;/&gt;
    &lt;mx:Image x=&quot;140&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/1757/isabi/128/flash_player.png&quot;/&gt;
&lt;/s:Application&gt;</code></pre>
<p>XMLloader.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;
    import flash.net.*;
    import flash.xml.*

        /**
         * XMLLoader is a ValueObject for the FlepStudio API.
         * This class loads a parses an xml file - no XMLList used
         *
         * @author Filippo Lughi
         * @version Actionscript 3.0
         */
        public class XMLLoader extends EventDispatcher
        {
            private var _file_url:URLRequest;
            private var _file_xml:XML;
            private var _urlLoader:URLLoader;

            /**
             * Construct a new XMLLoader instance
             *
             * @param        .target                IEventDispatcher
             */
            public function XMLLoader(target:IEventDispatcher=null)
            {
                urlLoader=new URLLoader();
                super(target);
            }

            /**
             * The request to load the file
             */
            public function get file_url():URLRequest
            {
                return _file_url;
            }

            public function set file_url(file:URLRequest):void
            {
                _file_url=file;
            }

            /**
             * The XML file
             */
            public function get file_xml():XML
            {
                return _file_xml;
            }

            public function set file_xml(xml:XML):void
            {
                _file_xml=xml;
            }

            /**
             * The loader instance
             */
            public function get urlLoader():URLLoader
            {
                return _urlLoader;
            }

            public function set urlLoader(loader:URLLoader):void
            {
                _urlLoader=loader;
            }

            /**
             * Load the XML file
             *
             * @param        .strFileName                String
             */
            public function load(strFileName:String):void
            {
                file_url=new URLRequest(strFileName);
                urlLoader.load(file_url);
                urlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
            }

            /**
             * Finish loading
             *
             * @param        .evt                Event
             */
            private function onXMLLoaded(evt:Event):void
            {
                urlLoader.removeEventListener(Event.COMPLETE,onXMLLoaded);

                var dataLoader:URLLoader=evt.target as URLLoader;
                file_xml=new XML(dataLoader.data);
                dispatchEvent(new CustomEvent(CustomEvent.ONLOADED,file_xml));

                file_xml=null;
                dataLoader=null;
                urlLoader=null;
            }
        }
}</code></pre>
<p>CustomEvent.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;

    /**
     * CustomEvent is a ValueObject for the FlepStudio API.
     * Working and using custom events with custom constants
     *
     * @author Filippo Lughi
     * @version Actionscript 3.0
     */
    public class CustomEvent extends Event
    {
        private var _data:*;
        public static const ONLOADED:String=&quot;OnLoaded&quot;;

        /**
         * Construct a new CustomEvent instance
         *
         * @param        .type                String
         * @param        .data                *Universal
         */
        public function CustomEvent(type:String,data:*)
        {
            this.data=data;
            super(type);
        }

        /**
         * The data of the CustomEvent
         */
        public function get data():*
        {
            return _data;
        }

        public function set data(d:*):void
        {
            _data=d;
        }
    }
}</code></pre>
<p>External XML file, list.xml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;list&gt;
    &lt;state&gt;AFGHANISTAN&lt;/state&gt;
    &lt;state&gt;ALBANIA&lt;/state&gt;
    &lt;state&gt;ALGERIA&lt;/state&gt;
    &lt;state&gt;AMERICAN SAMOA&lt;/state&gt;
    &lt;state&gt;ANDORRA&lt;/state&gt;
    &lt;state&gt;ANGOLA&lt;/state&gt;
    &lt;state&gt;ANGUILLA&lt;/state&gt;
    &lt;state&gt;ANTARCTICA&lt;/state&gt;
    &lt;state&gt;ANTIGUA AND BARBUDA&lt;/state&gt;
    &lt;state&gt;ARGENTINA&lt;/state&gt;
    &lt;state&gt;ARMENIA&lt;/state&gt;
    &lt;state&gt;ARUBA&lt;/state&gt;
    &lt;state&gt;AUSTRALIA&lt;/state&gt;
    &lt;state&gt;AUSTRIA&lt;/state&gt;
    &lt;state&gt;AZERBAIJAN&lt;/state&gt;
    &lt;state&gt;BAHAMAS&lt;/state&gt;
    &lt;state&gt;BAHRAIN&lt;/state&gt;
    &lt;state&gt;BANGLADESH&lt;/state&gt;
    &lt;state&gt;BARBADOS&lt;/state&gt;
    &lt;state&gt;BELARUS&lt;/state&gt;
    &lt;state&gt;BELGIUM&lt;/state&gt;
    &lt;state&gt;BELIZE&lt;/state&gt;
    &lt;state&gt;BENIN&lt;/state&gt;
    &lt;state&gt;BERMUDA&lt;/state&gt;
    &lt;state&gt;BHUTAN&lt;/state&gt;
    &lt;state&gt;BOLIVIA&lt;/state&gt;
    &lt;state&gt;BOSNIA AND HERZEGOVINA&lt;/state&gt;
    &lt;state&gt;BOTSWANA&lt;/state&gt;
    &lt;state&gt;BOUVET ISLAND&lt;/state&gt;
    &lt;state&gt;BRAZIL&lt;/state&gt;
    &lt;state&gt;BRITISH INDIAN OCEAN TERRITORY&lt;/state&gt;
    &lt;state&gt;BRUNEI DARUSSALAM&lt;/state&gt;
    &lt;state&gt;BULGARIA&lt;/state&gt;
    &lt;state&gt;BURKINA FASO&lt;/state&gt;
    &lt;state&gt;BURUNDI&lt;/state&gt;
    &lt;state&gt;CAMBODIA&lt;/state&gt;
    &lt;state&gt;CAMEROON&lt;/state&gt;
    &lt;state&gt;CANADA&lt;/state&gt;
    &lt;state&gt;CAPE VERDE&lt;/state&gt;
    &lt;state&gt;CAYMAN ISLANDS&lt;/state&gt;
    &lt;state&gt;CENTRAL AFRICAN REPUBLIC&lt;/state&gt;
    &lt;state&gt;CHAD&lt;/state&gt;
    &lt;state&gt;CHILE&lt;/state&gt;
    &lt;state&gt;CHINA&lt;/state&gt;
    &lt;state&gt;CHRISTMAS ISLAND&lt;/state&gt;
    &lt;state&gt;COCOS (KEELING) ISLANDS&lt;/state&gt;
    &lt;state&gt;COLOMBIA&lt;/state&gt;
    &lt;state&gt;COMOROS&lt;/state&gt;
    &lt;state&gt;CONGO&lt;/state&gt;
    &lt;state&gt;CONGO, THE DEMOCRATIC REPUBLIC OF&lt;/state&gt;
    &lt;state&gt;COOK ISLANDS&lt;/state&gt;
    &lt;state&gt;COSTA RICA&lt;/state&gt;
    &lt;state&gt;C&#212;TE D'IVOIRE&lt;/state&gt;
    &lt;state&gt;CROATIA&lt;/state&gt;
    &lt;state&gt;CUBA&lt;/state&gt;
    &lt;state&gt;CYPRUS&lt;/state&gt;
    &lt;state&gt;CZECH REPUBLIC&lt;/state&gt;
    &lt;state&gt;DENMARK&lt;/state&gt;
    &lt;state&gt;DJIBOUTI&lt;/state&gt;
    &lt;state&gt;DOMINICA&lt;/state&gt;
    &lt;state&gt;DOMINICAN REPUBLIC&lt;/state&gt;
    &lt;state&gt;ECUADOR&lt;/state&gt;
    &lt;state&gt;EGYPT&lt;/state&gt;
    &lt;state&gt;EL SALVADOR&lt;/state&gt;
    &lt;state&gt;EQUATORIAL GUINEA&lt;/state&gt;
    &lt;state&gt;ERITREA&lt;/state&gt;
    &lt;state&gt;ESTONIA&lt;/state&gt;
    &lt;state&gt;ETHIOPIA&lt;/state&gt;
    &lt;state&gt;FALKLAND ISLANDS (MALVINAS)&lt;/state&gt;
    &lt;state&gt;FAROE ISLANDS&lt;/state&gt;
    &lt;state&gt;FIJI&lt;/state&gt;
    &lt;state&gt;FINLAND&lt;/state&gt;
    &lt;state&gt;FRANCE&lt;/state&gt;
    &lt;state&gt;FRENCH GUIANA&lt;/state&gt;
    &lt;state&gt;FRENCH POLYNESIA&lt;/state&gt;
    &lt;state&gt;FRENCH SOUTHERN TERRITORIES&lt;/state&gt;
    &lt;state&gt;GABON&lt;/state&gt;
    &lt;state&gt;GAMBIA&lt;/state&gt;
    &lt;state&gt;GEORGIA&lt;/state&gt;
    &lt;state&gt;GERMANY&lt;/state&gt;
    &lt;state&gt;GHANA&lt;/state&gt;
    &lt;state&gt;GIBRALTAR&lt;/state&gt;
    &lt;state&gt;GREECE&lt;/state&gt;
    &lt;state&gt;GREENLAND&lt;/state&gt;
    &lt;state&gt;GRENADA&lt;/state&gt;
    &lt;state&gt;GUADELOUPE&lt;/state&gt;
    &lt;state&gt;GUAM&lt;/state&gt;
    &lt;state&gt;GUATEMALA&lt;/state&gt;
    &lt;state&gt;GUINEA&lt;/state&gt;
    &lt;state&gt;GUINEA-BISSAU&lt;/state&gt;
    &lt;state&gt;GUYANA&lt;/state&gt;
    &lt;state&gt;HAITI&lt;/state&gt;
    &lt;state&gt;HEARD ISLAND AND MCDONALD ISLANDS&lt;/state&gt;
    &lt;state&gt;HOLY SEE (VATICAN CITY STATE)&lt;/state&gt;
    &lt;state&gt;HONDURAS&lt;/state&gt;
    &lt;state&gt;HONG KONG&lt;/state&gt;
    &lt;state&gt;HUNGARY&lt;/state&gt;
    &lt;state&gt;ICELAND&lt;/state&gt;
    &lt;state&gt;INDIA&lt;/state&gt;
    &lt;state&gt;INDONESIA&lt;/state&gt;
    &lt;state&gt;INTERNATIONAL MONETARY FUND (I.M.F)&lt;/state&gt;
    &lt;state&gt;IRAN, ISLAMIC REPUBLIC OF&lt;/state&gt;
    &lt;state&gt;IRAQ&lt;/state&gt;
    &lt;state&gt;IRELAND&lt;/state&gt;
    &lt;state&gt;ISRAEL&lt;/state&gt;
    &lt;state&gt;ITALY&lt;/state&gt;
    &lt;state&gt;JAMAICA&lt;/state&gt;
    &lt;state&gt;JAPAN&lt;/state&gt;
    &lt;state&gt;JORDAN&lt;/state&gt;
    &lt;state&gt;KAZAKHSTAN&lt;/state&gt;
    &lt;state&gt;KENYA&lt;/state&gt;
    &lt;state&gt;KIRIBATI&lt;/state&gt;
    &lt;state&gt;KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF&lt;/state&gt;
    &lt;state&gt;KOREA, REPUBLIC OF&lt;/state&gt;
    &lt;state&gt;KUWAIT&lt;/state&gt;
    &lt;state&gt;KYRGYZSTAN&lt;/state&gt;
    &lt;state&gt;LAO PEOPLE'S DEMOCRATIC REPUBLIC&lt;/state&gt;
    &lt;state&gt;LATVIA&lt;/state&gt;
    &lt;state&gt;LEBANON&lt;/state&gt;
    &lt;state&gt;LESOTHO&lt;/state&gt;
    &lt;state&gt;LIBERIA&lt;/state&gt;
    &lt;state&gt;LIBYAN ARAB JAMAHIRIYA&lt;/state&gt;
    &lt;state&gt;LIECHTENSTEIN&lt;/state&gt;
    &lt;state&gt;LITHUANIA&lt;/state&gt;
    &lt;state&gt;LUXEMBOURG&lt;/state&gt;
    &lt;state&gt;MACAO&lt;/state&gt;
    &lt;state&gt;MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF&lt;/state&gt;
    &lt;state&gt;MADAGASCAR&lt;/state&gt;
    &lt;state&gt;MALAWI&lt;/state&gt;
    &lt;state&gt;MALAYSIA&lt;/state&gt;
    &lt;state&gt;MALDIVES&lt;/state&gt;
    &lt;state&gt;MALI&lt;/state&gt;
    &lt;state&gt;MALTA&lt;/state&gt;
    &lt;state&gt;MARSHALL ISLANDS&lt;/state&gt;
    &lt;state&gt;MARTINIQUE&lt;/state&gt;
    &lt;state&gt;MAURITANIA&lt;/state&gt;
    &lt;state&gt;MAURITIUS&lt;/state&gt;
    &lt;state&gt;MAYOTTE&lt;/state&gt;
    &lt;state&gt;MEXICO&lt;/state&gt;
    &lt;state&gt;MICRONESIA, FEDERATED STATES OF&lt;/state&gt;
    &lt;state&gt;MOLDOVA, REPUBLIC OF&lt;/state&gt;
    &lt;state&gt;MONACO&lt;/state&gt;
    &lt;state&gt;MONGOLIA&lt;/state&gt;
    &lt;state&gt;MONTENEGRO&lt;/state&gt;
    &lt;state&gt;MONTSERRAT&lt;/state&gt;
    &lt;state&gt;MOROCCO&lt;/state&gt;
    &lt;state&gt;MOZAMBIQUE&lt;/state&gt;
    &lt;state&gt;MYANMAR&lt;/state&gt;
    &lt;state&gt;NAMIBIA&lt;/state&gt;
    &lt;state&gt;NAURU&lt;/state&gt;
    &lt;state&gt;NEPAL&lt;/state&gt;
    &lt;state&gt;NETHERLANDS&lt;/state&gt;
    &lt;state&gt;NETHERLANDS ANTILLES&lt;/state&gt;
    &lt;state&gt;NEW CALEDONIA&lt;/state&gt;
    &lt;state&gt;NEW ZEALAND&lt;/state&gt;
    &lt;state&gt;NICARAGUA&lt;/state&gt;
    &lt;state&gt;NIGER&lt;/state&gt;
    &lt;state&gt;NIGERIA&lt;/state&gt;
    &lt;state&gt;NIUE&lt;/state&gt;
    &lt;state&gt;NORFOLK ISLAND&lt;/state&gt;
    &lt;state&gt;NORTHERN MARIANA ISLANDS&lt;/state&gt;
    &lt;state&gt;NORWAY&lt;/state&gt;
    &lt;state&gt;OMAN&lt;/state&gt;
    &lt;state&gt;PAKISTAN&lt;/state&gt;
    &lt;state&gt;PALAU&lt;/state&gt;
    &lt;state&gt;PANAMA&lt;/state&gt;
    &lt;state&gt;PAPUA NEW GUINEA&lt;/state&gt;
    &lt;state&gt;PARAGUAY&lt;/state&gt;
    &lt;state&gt;PERU&lt;/state&gt;
    &lt;state&gt;PHILIPPINES&lt;/state&gt;
    &lt;state&gt;PITCAIRN&lt;/state&gt;
    &lt;state&gt;POLAND&lt;/state&gt;
    &lt;state&gt;PORTUGAL&lt;/state&gt;
    &lt;state&gt;PUERTO RICO&lt;/state&gt;
    &lt;state&gt;QATAR&lt;/state&gt;
    &lt;state&gt;R&#201;UNION&lt;/state&gt;
    &lt;state&gt;ROMANIA&lt;/state&gt;
    &lt;state&gt;RUSSIAN FEDERATION&lt;/state&gt;
    &lt;state&gt;RWANDA&lt;/state&gt;
    &lt;state&gt;SAINT HELENA&lt;/state&gt;
    &lt;state&gt;SAINT KITTS AND NEVIS&lt;/state&gt;
    &lt;state&gt;SAINT LUCIA&lt;/state&gt;
    &lt;state&gt;SAINT PIERRE AND MIQUELON&lt;/state&gt;
    &lt;state&gt;SAINT VINCENT AND THE GRENADINES&lt;/state&gt;
    &lt;state&gt;SAMOA&lt;/state&gt;
    &lt;state&gt;SAN MARINO&lt;/state&gt;
    &lt;state&gt;SAO TOME AND PRINCIPE&lt;/state&gt;
    &lt;state&gt;SAUDI ARABIA&lt;/state&gt;
    &lt;state&gt;SENEGAL&lt;/state&gt;
    &lt;state&gt;SERBIA&lt;/state&gt;
    &lt;state&gt;SEYCHELLES&lt;/state&gt;
    &lt;state&gt;SIERRA LEONE&lt;/state&gt;
    &lt;state&gt;SINGAPORE&lt;/state&gt;
    &lt;state&gt;SLOVAKIA&lt;/state&gt;
    &lt;state&gt;SLOVENIA&lt;/state&gt;
    &lt;state&gt;SOLOMON ISLANDS&lt;/state&gt;
    &lt;state&gt;SOMALIA&lt;/state&gt;
    &lt;state&gt;SOUTH AFRICA&lt;/state&gt;
    &lt;state&gt;SPAIN&lt;/state&gt;
    &lt;state&gt;SRI LANKA&lt;/state&gt;
    &lt;state&gt;SUDAN&lt;/state&gt;
    &lt;state&gt;SURINAME&lt;/state&gt;
    &lt;state&gt;SVALBARD AND JAN MAYEN&lt;/state&gt;
    &lt;state&gt;SWAZILAND&lt;/state&gt;
    &lt;state&gt;SWEDEN&lt;/state&gt;
    &lt;state&gt;SWITZERLAND&lt;/state&gt;
    &lt;state&gt;SYRIAN ARAB REPUBLIC&lt;/state&gt;
    &lt;state&gt;TAIWAN, PROVINCE OF CHINA&lt;/state&gt;
    &lt;state&gt;TAJIKISTAN&lt;/state&gt;
    &lt;state&gt;TANZANIA, UNITED REPUBLIC OF&lt;/state&gt;
    &lt;state&gt;THAILAND&lt;/state&gt;
    &lt;state&gt;TIMOR-LESTE&lt;/state&gt;
    &lt;state&gt;TOGO&lt;/state&gt;
    &lt;state&gt;TOKELAU&lt;/state&gt;
    &lt;state&gt;TONGA&lt;/state&gt;
    &lt;state&gt;TRINIDAD AND TOBAGO&lt;/state&gt;
    &lt;state&gt;TUNISIA&lt;/state&gt;
    &lt;state&gt;TURKEY&lt;/state&gt;
    &lt;state&gt;TURKMENISTAN&lt;/state&gt;
    &lt;state&gt;TURKS AND CAICOS ISLANDS&lt;/state&gt;
    &lt;state&gt;TUVALU&lt;/state&gt;
    &lt;state&gt;UGANDA&lt;/state&gt;
    &lt;state&gt;UKRAINE&lt;/state&gt;
    &lt;state&gt;UNITED ARAB EMIRATES&lt;/state&gt;
    &lt;state&gt;UNITED KINGDOM&lt;/state&gt;
    &lt;state&gt;UNITED STATES&lt;/state&gt;
    &lt;state&gt;UNITED STATES MINOR OUTLYING ISLAND&lt;/state&gt;
    &lt;state&gt;URUGUAY&lt;/state&gt;
    &lt;state&gt;UZBEKISTAN&lt;/state&gt;
    &lt;state&gt;VANUATU&lt;/state&gt;
    &lt;state&gt;VENEZUELA&lt;/state&gt;
    &lt;state&gt;VIET NAM&lt;/state&gt;
    &lt;state&gt;VIRGIN ISLANDS (BRITISH)&lt;/state&gt;
    &lt;state&gt;VIRGIN ISLANDS (U.S.)&lt;/state&gt;
    &lt;state&gt;WALLIS AND FUTUNA&lt;/state&gt;
    &lt;state&gt;WESTERN SAHARA&lt;/state&gt;
    &lt;state&gt;YEMEN&lt;/state&gt;
    &lt;state&gt;ZAMBIA&lt;/state&gt;
    &lt;state&gt;ZIMBABWE&lt;/state&gt;
&lt;/list&gt;
</code></pre>

	Tags: <a href="http://englishblog.flepstudio.org/tag/external-xml/" title="external xml" rel="tag">external xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex/" title="flex" rel="tag">flex</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-and-xml/" title="flex 4 and xml" rel="tag">flex 4 and xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-combobox/" title="flex 4 combobox" rel="tag">flex 4 combobox</a>, <a href="http://englishblog.flepstudio.org/tag/mxml-and-actionscript/" title="mxml and actionscript" rel="tag">mxml and actionscript</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-datachooser-component-of-flex-4/" title="Using DataChooser component of Flex 4 (May 24, 2010)">Using DataChooser component of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-list-and-datagrid-components-of-flex-4/" title="Using List and DataGrid components of Flex 4 (July 2, 2010)">Using List and DataGrid components of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datefield-component-and-xml/" title="Flex 4 DateField component and XML (August 9, 2010)">Flex 4 DateField component and XML</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datagrid-using-mxml-actionscript-and-external-xml-file/" title="Flex 4 DataGrid using MXML, Actionscript and external XML file (May 22, 2010)">Flex 4 DataGrid using MXML, Actionscript and external XML file</a> (1)</li>
	<li><a href="http://englishblog.flepstudio.org/news/video-improvements/" title="Video improvements (May 1, 2007)">Video improvements</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-combobox-mxml-and-external-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using DataChooser component of Flex 4</title>
		<link>http://englishblog.flepstudio.org/tutorials/flex-4/using-datachooser-component-of-flex-4/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flex-4/using-datachooser-component-of-flex-4/#comments</comments>
		<pubDate>Mon, 24 May 2010 13:07:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[custom events]]></category>
		<category><![CDATA[EventDispatcher]]></category>
		<category><![CDATA[external xml]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[flex 4 and xml]]></category>
		<category><![CDATA[flex 4 datechooser]]></category>
		<category><![CDATA[mxml and actionscript]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=794</guid>
		<description><![CDATA[Using DataChooser component of Flex 4 with MXML, Actionscript 3.0 and external XML file. Main.mxml: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:Application xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/mx&#34; minWidth=&#34;955&#34; minHeight=&#34;600&#34; addedToStage=&#34;init()&#34; pageTitle=&#34;Flex 4 DataChooser Tutorial&#34;&#62; &#60;fx:Script&#62; &#60;![CDATA[ import com.flepstudio.utils.*; import flash.events.*; import mx.controls.*; import mx.events.*; private var XML_PATH:String=&#34;http://flepstudio.org/FlashBuilder/tut_2/XML/list.xml&#34;; private var xmlLoader:XMLLoader; private var xmlData:XML; private var date_chooser:DateChooser; private var label:Label; private [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fusing-datachooser-component-of-flex-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fusing-datachooser-component-of-flex-4%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Using DataChooser component of Flex 4 with MXML, Actionscript 3.0 and external XML file.</p>
<p><a href="http://flepstudio.org/FlashBuilder/tut_2/tut_2.html" target="_new"><img src="http://flepstudio.org/FlashBuilder/images/demo.png" alt="view demo online" width="226" height="46" border="0"></a></p>
<p>Main.mxml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
               xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
               xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot; addedToStage=&quot;init()&quot; pageTitle=&quot;Flex 4 DataChooser Tutorial&quot;&gt;
    &lt;fx:Script&gt;
        &lt;![CDATA[
            import com.flepstudio.utils.*;
            import flash.events.*;
            import mx.controls.*;
            import mx.events.*;

            private var XML_PATH:String=&quot;http://flepstudio.org/FlashBuilder/tut_2/XML/list.xml&quot;;
            private var xmlLoader:XMLLoader;
            private var xmlData:XML;
            private var date_chooser:DateChooser;
            private var label:Label;
            private var months_array:Array=new Array();

            private function init():void
            {
                loadXML();
            }

            private function loadXML():void
            {
                xmlLoader=new XMLLoader();
                xmlLoader.addEventListener(CustomEvent.ONLOADED,onXMLLoaded);
                xmlLoader.load(XML_PATH);
            }

            private function onXMLLoaded(evt:CustomEvent):void
            {
                evt.target.removeEventListener(Event.COMPLETE,onXMLLoaded);
                xmlData=new XML(evt.data);

                var months:int=xmlData.month.length();
                for(var i:int=0;i&lt;months;i++)
                {
                    months_array.push(xmlData.month[i].@name);
                }

                label=new Label();
                label.width=800;
                label.height=500;
                label.text=&quot;History:&quot;+&quot;\n&quot;;
                date_chooser=new DateChooser();
                date_chooser.addEventListener(Event.CHANGE,onDateChange);
                date_chooser.addEventListener(DateChooserEvent.SCROLL,onMonthChange);

                hb1.addChild(date_chooser);
                hb2.addChild(label);
            }

            private function onDateChange(evt:Event):void
            {
                label.text+=evt.target.selectedDate+&quot;\n&quot;;
            }

            private function onMonthChange(evt:DateChooserEvent):void
            {
                var month:int=evt.target.displayedMonth;
                label.text+=&quot;Scrolling months: &quot;+months_array[month]+&quot;  &quot;+evt.target.displayedYear+&quot;\n&quot;;
            }
        ]]&gt;
    &lt;/fx:Script&gt;
    &lt;fx:Declarations&gt;
        &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
    &lt;/fx:Declarations&gt;
    &lt;mx:HBox id=&quot;hb1&quot; x=&quot;10&quot; y=&quot;150&quot;/&gt;
    &lt;mx:HBox id=&quot;hb2&quot; x=&quot;10&quot; y=&quot;350&quot;/&gt;
    &lt;mx:Image x=&quot;10&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/53/cats/128/adobe_flex_3_folder.png&quot;/&gt;
    &lt;mx:Image x=&quot;140&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/1757/isabi/128/flash_player.png&quot;/&gt;
&lt;/s:Application&gt;</code></pre>
<p>XMLloader.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;
    import flash.net.*;
    import flash.xml.*

        /**
         * XMLLoader is a ValueObject for the FlepStudio API.
         * This class loads a parses an xml file - no XMLList used
         *
         * @author Filippo Lughi
         * @version Actionscript 3.0
         */
        public class XMLLoader extends EventDispatcher
        {
            private var _file_url:URLRequest;
            private var _file_xml:XML;
            private var _urlLoader:URLLoader;

            /**
             * Construct a new XMLLoader instance
             *
             * @param        .target                IEventDispatcher
             */
            public function XMLLoader(target:IEventDispatcher=null)
            {
                urlLoader=new URLLoader();
                super(target);
            }

            /**
             * The request to load the file
             */
            public function get file_url():URLRequest
            {
                return _file_url;
            }

            public function set file_url(file:URLRequest):void
            {
                _file_url=file;
            }

            /**
             * The XML file
             */
            public function get file_xml():XML
            {
                return _file_xml;
            }

            public function set file_xml(xml:XML):void
            {
                _file_xml=xml;
            }

            /**
             * The loader instance
             */
            public function get urlLoader():URLLoader
            {
                return _urlLoader;
            }

            public function set urlLoader(loader:URLLoader):void
            {
                _urlLoader=loader;
            }

            /**
             * Load the XML file
             *
             * @param        .strFileName                String
             */
            public function load(strFileName:String):void
            {
                file_url=new URLRequest(strFileName);
                urlLoader.load(file_url);
                urlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
            }

            /**
             * Finish loading
             *
             * @param        .evt                Event
             */
            private function onXMLLoaded(evt:Event):void
            {
                urlLoader.removeEventListener(Event.COMPLETE,onXMLLoaded);

                var dataLoader:URLLoader=evt.target as URLLoader;
                file_xml=new XML(dataLoader.data);
                dispatchEvent(new CustomEvent(CustomEvent.ONLOADED,file_xml));

                file_xml=null;
                dataLoader=null;
                urlLoader=null;
            }
        }
}</code></pre>
<p>CustomEvent.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;

    /**
     * CustomEvent is a ValueObject for the FlepStudio API.
     * Working and using custom events with custom constants
     *
     * @author Filippo Lughi
     * @version Actionscript 3.0
     */
    public class CustomEvent extends Event
    {
        private var _data:*;
        public static const ONLOADED:String=&quot;OnLoaded&quot;;

        /**
         * Construct a new CustomEvent instance
         *
         * @param        .type                String
         * @param        .data                *Universal
         */
        public function CustomEvent(type:String,data:*)
        {
            this.data=data;
            super(type);
        }

        /**
         * The data of the CustomEvent
         */
        public function get data():*
        {
            return _data;
        }

        public function set data(d:*):void
        {
            _data=d;
        }
    }
}</code></pre>
<p>External XML file, list.xml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;list&gt;
    &lt;month name=&quot;January&quot;/&gt;
    &lt;month name=&quot;February&quot;/&gt;
    &lt;month name=&quot;March&quot;/&gt;
    &lt;month name=&quot;April&quot;/&gt;
    &lt;month name=&quot;May&quot;/&gt;
    &lt;month name=&quot;June&quot;/&gt;
    &lt;month name=&quot;July&quot;/&gt;
    &lt;month name=&quot;August&quot;/&gt;
    &lt;month name=&quot;September&quot;/&gt;
    &lt;month name=&quot;October&quot;/&gt;
    &lt;month name=&quot;November&quot;/&gt;
    &lt;month name=&quot;December&quot;/&gt;
&lt;/list&gt;</code></pre>

	Tags: <a href="http://englishblog.flepstudio.org/tag/array/" title="Array" rel="tag">Array</a>, <a href="http://englishblog.flepstudio.org/tag/custom-events/" title="custom events" rel="tag">custom events</a>, <a href="http://englishblog.flepstudio.org/tag/eventdispatcher/" title="EventDispatcher" rel="tag">EventDispatcher</a>, <a href="http://englishblog.flepstudio.org/tag/external-xml/" title="external xml" rel="tag">external xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex/" title="flex" rel="tag">flex</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-and-xml/" title="flex 4 and xml" rel="tag">flex 4 and xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-datechooser/" title="flex 4 datechooser" rel="tag">flex 4 datechooser</a>, <a href="http://englishblog.flepstudio.org/tag/mxml-and-actionscript/" title="mxml and actionscript" rel="tag">mxml and actionscript</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-list-and-datagrid-components-of-flex-4/" title="Using List and DataGrid components of Flex 4 (July 2, 2010)">Using List and DataGrid components of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datagrid-using-mxml-actionscript-and-external-xml-file/" title="Flex 4 DataGrid using MXML, Actionscript and external XML file (May 22, 2010)">Flex 4 DataGrid using MXML, Actionscript and external XML file</a> (1)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-combobox-mxml-and-external-xml/" title="Flex 4 ComboBox MXML and external XML (May 31, 2010)">Flex 4 ComboBox MXML and external XML</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datefield-component-and-xml/" title="Flex 4 DateField component and XML (August 9, 2010)">Flex 4 DateField component and XML</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flash-cs3/sintax/describetype-method-with-custom-events/" title="describeType method with custom events (October 19, 2009)">describeType method with custom events</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flex-4/using-datachooser-component-of-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 4 DataGrid using MXML, Actionscript and external XML file</title>
		<link>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datagrid-using-mxml-actionscript-and-external-xml-file/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datagrid-using-mxml-actionscript-and-external-xml-file/#comments</comments>
		<pubDate>Sat, 22 May 2010 06:28:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[custom events]]></category>
		<category><![CDATA[EventDispatcher]]></category>
		<category><![CDATA[external xml]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[loader]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=789</guid>
		<description><![CDATA[How to populate a DataGrid component for Flex 4 with MXML, Actionscript 3.0 and external XML file. Main.mxml: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:Application xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/mx&#34; minWidth=&#34;955&#34; minHeight=&#34;600&#34; addedToStage=&#34;init()&#34;&#62; &#60;fx:Script&#62; &#60;![CDATA[ import com.flepstudio.utils.*; import flash.events.*; import mx.controls.*; import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn; import mx.events.*; private var XML_PATH:String=&#34;http://flepstudio.org/FlashBuilder/tut_1/XML/list.xml&#34;; private var xmlLoader:XMLLoader; private var xmlData:XML; private var label:Label; private var datagrid:DataGrid; [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fflex-4-datagrid-using-mxml-actionscript-and-external-xml-file%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fflex-4-datagrid-using-mxml-actionscript-and-external-xml-file%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>How to populate a DataGrid component for Flex 4 with MXML, Actionscript 3.0 and external XML file.</p>
<p><a href="http://flepstudio.org/FlashBuilder/tut_1/tut_1.html" target="_new"><img src="http://flepstudio.org/FlashBuilder/images/demo.png" alt="view demo online" width="226" height="46" border="0"></a></p>
<p>Main.mxml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
               xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
               xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot; addedToStage=&quot;init()&quot;&gt;
    &lt;fx:Script&gt;
        &lt;![CDATA[
            import com.flepstudio.utils.*;
            import flash.events.*;
            import mx.controls.*;
            import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
            import mx.events.*;

            private var XML_PATH:String=&quot;http://flepstudio.org/FlashBuilder/tut_1/XML/list.xml&quot;;

            private var xmlLoader:XMLLoader;
            private var xmlData:XML;

            private var label:Label;
            private var datagrid:DataGrid;
            private var clients_array:Array=new Array();

            private function init():void
            {
                loadXML();
            }

            private function loadXML():void
            {
                xmlLoader=new XMLLoader();
                xmlLoader.addEventListener(CustomEvent.ONLOADED,onXMLLoaded);
                xmlLoader.load(XML_PATH);
            }

            private function onXMLLoaded(evt:CustomEvent):void
            {
                evt.target.removeEventListener(Event.COMPLETE,onXMLLoaded);
                xmlData=new XML(evt.data);

                label=new Label();

                var clients:int=xmlData.client.length();
                for(var i:int=0;i&lt;clients;i++)
                {
                    var obj:Object=new Object();
                    obj.id=i;
                    obj.name=xmlData.client[i].@name;
                    obj.surname=xmlData.client[i].@surname;
                    obj.address=xmlData.client[i].@address;
                    obj.zip=xmlData.client[i].@zip;
                    obj.state=xmlData.client[i].@state;
                    obj.email=xmlData.client[i].@email;
                    clients_array.push(obj);
                }

                datagrid=new DataGrid();
                datagrid.dataProvider=clients_array;
                datagrid.width=900;
                datagrid.selectedIndex=0;

                hb1.addChild(datagrid);

                label.selectable=false;
                label.width=900;
                label.height=170;
                hb2.addChild(label);

                showText(clients_array[0]);

                datagrid.addEventListener(ListEvent.ITEM_CLICK,onItemClick);
            }

            private function onItemClick(evt:ListEvent):void
            {
                var obj:Object=evt.target.selectedItem;
                showText(obj);
            }

            private function showText(obj:Object):void
            {
                label.htmlText=&quot;ID &quot;+obj.id+&quot;\n&quot;+&quot;My name is &quot;+&quot;&lt;b&gt;&quot;+obj.name+&quot; &quot;+obj.surname+&quot;&lt;/b&gt;&quot;+&quot;\n&quot;+&quot;I live in &quot;+&quot;&lt;b&gt;&quot;+obj.address+&quot;&lt;/b&gt;&quot;+&quot;\n&quot;+&quot;&lt;b&gt;&quot;+obj.zip+&quot;&lt;/b&gt;&quot;+&quot; - &quot;+&quot;&lt;b&gt;&quot;+obj.state+&quot;&lt;/b&gt;&quot;+&quot;\n&quot;+&quot;My e-mail address is &quot;+&quot;&lt;b&gt;&quot;+obj.email+&quot;&lt;/b&gt;&quot;;
            }

        ]]&gt;
    &lt;/fx:Script&gt;
    &lt;fx:Declarations&gt;
        &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
    &lt;/fx:Declarations&gt;
    &lt;mx:HBox id=&quot;hb1&quot; x=&quot;10&quot; y=&quot;150&quot;/&gt;
    &lt;mx:HBox id=&quot;hb2&quot; x=&quot;10&quot; y=&quot;350&quot;/&gt;
    &lt;mx:Image x=&quot;10&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/53/cats/128/adobe_flex_3_folder.png&quot;/&gt;
    &lt;mx:Image x=&quot;140&quot; y=&quot;10&quot; source=&quot;http://png-images.findicons.com/files/icons/1757/isabi/128/flash_player.png&quot;/&gt;
&lt;/s:Application&gt;</code></pre>
<p>XMLloader.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;
    import flash.net.*;
    import flash.xml.*

        /**
         * XMLLoader is a ValueObject for the FlepStudio API.
         * This class loads a parses an xml file - no XMLList used
         *
         * @author Filippo Lughi
         * @version Actionscript 3.0
         */
        public class XMLLoader extends EventDispatcher
        {
            private var _file_url:URLRequest;
            private var _file_xml:XML;
            private var _urlLoader:URLLoader;

            /**
             * Construct a new XMLLoader instance
             *
             * @param        .target                IEventDispatcher
             */
            public function XMLLoader(target:IEventDispatcher=null)
            {
                urlLoader=new URLLoader();
                super(target);
            }

            /**
             * The request to load the file
             */
            public function get file_url():URLRequest
            {
                return _file_url;
            }

            public function set file_url(file:URLRequest):void
            {
                _file_url=file;
            }

            /**
             * The XML file
             */
            public function get file_xml():XML
            {
                return _file_xml;
            }

            public function set file_xml(xml:XML):void
            {
                _file_xml=xml;
            }

            /**
             * The loader instance
             */
            public function get urlLoader():URLLoader
            {
                return _urlLoader;
            }

            public function set urlLoader(loader:URLLoader):void
            {
                _urlLoader=loader;
            }

            /**
             * Load the XML file
             *
             * @param        .strFileName                String
             */
            public function load(strFileName:String):void
            {
                file_url=new URLRequest(strFileName);
                urlLoader.load(file_url);
                urlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
            }

            /**
             * Finish loading
             *
             * @param        .evt                Event
             */
            private function onXMLLoaded(evt:Event):void
            {
                urlLoader.removeEventListener(Event.COMPLETE,onXMLLoaded);

                var dataLoader:URLLoader=evt.target as URLLoader;
                file_xml=new XML(dataLoader.data);
                dispatchEvent(new CustomEvent(CustomEvent.ONLOADED,file_xml));

                file_xml=null;
                dataLoader=null;
                urlLoader=null;
            }
        }
}</code></pre>
<p>CustomEvent.as:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package com.flepstudio.utils
{
    import flash.events.*;

    /**
     * CustomEvent is a ValueObject for the FlepStudio API.
     * Working and using custom events with custom constants
     *
     * @author Filippo Lughi
     * @version Actionscript 3.0
     */
    public class CustomEvent extends Event
    {
        private var _data:*;
        public static const ONLOADED:String=&quot;OnLoaded&quot;;

        /**
         * Construct a new CustomEvent instance
         *
         * @param        .type                String
         * @param        .data                *Universal
         */
        public function CustomEvent(type:String,data:*)
        {
            this.data=data;
            super(type);
        }

        /**
         * The data of the CustomEvent
         */
        public function get data():*
        {
            return _data;
        }

        public function set data(d:*):void
        {
            _data=d;
        }
    }
}</code></pre>
<p>External XML file, list.xml:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;list&gt;
    &lt;client name=&quot;clientname1&quot; surname=&quot;clientsurname1&quot; address=&quot;addressclient1&quot; zip=&quot;zipclient1&quot; state=&quot;stateclient1&quot; email=&quot;email@client1.com&quot;/&gt;
    &lt;client name=&quot;clientname2&quot; surname=&quot;clientsurname2&quot; address=&quot;addressclient2&quot; zip=&quot;zipclient2&quot; state=&quot;stateclient2&quot; email=&quot;email@client2.com&quot;/&gt;
    &lt;client name=&quot;clientname3&quot; surname=&quot;clientsurname3&quot; address=&quot;addressclient3&quot; zip=&quot;zipclient3&quot; state=&quot;stateclient3&quot; email=&quot;email@client3.com&quot;/&gt;
    &lt;client name=&quot;clientname4&quot; surname=&quot;clientsurname4&quot; address=&quot;addressclient4&quot; zip=&quot;zipclient4&quot; state=&quot;stateclient4&quot; email=&quot;email@client4.com&quot;/&gt;
    &lt;client name=&quot;clientname5&quot; surname=&quot;clientsurname5&quot; address=&quot;addressclient5&quot; zip=&quot;zipclient5&quot; state=&quot;stateclient5&quot; email=&quot;email@client5.com&quot;/&gt;
    &lt;client name=&quot;clientname6&quot; surname=&quot;clientsurname6&quot; address=&quot;addressclient6&quot; zip=&quot;zipclient6&quot; state=&quot;stateclient6&quot; email=&quot;email@client6.com&quot;/&gt;
    &lt;client name=&quot;clientname7&quot; surname=&quot;clientsurname7&quot; address=&quot;addressclient7&quot; zip=&quot;zipclient7&quot; state=&quot;stateclient7&quot; email=&quot;email@client7.com&quot;/&gt;
    &lt;client name=&quot;clientname8&quot; surname=&quot;clientsurname8&quot; address=&quot;addressclient8&quot; zip=&quot;zipclient8&quot; state=&quot;stateclient8&quot; email=&quot;email@client8.com&quot;/&gt;
    &lt;client name=&quot;clientname9&quot; surname=&quot;clientsurname9&quot; address=&quot;addressclient9&quot; zip=&quot;zipclient9&quot; state=&quot;stateclient9&quot; email=&quot;email@client9.com&quot;/&gt;
    &lt;client name=&quot;clientname10&quot; surname=&quot;clientsurname10&quot; address=&quot;addressclient10&quot; zip=&quot;zipclient10&quot; state=&quot;stateclient10&quot; email=&quot;email@client10.com&quot;/&gt;
&lt;/list&gt;</code></pre>

	Tags: <a href="http://englishblog.flepstudio.org/tag/actionscript/" title="actionscript" rel="tag">actionscript</a>, <a href="http://englishblog.flepstudio.org/tag/advanced/" title="advanced" rel="tag">advanced</a>, <a href="http://englishblog.flepstudio.org/tag/array/" title="Array" rel="tag">Array</a>, <a href="http://englishblog.flepstudio.org/tag/custom-events/" title="custom events" rel="tag">custom events</a>, <a href="http://englishblog.flepstudio.org/tag/eventdispatcher/" title="EventDispatcher" rel="tag">EventDispatcher</a>, <a href="http://englishblog.flepstudio.org/tag/external-xml/" title="external xml" rel="tag">external xml</a>, <a href="http://englishblog.flepstudio.org/tag/flex/" title="flex" rel="tag">flex</a>, <a href="http://englishblog.flepstudio.org/tag/loader/" title="loader" rel="tag">loader</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-datachooser-component-of-flex-4/" title="Using DataChooser component of Flex 4 (May 24, 2010)">Using DataChooser component of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flex-4/using-list-and-datagrid-components-of-flex-4/" title="Using List and DataGrid components of Flex 4 (July 2, 2010)">Using List and DataGrid components of Flex 4</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/preloading/" title="Preloading (June 1, 2007)">Preloading</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/free-utilities/uploader/" title="Uploader (July 31, 2007)">Uploader</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/rotation-of-coordinates-and-collision-with-an-angled-surface/" title="Rotation of coordinates and collision with an angled surface (November 27, 2007)">Rotation of coordinates and collision with an angled surface</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flex-4/flex-4-datagrid-using-mxml-actionscript-and-external-xml-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connecting Flex 4 and Zend using Flash Builder 4</title>
		<link>http://englishblog.flepstudio.org/tutorials/flex-4/connecting-flex-4-and-zend-using-flash-builder-4/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flex-4/connecting-flex-4-and-zend-using-flash-builder-4/#comments</comments>
		<pubDate>Thu, 20 May 2010 05:07:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[flash and zend]]></category>
		<category><![CDATA[flash builder 4 and zend]]></category>
		<category><![CDATA[flex 4 and zend]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=785</guid>
		<description><![CDATA[With the release of Flash Builder 4, Adobe and Zend have greatly improved the integration between Flex and the Zend PHP framework. The primary key of this collaboration is the integration of Action Message Format (AMF) supported by Zend Framework. AMF is an open format, high-speed rail that allows the Flash Player (Flash, Flex, Air) [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fconnecting-flex-4-and-zend-using-flash-builder-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflex-4%2Fconnecting-flex-4-and-zend-using-flash-builder-4%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>With the release of Flash Builder 4, Adobe and Zend have greatly improved the <strong>integration between Flex and the Zend PHP framework</strong>. </p>
<p>The primary key of this collaboration is the integration of Action Message Format (<strong>AMF</strong>) supported by Zend Framework. <br />
  AMF is an open format, high-speed rail that <strong>allows the Flash Player</strong> (Flash, Flex, Air) <strong>to exchange multimedia content and other data  with servers</strong>. <br />
  Flex is a highly productive free open source framework for building and maintaining web applications that run in all major browsers and operating systems using Adobe ® Flash ® Player and desktop applications using Adobe ® AIR ™. <br />
  Zend Framework is an open source PHP framework best known for its support for flexible, efficient creation of web applications. <br />
  AMF support in Zend Framework optimizes the communication between the server side (Zend Framework) components and client-side Adobe Flex. <br />
  Now Flash and Flex developers will be able to exploit the fast and reliable transfer of data between servers and clients.<br />
More information about AMF support is available at <a href="http://framework.zend.com">http://framework.zend.com</a> and <a href="http://developer.adobe.com/flex/">http://developer.adobe.com/flex/</a></p>
<p>This tutorial explains how to create a connection between Flex and Zend and maintain data exchange.</p>
<p>Requirements:</p>
<ul>
<li><a href="http://www.jdoqocy.com/click-3268277-10772054" target="_top">Adobe Flash Builder 4</a><img src="http://www.ftjcfx.com/image-3268277-10772054" width="1" height="1" border="0"/></li>
<li><a href="http://framework.zend.com/releases/ZendFramework-1.10.4/ZendFramework-1.10.4.zip">Zend Framework</a></li>
<li><a href="http://www.mamp.info/en/index.html">MAMP</a> ( for MAC users ) or <a href="http://www.wampserver.com/en/">WAMP</a> ( for windows users ) or have already installed on your machine mySQL, PHP and Apache.</li>
</ul>
<p align="right"><strong><a href="http://www.flepstudio.org/forum/flex-builder-3-eng/6089-connecting-flex-4-zend-using-flash-builder-4-a.html" title="read the tutorial">Read more&#8230;</a></strong></p>

	Tags: <a href="http://englishblog.flepstudio.org/tag/flash-and-zend/" title="flash and zend" rel="tag">flash and zend</a>, <a href="http://englishblog.flepstudio.org/tag/flash-builder-4-and-zend/" title="flash builder 4 and zend" rel="tag">flash builder 4 and zend</a>, <a href="http://englishblog.flepstudio.org/tag/flex-4-and-zend/" title="flex 4 and zend" rel="tag">flex 4 and zend</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flex-4/connecting-flex-4-and-zend-using-flash-builder-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom gradients using Actionscript 3.0</title>
		<link>http://englishblog.flepstudio.org/tutorials/flash-cs3/drawing-with-actionscript-3/custom-gradients-using-actionscript-3-0/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flash-cs3/drawing-with-actionscript-3/custom-gradients-using-actionscript-3-0/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 07:38:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drawing with Actionscript 3]]></category>
		<category><![CDATA[actionscript gradients]]></category>
		<category><![CDATA[drawing with actionscript]]></category>
		<category><![CDATA[drawing with flash]]></category>
		<category><![CDATA[flash gradients]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=764</guid>
		<description><![CDATA[This example shows how to create custom gradients with Actionscript 3.0: Read more&#8230; Tags: actionscript gradients, drawing with actionscript, drawing with flash, flash gradients Related posts No related posts.]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs3%2Fdrawing-with-actionscript-3%2Fcustom-gradients-using-actionscript-3-0%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs3%2Fdrawing-with-actionscript-3%2Fcustom-gradients-using-actionscript-3-0%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This example shows how to create custom gradients with  Actionscript 3.0:</p>
<p>
  <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" name="obj1" width="550" height="400" border="0" id="obj1"><param name="movie" value="http://flepstudio.org/swf/disegnare/CustomGradients/main.swf" /><param name="quality" value="High" /><embed src="http://flepstudio.org/swf/disegnare/CustomGradients/main.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="550" height="400"></embed></object>
</p>
<p align="right"><strong><a href="http://www.flepstudio.org/forum/tutorials/5991-custom-gradients.html" title="view code">Read more&#8230;</a></strong></p>

	Tags: <a href="http://englishblog.flepstudio.org/tag/actionscript-gradients/" title="actionscript gradients" rel="tag">actionscript gradients</a>, <a href="http://englishblog.flepstudio.org/tag/drawing-with-actionscript/" title="drawing with actionscript" rel="tag">drawing with actionscript</a>, <a href="http://englishblog.flepstudio.org/tag/drawing-with-flash/" title="drawing with flash" rel="tag">drawing with flash</a>, <a href="http://englishblog.flepstudio.org/tag/flash-gradients/" title="flash gradients" rel="tag">flash gradients</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flash-cs3/drawing-with-actionscript-3/custom-gradients-using-actionscript-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alpha mask using Actionscript 3.0</title>
		<link>http://englishblog.flepstudio.org/tutorials/flash-cs3/sintax/alpha-mask-using-actionscript-3-0/</link>
		<comments>http://englishblog.flepstudio.org/tutorials/flash-cs3/sintax/alpha-mask-using-actionscript-3-0/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 09:23:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sintax]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[copyChannel]]></category>
		<category><![CDATA[flash alpha mask]]></category>

		<guid isPermaLink="false">http://englishblog.flepstudio.org/?p=747</guid>
		<description><![CDATA[Have you ever tried to create an alpha mask using Actionscript 3.0? The thing is reachable with the method copyChannel of the BitmapData class. Load an external image Create a new instance of BitmapData (bitmap_data) and assign it to bitmapData property of the external bitmap Create a new instance of BitmapData (bitmap_data_copy) with same size [...]]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs3%2Fsintax%2Falpha-mask-using-actionscript-3-0%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fenglishblog.flepstudio.org%2Ftutorials%2Fflash-cs3%2Fsintax%2Falpha-mask-using-actionscript-3-0%2F&amp;source=flepstudio&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Have you ever tried to create an alpha mask using Actionscript 3.0? <br />
  The thing is reachable with the <strong>method copyChannel of the BitmapData class</strong>. </p>
<ol>
<li>Load an external image </li>
<li>Create a new instance of BitmapData (bitmap_data) and assign it to bitmapData property of the external bitmap </li>
<li>Create a new instance of BitmapData (bitmap_data_copy) with same size of external bitmap </li>
<li>Copy the pixels of external bitmap in the new instance  bitmap_data_copy</li>
<li>Use the dispose method on bitmap_data to free memory </li>
<li>Create a mask form using a Shape</li>
<li>Create a new instance of BitmapData (bitmap_data_shape) the same size of external image and use draw method over shape</li>
<li>bitmap_data_copy uses the method  copyChannel on bitmap_data_shape </li>
<li>Give bitmap_data_copy to property bitmapData of external image </li>
</ol>
<p>&nbsp;</p>
<p>Here&#8217;s the result:</p>
<p>
  <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" name="obj1" width="562" height="640" border="0" id="obj1"><param name="movie" value="http://flepstudio.org/swf/effettistica/copyChannel/copy_channel.swf" /><param name="quality" value="High" /><embed src="http://flepstudio.org/swf/effettistica/copyChannel/copy_channel.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="562" height="640"></embed></object>
</p>
<p>and here&#8217;s the code:</p>
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>package
{
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.geom.*;
    import flash.filters.*;

    public class Main extends MovieClip
    {
        private var loaded_bitmap:Bitmap;
        private var bitmap_data:BitmapData;
        private var bitmap_data_copy:BitmapData;
        private var bitmap_data_shape:BitmapData;

        private var shape:Shape;

        public function Main()
        {
            addEventListener(Event.ADDED_TO_STAGE,init);
            addEventListener(Event.REMOVED_FROM_STAGE,destroy);
        }

        private function init(evt:Event):void
        {
            removeEventListener(Event.ADDED_TO_STAGE,init);

            loadImage();
        }

        private function loadImage():void
        {
            var request:URLRequest=new URLRequest(&quot;tiger.jpg&quot;);
            var loader:Loader=new Loader();
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImageLoaded);
            loader.load(request);
        }

        private function onImageLoaded(evt:Event):void
        {
            evt.target.removeEventListener(Event.COMPLETE,onImageLoaded);

            loaded_bitmap=evt.target.loader.content as Bitmap;

            createAlphaMask();
        }

        private function createAlphaMask():void
        {
            bitmap_data=loaded_bitmap.bitmapData;
            var w:Number=bitmap_data.width;
            var h:Number=bitmap_data.height;

            bitmap_data_copy=new BitmapData(w,h,true,0x00FFFFFF);
            bitmap_data_copy.copyPixels(bitmap_data,bitmap_data.rect,new Point());
            bitmap_data.dispose();

            shape=createMask(w,h);
            bitmap_data_shape=new BitmapData(w,h,true,0x00FFFFFF);
            bitmap_data_shape.draw(shape);

            bitmap_data_copy.copyChannel(bitmap_data_shape,bitmap_data_shape.rect,new Point(),BitmapDataChannel.ALPHA,BitmapDataChannel.ALPHA);
            loaded_bitmap.bitmapData=bitmap_data_copy;
            addChild(loaded_bitmap);
        }

        private function createMask(w:Number,h:Number):Shape
        {
            var new_shape:Shape=new Shape();
            new_shape.graphics.beginFill(0xFFFFFF);
            new_shape.graphics.drawEllipse(50,50,w-100,h-100);
            new_shape.graphics.endFill();

            var blur_filter:BlurFilter=new BlurFilter(50,50,BitmapFilterQuality.HIGH);
            new_shape.filters=[blur_filter];
            addChild(new_shape);

            return new_shape;
        }

        private function destroy(evt:Event):void
        {
            removeEventListener(Event.REMOVED_FROM_STAGE,destroy);

            bitmap_data_copy.dispose();
            bitmap_data_shape.dispose();

            removeChild(loaded_bitmap);
            removeChild(shape);

            loaded_bitmap=null;
            shape=null;
        }
    }
}</code></pre>

	Tags: <a href="http://englishblog.flepstudio.org/tag/bitmapdata/" title="BitmapData" rel="tag">BitmapData</a>, <a href="http://englishblog.flepstudio.org/tag/copychannel/" title="copyChannel" rel="tag">copyChannel</a>, <a href="http://englishblog.flepstudio.org/tag/flash-alpha-mask/" title="flash alpha mask" rel="tag">flash alpha mask</a>, <a href="http://englishblog.flepstudio.org/tag/sintax/" title="Sintax" rel="tag">Sintax</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://englishblog.flepstudio.org/free-utilities/zoomify/" title="Zoomify (April 1, 2008)">Zoomify</a> (1)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/using-printjob-class-of-actionscript-3/" title="Using PrintJob class of Actionscript 3.0 (November 19, 2008)">Using PrintJob class of Actionscript 3.0</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/this-root/" title="this root (August 30, 2007)">this root</a> (0)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/flash-cs3/sintax/stop-all-sounds-with-actionscript-3-0/" title="Stop all sounds with Actionscript 3.0 (January 12, 2010)">Stop all sounds with Actionscript 3.0</a> (3)</li>
	<li><a href="http://englishblog.flepstudio.org/tutorials/removing-duplicate-elements-of-array-with-actionscript-3/" title="Removing duplicate elements of Array with Actionscript 3.0 (November 17, 2008)">Removing duplicate elements of Array with Actionscript 3.0</a> (5)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://englishblog.flepstudio.org/tutorials/flash-cs3/sintax/alpha-mask-using-actionscript-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
