<?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>ADM Blog &#187; components</title>
	<atom:link href="http://blog.another-d-mention.ro/tag/components/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.another-d-mention.ro</link>
	<description>No matter how you see things, reality changes when you reach understanding</description>
	<lastBuildDate>Tue, 29 Jun 2010 06:12:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Flex Components Pack</title>
		<link>http://blog.another-d-mention.ro/programming/flex-components-pack/</link>
		<comments>http://blog.another-d-mention.ro/programming/flex-components-pack/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 19:50:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex / ActionScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[swc]]></category>

		<guid isPermaLink="false">http://blog.another-d-mention.ro/?p=470</guid>
		<description><![CDATA[I've just started working on a set of Flex components which I call Flex Components Pack. I've only managed to make 11 components till now but I'm still working and have a lot of ideas on my to-do list. If any one of you is willing to help I would be very glad to get [...]


Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/ho-to-install-alchemy/' rel='bookmark' title='Permanent Link: Ho-To: Install Alchemy'>Ho-To: Install Alchemy</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-471" title="list" src="http://blog.another-d-mention.ro/wp-content/uploads/2009/06/list.png" alt="list Flex Components Pack" width="189" height="384" /> I've just started working on a set of Flex components which I call Flex Components Pack. I've only managed to make 11 components till now but I'm still working and have a lot of ideas on my to-do list. If any one of you is willing to help I would be very glad to get an extra brain in here. Just drop me a comment or something and I'll share the road-map and SVN path with you.</p>
<p>I've made a <a href="http://blog.another-d-mention.ro/downloads/components-pack/">page</a> where I will add tutorials, code examples and runnable demos as soon as possible, so check back soon. Till then, you can <a href="http://blog.another-d-mention.ro/stuff/ADMComponents.swc">download</a> the library and take a look.</p>
<p><strong>Update:</strong></p>
<p>(13/06/2009) - Added 5 more components. A simple but nice led light switch and 4 visualisation effects (EQTunnel, EQLine, EQWave, EQBars - winamp style). Just drag and drop the EQ on your app and it will animate any running sound inside your flash.</p>


<p>Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/ho-to-install-alchemy/' rel='bookmark' title='Permanent Link: Ho-To: Install Alchemy'>Ho-To: Install Alchemy</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.another-d-mention.ro/programming/flex-components-pack/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Create professional Flex components</title>
		<link>http://blog.another-d-mention.ro/programming/create-professional-flex-components/</link>
		<comments>http://blog.another-d-mention.ro/programming/create-professional-flex-components/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 17:50:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex / ActionScript]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://blog.another-d-mention.ro/?p=412</guid>
		<description><![CDATA[Flex Builder has a great way to organize its components in tree mode, which is very a good way to organize things and make things clear to any user who are coming to Flex world. By default, every component you create that is not part of default Flex components you will have placed in the [...]


Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/' rel='bookmark' title='Permanent Link: How to identify at runtime if the swf is in debug or release mode/build'>How to identify at runtime if the swf is in debug or release mode/build</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Flex Builder has a great way to organize its components in tree mode, which is very a good way to organize things and make things clear to any user who are coming to Flex world.</p>
<p>By default, every component you create that is not part of default Flex components you will have placed in the [Custom] directory of <strong>Flex Components</strong> view in your <strong>Flex/Flash Builder</strong>, and no matter what properties you add to them, they will never be visible in the <strong>Flex Properties</strong> standard view.</p>
<p>But what if you want to customize that and create a component that have them all like flex components do? Well, it's not that hard so let's do that.</p>
<h4>Create the Component</h4>
<p>First, you have to <strong>create a new Flex Library Project</strong>. Do this by going to File-&gt;New and choose Flex Library Project. Give it a name, a location, choose whatever Flex SDK you wish to build this for and then click finish.</p>
<p>Now you have a blank library project in which you can create whatever components you want.<br />
Is <span style="color: #ff0000;">important</span> to use packages correctly and namespaces and not just drop the component in the [src] folder (you'll see later why). First create a package (eg. com.adm.component) in which you can add your custom component.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.adm.component
<span style="color: #000000;">&#123;</span>
      <span style="color: #0033ff; font-weight: bold;">import</span> mx.containers.Canvas;
&nbsp;
      <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> mycomponent extends Canvas
      <span style="color: #000000;">&#123;</span>
      <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Okay, now let's create some methods to have something going. We'll make this component be a big button with a method to enable the button and one to change it's caption. We'll use setters and getter's for those properties because some other actions might be required when changing them. So:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.adm.component
<span style="color: #000000;">&#123;</span>
     <span style="color: #0033ff; font-weight: bold;">import</span> mx.containers.Canvas;
     <span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.Button;
&nbsp;
      <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> mycomponent extends Canvas
      <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _title <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">'Title'</span>;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _active <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> btn <span style="color: #000000; font-weight: bold;">:</span> Button = <span style="color: #0033ff; font-weight: bold;">new</span> Button<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomComponent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                      <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                      <span style="color: #0033ff; font-weight: bold;">this</span>.btn.<span style="color: #004993;">width</span> = <span style="color: #000000; font-weight:bold;">100</span>;
                      <span style="color: #0033ff; font-weight: bold;">this</span>.btn.<span style="color: #004993;">height</span> = <span style="color: #000000; font-weight:bold;">100</span>;
                      <span style="color: #0033ff; font-weight: bold;">this</span>.btn.label = <span style="color: #0033ff; font-weight: bold;">this</span>.label;
                      <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>.btn<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> title<span style="color: #000000;">&#40;</span>val <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                      <span style="color: #0033ff; font-weight: bold;">this</span>._title = val;
                      <span style="color: #0033ff; font-weight: bold;">this</span>.btn.label = val;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> title<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span>
            <span style="color: #000000;">&#123;</span>
                     <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">this</span>._title;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">active</span><span style="color: #000000;">&#40;</span>val <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                     <span style="color: #0033ff; font-weight: bold;">this</span>._active = val;
                     <span style="color: #0033ff; font-weight: bold;">this</span>.btn.<span style="color: #004993;">enabled</span>= val;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> <span style="color: #004993;">active</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span>
            <span style="color: #000000;">&#123;</span>
                    <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">this</span>._active;
            <span style="color: #000000;">&#125;</span>
      <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>So, if you now build your project, a .swc file will be generated in your [bin] folder, which you can add in other projects and use. But now, the component will be placed in the [Custom] directory in the Components View and not the one you want. We'll do that a bit later now let's just....</p>
<h4>Give it an icon</h4>
<p>This is really simple. All you have to do is get a nice looking .png icon (16x16 pixels preferably) and place it next to your component. Then, use the <strong>IconFile</strong> metadata tag to link it to your component.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">....
<span style="color: #000000;">&#91;</span>IconFile<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;icon.png&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> mycomponent extends Canvas
<span style="color: #000000;">&#123;</span>
       <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _title <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">'Title'</span>;
       .......</pre></div></div>

<h4>Inspectable properties</h4>
<p>If you have extra information about the property that will help code hints or the Property Inspector (such as enumeration values or that a String is actually a file path) then also add [Inspectable] metadata with that extra info. For our methods we have:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">       ...
       <span style="color: #000000;">&#91;</span>Inspectable<span style="color: #000000;">&#40;</span>category=<span style="color: #990000;">&quot;General&quot;</span>, <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;String&quot;</span>, defaultValue=<span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
       <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> title<span style="color: #000000;">&#40;</span>val <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
       .....
       .....
       <span style="color: #000000;">&#91;</span>Inspectable<span style="color: #000000;">&#40;</span>category=<span style="color: #990000;">&quot;General&quot;</span>, <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Boolean&quot;</span>, defaultValue=<span style="color: #990000;">&quot;true&quot;</span>, enumeration=<span style="color: #990000;">&quot;true,false&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
       <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">active</span><span style="color: #000000;">&#40;</span>val <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span></pre></div></div>

<p>This will also help a lot when we'll add this properties in the Flex Properties panel. For more informations about the [Inspectable] metadata tag visit <a href="http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00001658.html" target="_blank">http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00001658.html</a></p>
<h4>Create custom component folder</h4>
<p>So, if you want to build a professional component, you can't leave Flex add your component in the default [Custom] directory in the Components tree. So, in order to create your own folder, we must use few tricks.</p>
<p>First of all, you need two .xml files to describe the structure you want flex to use and overide it's default behavior.<br />
The first file is the manifest.xml which describes the components in the package and their namespaces. In our case we'll have:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;">&lt; ?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;componentpackage<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;component</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;mycomponent&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.adm.component.mycomponent&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/componentpackage<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Second, we need another xml to describe the way the designer will interpret all this.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;">&lt; ?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;design<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;namespaces<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;namespace</span> <span style="color: #000066;">prefix</span>=<span style="color: #ff0000;">&quot;adm&quot;</span> <span style="color: #000066;">uri</span>=<span style="color: #ff0000;">&quot;http://www.adm.org&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/namespaces<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;categories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;Test&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Test Panel&quot;</span> <span style="color: #000066;">defaultExpand</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/categories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;components<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;component</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mycomponent&quot;</span> <span style="color: #000066;">namespace</span>=<span style="color: #ff0000;">&quot;adm&quot;</span> <span style="color: #000066;">category</span>=<span style="color: #ff0000;">&quot;Test&quot;</span> <span style="color: #000066;">displayName</span>=<span style="color: #ff0000;">&quot;Rename Me&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/components<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/design<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In the design.xml, you can specify the namespaces you used for the components, in this case adm will point to components in the org.adm folder.</p>
<p>Categories tag describes the folders you want added in the Components panel. Each category must have an <strong>id</strong> which you'll use to tell components where they should reside, a <strong>label</strong> for the category to stand as the directory name in the Components panel. <strong>defaultExpand</strong> is an optional parameter which if set to true, the folder will be showed expanded by default.</p>
<p>In the components tag, you specify which component goes in what category and under what title. The <strong>name</strong> parameter must match the id of a component listed in the manifest.xml. All the other parameters are pretty self explanatory.</p>
<p>Next, you have to include this two files in .swc package. To do that, follow the steps:</p>
<p>* Right Click at your project and select Properties<br />
* In the left choose Flex Library Build Path<br />
* Select the assets tab and mark to include manifest.xml and design.xml files<br />
* Now select the Flex Library Compiler and include your namespace URL (in this case http://www.adm.org)<br />
* Include the manifest file .xml you've created<br />
* Click apply and ok to finish</p>
<p><img class="aligncenter size-full wp-image-432" title="design" src="http://blog.another-d-mention.ro/wp-content/uploads/2009/06/design.png" alt="design Create professional Flex components" width="476" height="375" /><br />
<img class="aligncenter size-full wp-image-433" title="manifest" src="http://blog.another-d-mention.ro/wp-content/uploads/2009/06/manifest.png" alt="manifest Create professional Flex components" width="483" height="380" /></p>
<p>After this, you should end up with something like this</p>
<p><img class="aligncenter size-full wp-image-428" title="comppanel" src="http://blog.another-d-mention.ro/wp-content/uploads/2009/06/comppanel.png" alt="comppanel Create professional Flex components" width="297" height="225" /></p>
<h4>Add properties to the Flex Properties view</h4>
<p>As I said before, no matter what properties you add to your component, they will never be visible in the <strong>Flex Properties</strong> standard view, only in the category view and that only if you use the [Inspectable] metadata tag. But few more lines in the design.xml file should take care of that.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;component</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mycomponent&quot;</span> <span style="color: #000066;">namespace</span>=<span style="color: #ff0000;">&quot;adm&quot;</span> <span style="color: #000066;">category</span>=<span style="color: #ff0000;">&quot;Test&quot;</span> <span style="color: #000066;">displayName</span>=<span style="color: #ff0000;">&quot;Rename Me&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mxmlproperties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textfield</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;title&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Component Title:&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;combo</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;active&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Active:&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mxmlproperties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;defaultattribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;active&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/component<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The id of the mxmlProperties tag should be the function/variable names from your component you want to edit. You can also define default values for those properties using the defaultAttribute tag below. Here we've only used the textfield and the combo type but there are few more you can use.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textfiled</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;propertyOrStyle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Label:&quot;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #000066;">multiline</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;combo</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;propertyOrStyle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Label:&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;colorpicker</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;propertyOrStyle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Label:&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filepicker</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;propertyOrStyle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Label:&quot;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #000066;">wrapInEmbed</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;slider</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;propertyOrStyle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Label:&quot;</span> <span style="color: #000066;">min</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">max</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">increment</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p> For combo boxes, if you use it for a Boolean property, it will automatically be populated with [true,false] values but if want something else, the [Inspectable] metadata tag has the enumeration property where you can define the properties from this combo.</p>
<p><img class="aligncenter size-full wp-image-431" title="flexprop" src="http://blog.another-d-mention.ro/wp-content/uploads/2009/06/flexprop.png" alt="flexprop Create professional Flex components" width="298" height="207" /></p>
<p>Another thing you must do in order to apply the values as soon as you change them from the properties view, is to set the functions/variables as [Bindable].</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">    ....
    <span style="color: #000000;">&#91;</span>Inspectable<span style="color: #000000;">&#40;</span>category=<span style="color: #990000;">&quot;General&quot;</span>, <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;String&quot;</span>, defaultValue=<span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
    <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> title<span style="color: #000000;">&#40;</span>val <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
	....
	....
    <span style="color: #000000;">&#91;</span>Inspectable<span style="color: #000000;">&#40;</span>category=<span style="color: #990000;">&quot;General&quot;</span>, <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Boolean&quot;</span>, defaultValue=<span style="color: #990000;">&quot;true&quot;</span>, enumeration=<span style="color: #990000;">&quot;true,false&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
    <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">active</span><span style="color: #000000;">&#40;</span>val <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
	....
	....</pre></div></div>

<h4>One more thing</h4>
<p>Now, compiling this will give you a 300 something KB .swc file which is a bit large to distribute. The user will use this component inside a flex component so embedding all the libraries and SDK inside your .swc is useless. So the next step is to go to Properties-&gt;Flex Library Build Path-&gt;Library path tab, expand the build path library try and edit everything inside the SDK tree on Link Type and choose <strong>External</strong></p>
<p><img class="aligncenter size-full wp-image-434" title="paths" src="http://blog.another-d-mention.ro/wp-content/uploads/2009/06/paths.png" alt="paths Create professional Flex components" width="526" height="287" /></p>
<p>Now the swc component only have 4KB. Big cut down, eh ?</p>
<h4>Done</h4>
<p>If this is to much trouble for you or you've missed something, I've attached the sources for this tutorial <a href="http://blog.another-d-mention.ro/stuff/component.zip">here</a>. You can import this skeleton  rename the package, namespace and the component and start building on this. I hope it all made sense and....happy coding.</p>


<p>Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/' rel='bookmark' title='Permanent Link: How to identify at runtime if the swf is in debug or release mode/build'>How to identify at runtime if the swf is in debug or release mode/build</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.another-d-mention.ro/programming/create-professional-flex-components/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
