<?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>Flexpert to the rescue &#187; Flex</title>
	<atom:link href="http://www.flexpert.be/category/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexpert.be</link>
	<description>Blog site about all things Adobe</description>
	<lastBuildDate>Sun, 05 Feb 2012 21:58:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Do Flex and LiveCycle still have a future?</title>
		<link>http://www.flexpert.be/2011/12/do-flex-and-livecycle-still-have-a-future/</link>
		<comments>http://www.flexpert.be/2011/12/do-flex-and-livecycle-still-have-a-future/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 10:19:03 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[LiveCycle Data Services]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Flash player]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[LiveCycle]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=962</guid>
		<description><![CDATA[I&#8217;ve been quiet for quite some time now. There are 2 reasons for that. The first one is simply because I have been busy on a couple of projects and just didn&#8217;t find the time to write another blog post. The second reason is that I wanted to wait and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been quiet for quite some time now. There are 2 reasons for that. The first one is simply because I have been busy on a couple of projects and just didn&#8217;t find the time to write another blog post. The second reason is that I wanted to wait and see what would happen with all of the bad news around Flex and LiveCycle. I did not want to overreact, as many other people have done, causing a temporary wide spread panic about Flash being killed.
<p>I completely agree that it has been poor communication from Adobe, especially after what they have announced at AdobeMAX this year. So, timing could have been better and the messages that they initially shared could have been better formulated. Adobe acknowledges this and have sent out their apologies for that as well. But the harm was already done. I even saw people leaving prerelease and other programs (I can&#8217;t mention by name) furious about what happened and turning their backs on Adobe entirely. I respect those decisions, but come on, is it really such a bad thing?</p>
<p><strong>For those of you who are not quite up to speed on what exactly is going on at Adobe. Let me briefly state the latest developments.</p>
<ul>
<li>Adobe is dropping the Flash player on mobile devices</li>
<li>Flex is going to become completely open source</li>
<li>LiceCycle will be discontinued after the next release</li>
<li>AIR on mobile (iOS, Android, PlayBook) is still going to be developed</li>
<li>Flash Builder will continue to be developed by Adobe</li>
<li>The next version of Flash Builder will not have a Design View</li>
<li>The DCD feature will be dropped in the next release of Flash Builder</li>
</ul>
<p></strong></p>
<p>Let&#8217;s start with LiveCycle. For those of you who don&#8217;t know what LiveCycle is, it is a product that allows you to define information workflows, mainly based on PDFs. So, for example, you could fill out a job application form in a PDF, digitally sign it with you eID card (in Belgium at least) and send it to a specific email address. The PDF attachment gets picked up from the mailbox and the information is extracted and put in a database. After that a &#8220;thank you&#8221; email is sent to the applicant, while in the mean time the HR manager is notified of a new application. Upon approval by the HR manager in the so called &#8220;workspace&#8221; a new PDF is sent to the unit manager, notifying him that he should interview this candidate, together with the candidate&#8217;s résumé. After the interview the unit manager can then input his findings in a evaluation form and LiveCycle will pick that up as well to put it into the database and notify the HR manager that the evaluation has been submitted. Would the candidate be rejected, the can be marked in the &#8220;workspace&#8221; again for example, an automatic email will be sent to the candidate notifying him of his rejection.</p>
<p> Now, this is just one example of what LiveCycle can do. <strong>Even though Adobe is shifting its focus towards other strategic solutions, they will continue to develop LiveCycle (<a href="http://blogs.adobe.com/ADEP/2011/11/livecycle-business-update.html" target="_blank">as you can read here</a>), invest in finding new customers and product support is still guaranteed</strong>, so you&#8217;re not left alone with your solution if you&#8217;re currently using LiveCycle.</p>
<p><strong>As for dropping the Flash Player on mobile devices, I don&#8217;t think that is a bad thing.</strong> You see, if Adobe wants to keep the same version of the Flash Player on all devices (desktop, mobile, tablet) then a lot of code will have to go in checking whether or not things certain features are available. This requires a lot of effort and slows down progress on the features that matter the most. <strong>I mean, come on, when did you actually use a Flash based website on you mobile device?</strong> Either it wasn&#8217;t mobile optimized causing frustration in content that is not scaled properly, or it just was overkill for a mobile device.<br/><br />
Now Adobe has the opportunity to focus on the desktop platform and make full use of the GPU hardware acceleration and other cool features that require more processing power than what the other devices can offer at this moment. <strong>It is clear that Adobe wants to move in the direction of gaming with Flash</strong>, which I have been expecting for some time now.</p>
<p>Remember, I just said that the Flash Player will be dropped on mobile. <strong>That does not mean that the cross-device AIR solution is being dropped. On the contrary! AIR for mobile devices will continue to be developed by Adobe and is one of the key products/features they will maintain.</strong> So you don&#039;t have to worry about your cross-device development.</p>
<p><strong>However, the Flex SDK is going to be put into the Apache project, bringing along a new produt name as well, since Adobe won&#8217;t own the SDK anymore.</strong> Once the incubator is accepted, the product will be called &quot;Apache Flex&quot;. You can read all about the Apache Flex Incubator <a href="http://bit.ly/tpmpa7" target="_blank">right here</a>.<br/><br />
<strong>That means that from that point on the SDK will be developed and maintained by the community.</strong> That will be a good thing in the sense that probably we&#8217;ll get more features more rapidly developed. But &#8211; and there&#8217;s a big &quot;but&quot; in here &#8211; I do see a problem in the adopt of the Flex technology in big companies. You see, <strong>what companies want is a support contract with time frame commitment</strong>. They want a red phone to the help desk when they encounter serious problems and at the moment they are paying big money for that. <strong>Once Flex is owned by the community, Adobe probably won&#8217;t be doing anymore support, because it is now up to the community.</strong></p>
<p>This lack of support is what could harm Flex in the high end business companies. But then again, <strong>this will also lead to new opportunities for companies such as <a href="http://www.multimediacollege.be target="_blank">multimediacollege</a> in the sense that we can now write and publish our own training material, as well as provide support contracts for helping out companies who need assistance with some Flex problems.</strong></p>
<p>So, is Flex dead? Definitely not! And it isn&#8217;t dying either. We will have a huge community supporting the development and some highly skilled developers working on the features. I wish I had some magical device that allows me to see into the future to see what will happen with Flex when it becomes completely Open Source. But for now, I&#8217;m not yet worried about it&#8217;s future&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/12/do-flex-and-livecycle-still-have-a-future/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll be speaking at gotoAndSki();</title>
		<link>http://www.flexpert.be/2011/10/ill-be-speaking-at-gotoandski/</link>
		<comments>http://www.flexpert.be/2011/10/ill-be-speaking-at-gotoandski/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 19:14:35 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Conference]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[gotoAndSki]]></category>
		<category><![CDATA[Switzerland]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=952</guid>
		<description><![CDATA[Tonight I got one of the &#8220;coolest&#8221; emails you can get: I&#8217;ve been invited to give a session at gotoAndSki(); Switzerland on January 26th, 27th and 28th, 2012, which is really awesome. Unfortunately I haven&#8217;t been to this conference before, but I&#8217;ve heard very nice things about it and let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://switzerland.gotoandski.com"><img src="http://www.flexpert.be/wp-content/gotoAndSki.jpg" alt="" title="gotoAndSki" width="560" height="187"/></a>
<p>Tonight I got one of the &#8220;coolest&#8221; emails you can get: <strong>I&#8217;ve been invited to give a session at gotoAndSki(); Switzerland</strong> on January 26th, 27th and 28th, 2012, which is really awesome. Unfortunately I haven&#8217;t been to this conference before, but I&#8217;ve heard very nice things about it and let&#8217;s face it, skiing during the day and conferences with diner at night is not your typical conference setup. So I&#8217;m really looking forward to it.</p>
<p><strong>Now, about my session, it&#8217;s going to be titled &#8220;Database Driven Mobile Applications: the power of ORM&#8221;.</strong> Now, some of you may think &#8220;what the hell is ORM?&#8221;. Well let me reassure you that it is not magic, but it does some really magical stuff.<br/><br />
<strong>ORM allows you to create database driven applications by writing virtually no SQL statements.</strong>Normally, this type of feature is restricted to the server side of your application, but now you can use this server-side feature on the client-side in an AIR application.</p>
<p><strong>This session will talk you through the basics of using ORM in AIR and how to &#8220;automagically&#8221; synchronise your local data with a remote server.</strong> Whether that&#8217;s a PHP, Java or ColdFusion, it doesn&#8217;t matter. That&#8217;s not all: we&#8217;ll go one step further and take that ability to create database driven applications onto the mobile platform as well. Just like that!</p>
<p>If you are digging <a href="http://switzerland.gotoandski.com/sessions-speakers/">this and the other topics presented at gotoAndSki();</a> make sure you get your tickets in time to enjoy the conference and the gorgeous surroundings of the Swiss Alps. I hope to see you there: <a href="http://switzerland.gotoandski.com">switzerland.gotoandski.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/10/ill-be-speaking-at-gotoandski/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a custom required RadioButtonGroup Validator class in Flex</title>
		<link>http://www.flexpert.be/2011/07/creating-a-custom-required-radiobuttongroup-validator-class-in-flex/</link>
		<comments>http://www.flexpert.be/2011/07/creating-a-custom-required-radiobuttongroup-validator-class-in-flex/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 12:56:25 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[Validator]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=914</guid>
		<description><![CDATA[Today I was discussing the Validator classes on the Adobe prerelease forum with a couple of other Flex developers. The Flex Validator classes are pretty good for some basic validation and give you a fly-over error message (which you can customize) and a red component outline when the validation fails. [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was discussing the Validator classes on the Adobe prerelease forum with a couple of other Flex developers. <strong>The Flex <em>Validator</em> classes are pretty good for some basic validation</strong> and give you a fly-over error message (which you can customize) and a red component outline when the validation fails.</p>
<p>Now, <strong>the problem with these validators is that they are geared towards validating one single visual component</strong>, such as a <em>TextInput, TextArea, ComboBox, List</em> etc. <strong>But what about compound components</strong>, such as a <em>DateField</em> combined with a <em>TextInput</em> field for the time? Or, as I will explain in this post, a <em>RadioButtonGroup</em>, which is a non-visual component, but actually comprises the different <em>RadioButton</em> components?</p>
<p>Before I go into how I solved that problem, let me explain a bit about the Flex <em>Validator</em> class. This is the base class for all the different validators and can only check on a field being required or not. This also means that we are going to inherit from this component to create our own validator classes. Of course, <strong>you can extend other validator classes as well, but for my purpose of checking to see if a <em>RadioButton</em> in the list has been selected, the <em>Validator</em> base class will be just fine.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Validator</span> source=<span style="color: #ff0000;">&quot;{componentToCheck}&quot;</span> property=<span style="color: #ff0000;">&quot;propertyToCheck&quot;</span> </span>
<span style="color: #000000;">              trigger=<span style="color: #ff0000;">&quot;{componentToMonitor}&quot;</span> triggerEvent=<span style="color: #ff0000;">&quot;eventToMonitor&quot;</span> </span>
<span style="color: #000000;">              required=<span style="color: #ff0000;">&quot;true(default)|false&quot;</span> </span>
<span style="color: #000000;">              requiredError=<span style="color: #ff0000;">&quot;errorMessage&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></div></div>

<p>As you can see in the code sample above there are a couple of important properties in the base class we have to keep in mind when developing our own validator class. First of all, the <em>componentToCheck</em> will be an instance of <em>RadioButtonGroup</em> and the <em>propertyToCheck</em> will be the <em>selection</em> property. You can use the <em>trigger</em> and <em>triggerEvent</em> properties to determine when the validation needs to take place. <strong>Leaving out the <em>trigger</em> property and explicitly setting the <em>triggerEvent</em> to an empty string will make sure that the Flex framework will never trigger the validation by itself.</strong> That means that we have to do that manually at the exact time that we want the validation to happen.</p>
<p>In the code below you can clearly see the usage of these properties in both <em>&lt;co:RadioGroupValidator/&gt;</em> instances. For all good purposes I&#8217;ve also made both a Spark and Halo form to show you the <em>RadioGroupValidator</em> works with both Spark and Halo components.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RadioButtonGroup</span> id=<span style="color: #ff0000;">&quot;rbgSpark&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButtonGroup</span> id=<span style="color: #ff0000;">&quot;rbgHalo&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;co:RadioGroupValidator</span> id=<span style="color: #ff0000;">&quot;vRbgSpark&quot;</span> source=<span style="color: #ff0000;">&quot;{rbgSpark}&quot;</span> property=<span style="color: #ff0000;">&quot;selection&quot;</span> triggerEvent=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;co:RadioGroupValidator</span> id=<span style="color: #ff0000;">&quot;vRbgHalo&quot;</span> source=<span style="color: #ff0000;">&quot;{rbgHalo}&quot;</span> property=<span style="color: #ff0000;">&quot;selection&quot;</span> triggerEvent=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Form</span> defaultButton=<span style="color: #ff0000;">&quot;{btnSubmitSpark}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:FormHeading</span> label=<span style="color: #ff0000;">&quot;Spark form&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 1&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgSpark}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 2&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgSpark}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 3&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgSpark}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 4&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgSpark}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btnSubmitSpark&quot;</span> label=<span style="color: #ff0000;">&quot;Submit&quot;</span> click=<span style="color: #ff0000;">&quot;sparkSubmitHandler(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Form</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> defaultButton=<span style="color: #ff0000;">&quot;{btnSubmitHalo}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormHeading</span> label=<span style="color: #ff0000;">&quot;MX form&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 1&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgHalo}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 2&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgHalo}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 3&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgHalo}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> label=<span style="color: #ff0000;">&quot;Choice 4&quot;</span> group=<span style="color: #ff0000;">&quot;{rbgHalo}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> id=<span style="color: #ff0000;">&quot;btnSubmitHalo&quot;</span> label=<span style="color: #ff0000;">&quot;Submit&quot;</span> click=<span style="color: #ff0000;">&quot;haloSubmitHandler(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p><strong>As for the <em>RadioGroupValidator</em> class itself</strong>, the only thing we need to do there is to override the <em>validate</em> method to see wether or not the validation succeeded. <strong>If the validation failed we need to loop over all the <em>RadioButton</em> components that belong to this group and set their errorString to the proper message</strong>, as you can see in the code below.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">ValidationResultEvent</span>;
<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">validators</span>.<span style="color: #006600;">Validator</span>;
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RadioGroupValidator <span style="color: #0066CC;">extends</span> Validator <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> RadioGroupValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		requiredFieldError = <span style="color: #ff0000;">&quot;Please choose an option from the list.&quot;</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> validate<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</span>, suppressEvents:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>:ValidationResultEvent <span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> result:ValidationResultEvent = <span style="color: #0066CC;">super</span>.<span style="color: #006600;">validate</span><span style="color: #66cc66;">&#40;</span>value, suppressEvents<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:uint = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #0066CC;">this</span>.<span style="color: #006600;">source</span>.<span style="color: #006600;">numRadioButtons</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>result.<span style="color: #0066CC;">type</span> == ValidationResultEvent.<span style="color: #006600;">INVALID</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> 
				<span style="color: #0066CC;">this</span>.<span style="color: #006600;">source</span>.<span style="color: #006600;">getRadioButtonAt</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">errorString</span> = result.<span style="color: #0066CC;">message</span>;
			<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #0066CC;">this</span>.<span style="color: #006600;">source</span>.<span style="color: #006600;">getRadioButtonAt</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">errorString</span> = <span style="color: #000000; font-weight: bold;">null</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> result;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Now, as you can see I&#8217;ve also set the <em>errorString</em> in the constructor to a specific message. This doesn&#8217;t mean that you can&#8217;t provide your own specific message anymore in the instance declaration. The reason for this is that setting a property in MXML actually uses the implicit setter method and that one is executed after the constructor has initialized the object, which means it will simply overwrite the default value.</p>
<p><center>
<object width="350" height="200">
<param name="movie" value="http://www.flexpert.be/swfexamples/RadioGroupValidator.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<embed wmode="transparent" type="application/x-shockwave-flash" width="350" height="200" src="http://www.flexpert.be/swfexamples/RadioGroupValidator.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</center></p>
<p><em>P.S.: If you test the forms, you will see that the Spark form doesn&#8217;t show the red error indicator as well as the MX form. Maybe that&#8217;s a glitch in the framework, maybe not. I&#8217;m still hunting that little sucker down, but no luck so far. I will update this example when I solved this problem.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/07/creating-a-custom-required-radiobuttongroup-validator-class-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My experience with putting a Flex app on the PlayBook</title>
		<link>http://www.flexpert.be/2011/05/my-experience-with-putting-a-flex-app-on-the-playbook/</link>
		<comments>http://www.flexpert.be/2011/05/my-experience-with-putting-a-flex-app-on-the-playbook/#comments</comments>
		<pubDate>Mon, 02 May 2011 11:56:37 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[BlackBerry PlayBook]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[PlayBook]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=864</guid>
		<description><![CDATA[As I&#8217;ve mentioned in my previous blog post, I&#8217;ve finally gotten hold of my free BlackBerry Playbook, so I started playing around with it. First impressions were quite good. Even my wife is interested in this device, which sounds great, but will probably mean I&#8217;ll have to kindly ask here [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;ve mentioned in my previous blog post, I&#8217;ve finally gotten hold of <a href="http://www.flexpert.be/2011/04/my-blackberry-playbook-has-finally-arrived/">my free BlackBerry Playbook</a>, so I started playing around with it. First impressions were quite good. Even my wife is interested in this device, which sounds great, but will probably mean I&#8217;ll have to kindly ask here to borrow it if I want to test on it&#8230;</p>
<p>But for now, she&#8217;s not getting hold of the device, because I want to try several things out. And one of those things is the real cross-device development using the Flash Platform. In my case, that means Flex of course. That&#8217;s what I&#8217;ve be doing for the past couple of days and I must say it&#8217;s really working once you get the procedure down. That&#8217;s the tricky bit for now, so let me take you through my struggles and maybe I can save you from making the same endeavors as I needed in order to get it working.</p>
<h3>Setting up the development environment</h3>
<p>This is the first part you&#8217;ll have to go through. Blackberry has issued <a href="http://us.blackberry.com/developers/tablet/adobe.jsp">a tablet OS SDK</a>, which is a plugin for Flash Builder that allows you to compile applications for the PlayBook directly from within Flash Builder. While this all sounds great, <strong>the latest releases of that plugin do not support Flex Mobile applications</strong>. That means you cannot use that SDK to compile your Flex Mobile application. You can only work with ActionScript Mobile application.</p>
<p>A second issue is the fact that the SDK is installed on top of an existing Flex 4.5 SDK and without giving away too much information, it is not compatible with all Flex 4.5 SDKs, so compiling and packaging the application from within Flash Builder is not possible with the latest versions. Hopefully BlackBerry will release another version of their SDK this is compatible soon.</p>
<p>Taking these two issues into accounad the fact that as a Flex developer I want to use a Flex Mobile project, I&#8217;ll have to package the application using the command line.</p>
<h3>Compiling and packaging the application</h3>
<p>Since the option of compiling directly for the playbook is not possible with the latest builds, I&#8217;ve used a little shortcut to get the release build of my application. I mean, if you&#8217;re working on a Flex mobile application and you compile using Flash Builder, you can only opt for the Android APK file. There is no release build that gives you the release version of the SWF file.</p>
<p>So that&#8217;s exactly what I&#8217;ve done. Then I unzipped the APK file and searched for the release version of my SWF file and used that to package my BAR file. The command to do the packaging is as follows</p>
<p><em>blackberry-airpackager -package &lt;BAR file&gt; &lt;application&gt;-app.xml &lt;application&gt;.swf blackberry-tablet.xml &lt;assets required by the application&gt;</em></p>
<h3>Signing the application</h3>
<p>Once you have the BAR file ready you have come to the trickiest part: signing the application. This is best done via command line again, but hopefully this will be included in the Flash Builder plugin once it&#8217;s updated to work with the latest builds and with Flex Mobile projects.</p>
<p>First, <strong>you need to be registered as a vendor with BlackBerry</strong> in order to obtain you code signing key. This is done only once per developer or company, depending on how you want to register yourself. Obtaining the key is done by filling out <a href="https://www.blackberry.com/SignedKeys/">this form</a>.</p>
<p>The key you receive will be a CSJ file. It all starts with that file, because now you have to <strong>register that CSJ file as well as create a keystore</strong> to communicate with the BlackBerry signing authority. So, we&#8217;ll start by setting up that keystore, which is done via the following command</p>
<p><em>blackberry-signer -csksetup -cskpass &lt;create a password&gt;</em></p>
<p>Then you need to register the CSJ file by using the following command</p>
<p><em>blackberry-signer -register -csjpin &lt;PIN&gt; -cskpass &lt;csk password from previous step&gt; &lt;CSJ file&gt;</em></p>
<p>The last thing to get you set up is to <strong>generate a coding certificate, a .p12 file</strong> that is not unlike the certificate you create for regular AIR applications. This is done by executing the following command:</p>
<p>blackberry-keytool -genkeypair -keystore &lt;certificate.p12&gt; -storepass &lt;create a password&gt; -dname &#8220;cn=&lt;company name&gt;&#8221; -alias author</p>
<p>Once you have this set up, you are all set to start signing your application. <strong>When signing an application for the BlackBerry App World you actually have to sign it twice.</strong> Once for the code signing itself and a second time to add the author data to the BAR file. This can be done by executing these two statements in this particular order.</p>
<p><em>blackberry-signer -verbose -cskpass &lt;csk password&gt; -keystore &lt;p12 certificate&gt;  -storepass &lt;certificate password&gt; &lt;application&gt;.bar RDK</em></p>
<p><em>blackberry-signer -keystore &lt;p12 certificate&gt;  -storepass &lt;certificate password&gt; &lt;application&gt;.bar author</em></p>
<p><strong>If you go through this signing process several times, make sure that you increase the application versionNumber in the &lt;application&gt;-app.xml file every single time.</strong> Otherwise you will get the error message that the application was already signed.</p>
<h3>Deploying the application on the device</h3>
<p><strong>At this point your application is ready to be submitted to the BlackBerry App World.</strong> However, you might want to install it on your own device already and not wait for approval. This can be done via command line too and it can only be done with the signed BAR file. Unsigned applications can be installed using a debug token that expires after 30 days, but the following command is not suited for that type of deployment. It will only work with signed BAR files.</p>
<p><em>blackberry-deploy &#8211; installApp -device &lt;device IP&gt; -password &lt;device password&gt; &lt;application&gt;.bar</em></p>
<p>When you execute this command the application will be installed on your BlackBerry PlayBook and you can run it as if you installed it through the App World.</p>
<p>This might not be the best way to get your Flex Mobile application on the PlayBook, but it sure has worked for me and as far as I know it is the only way to do this with my current setup of Flash Builder and PlayBook SDK.<br/><br />
If someone has a better way of doing this, please let me know as I find this not an easy process to do (what should be) a simple task</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/05/my-experience-with-putting-a-flex-app-on-the-playbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roundtripping between Flash Builder 4.5 and Flash Catalyst CS5.5</title>
		<link>http://www.flexpert.be/2011/04/roundtripping-between-flash-builder-4-5-and-flash-catalyst-cs5-5/</link>
		<comments>http://www.flexpert.be/2011/04/roundtripping-between-flash-builder-4-5-and-flash-catalyst-cs5-5/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 09:06:27 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[CS5.5]]></category>
		<category><![CDATA[Flex 4.5]]></category>
		<category><![CDATA[roundtripping]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=840</guid>
		<description><![CDATA[We&#8217;ve all seen how the roundtripping between Flash Builder 4 and Flash Catalyst CS5 just sucked. You just couldn&#8217;t do it in a workable manner. When the MAX preview releases came along, well, things got a little bit better. But still, it was not a practical way of doing things. [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve all seen how the roundtripping between Flash Builder 4 and Flash Catalyst CS5 just sucked. You just couldn&#8217;t do it in a workable manner. When the MAX preview releases came along, well, things got a little bit better. But still, it was not a practical way of doing things.</p>
<p>Now we have Flash Builder 4.5 and Flash Catalyst CS5.5 and things are really shaping up. We can finally do roundtripping, even multiple times. Just look at this video in which I demonstrate exactly that and some other cool new productivity features in Flash Builder 4.5</p>
<p><center><object width="480" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=22384864&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed wmode="transparent" src="http://vimeo.com/moogaloop.swf?clip_id=22384864&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="480" height="300"></embed></object></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/04/roundtripping-between-flash-builder-4-5-and-flash-catalyst-cs5-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Detecting the network connection type with Flex 4.5</title>
		<link>http://www.flexpert.be/2011/04/detecting-the-network-connection-type-with-flex-4-5/</link>
		<comments>http://www.flexpert.be/2011/04/detecting-the-network-connection-type-with-flex-4-5/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 08:47:42 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[BlackBerry PlayBook]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[3G]]></category>
		<category><![CDATA[Flex 4.5]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[permissions]]></category>
		<category><![CDATA[WiFi]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=834</guid>
		<description><![CDATA[As you may already be aware of, Flex 4.5 is the next version of Flex that is also optimised for mobile development. That means that you can create compelling Rich Internet Applications with the Flex framework and deploy them on mobile Android devices, as well as the BlackBerry PlayBook (and [...]]]></description>
			<content:encoded><![CDATA[<p>As you may already be aware of, Flex 4.5 is the next version of Flex that is also optimised for mobile development. That means that you can create compelling Rich Internet Applications with the Flex framework and deploy them on mobile Android devices, as well as the BlackBerry PlayBook (and iOS devices in the near future).</p>
<p><strong>One of the great features of mobile RIAs is the fact that you can connect your application to all kinds of different server technologies, such as PHP, Java, ColdFusion, .NET, &#8230; in exactly the same way as you would in your desktop AIR application.</strong> You can even work with the DataService component to use real-time data connections over the RTMP channel. Just think about real-time stock updates, video streaming, trader applications on mobile, collaboration across multiple devices &#8230; The sky really is the limit. Or is it?</p>
<p>I think all of this always sounds very nice, but <strong>people tend to forget one important thing when working on a mobile device and that is that if you&#8217;re not on a WiFi connection, your data contract can become very expensive when you use the sever connections</strong>. However, in Flex 4.5 there is a way to actually check whether you are working on your data contract or on a WiFi connection.</p>
<p>In the application <strong>you can access all of the device interfaces and check to see whether they are active or not</strong>. The only thing you need to know is which interface to look for. In the code below, you can see how I check for the &#8220;WiFi&#8221; and &#8220;mobile&#8221; interfaces. Based on what I find, I just check whether it is active. Remember, some people may have the possibility to work via a data contract, but didn&#8217;t sign up for it, so finding the &#8220;mobile&#8221; interface isn&#8217;t enough.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:View</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">		xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #000000;">		title=<span style="color: #ff0000;">&quot;Connection Test&quot;</span></span>
<span style="color: #000000;">		creationComplete=<span style="color: #ff0000;">&quot;initView()&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			private function initView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				var interfaces:Vector.&lt;NetworkInterface<span style="color: #7400FF;">&gt;</span></span> = NetworkInfo.networkInfo.findInterfaces();
&nbsp;
				for(var i:uint = 0; i <span style="color: #000000;">&lt; interfaces.length; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">					if<span style="color: #66cc66;">&#40;</span>interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.name.toLowerCase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;wifi&quot;</span> &amp;&amp; interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.active<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">						lbl.text = <span style="color: #ff0000;">&quot;WiFi connection enabled&quot;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">					<span style="color: #66cc66;">&#125;</span> else if<span style="color: #66cc66;">&#40;</span>interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.name.toLowerCase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;mobile&quot;</span> &amp;&amp; interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.active<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">						lbl.text = <span style="color: #ff0000;">&quot;Mobile data connection enabled&quot;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">					<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;lbl&quot;</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:View</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>In this example I&#8217;m simply setting the <em>text</em> property of a label, but you can also use this in a real world application to determine the update rate for your server data, for example.</p>
<p>There is one thing you should not forget to do when creating such an application. <strong>You have to set the proper permissions in the &lt;applicationName&gt;-app.xml file, in the android section.</strong> That section should contain the <em>ACCESS_NETWORK_STATE</em> and the <em>ACCESS_WIFI_STATE</em> permissions in order for it to work. If you don&#8217;t include this, you will get an empty <em>Vector</em> returned from the <em>findInterfaces</em> method.</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;android<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifestAdditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">	&lt;manifest&gt;</span>
<span style="color: #339933;">		&lt;!-- See the Adobe AIR documentation for more information about setting Google Android permissions --&gt;</span>
<span style="color: #339933;">		&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;</span>
<span style="color: #339933;">		&lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot;/&gt;</span>
<span style="color: #339933;">		&lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot;/&gt;</span>
<span style="color: #339933;">	&lt;/manifest&gt;</span>
<span style="color: #339933;">]]&gt;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifestAdditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/android<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/04/detecting-the-network-connection-type-with-flex-4-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating Flex themes with Flash Catalyst</title>
		<link>http://www.flexpert.be/2011/04/creating-flex-themes-with-flash-catalyst/</link>
		<comments>http://www.flexpert.be/2011/04/creating-flex-themes-with-flash-catalyst/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 09:37:52 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=803</guid>
		<description><![CDATA[In my book Flash Builder and Flash Catalyst; the new workflow I talk about different workflows for the different types of applications. These workflows are all good when creating a single application. But isn&#8217;t there something you could do for improving reusability of your design elements and collaborating more easily? [...]]]></description>
			<content:encoded><![CDATA[<p>In my book <a href="http://amzn.to/hb3RBm">Flash Builder and Flash Catalyst; the new workflow</a> I talk about different workflows for the different types of applications. These workflows are all good when creating a single application. But isn&#8217;t there something you could do for improving reusability of your design elements and collaborating more easily?</p>
<p>First thing to do, and this is what I always tend to do, is to <strong>export your Flash Catalyst components as a Flex library project</strong>. This allows you to get around the roundtripping issue, because this library project only contains Flash Catalyst generated components and will therefore remain compatible with Flash Catalyst when you need to alter the design at some point in the future.</p>
<p>Skinning your actual project is then done by linking the SWC file from the library project to your actual project and applying the proper skin to the component using the skinClass property. Now to be able to work with this properly, you&#8217;ll need to <strong>create a manifest file for that library</strong> as well. This will allow you to use only one single namespace for every component/skin in the library, even though the components/skins may reside in a number of packages.</p>
<p>Now, this approach will definitely work, but you still have to apply the <em>skinClass</em> property to every component in your application. However, <strong>you can apply all the styling on your application by defining a theme CSS that accompanies the SWC file containing the skins</strong>. Let me briefly explain this process by creating a very small example.</p>
<p>In this example I&#8217;m going to create a skin for a single component, namely the <em>HSlider</em> component. I want to make it look a little bit like the iOS slider, where you have a colored fill of the slider bar that follows the slider thumb position. To make things easier, I&#8217;m going to start out in Flash Catalyst. I simply create a new project with the default settings and I&#8217;m going to create the skin from scratch. Of course, you can certainly start out with an Illustrator or a Photoshop file. The process of creating the skin will remain exactly the same.</p>
<p>First I need to create the track and duplicate that layer to have the fill color as a separate item. Next, I&#8217;m creating the thumb for the slider by drawing two concentric circles with opposite gradients, one a little smaller than the other, to create a semi 3D lighting effect. The result looks like the image below.</p>
<p><a href="http://www.flexpert.be/wp-content/Layers-panel.png"><img src="http://www.flexpert.be/wp-content/Layers-panel-300x111.png" alt="" title="iOS Slider design" width="300" height="111" class="aligncenter size-medium wp-image-810" /></a></p>
<p>The next step is to convert that design into a working component. Now, in Flash Catalyst, unless you&#8217;re putting components on the artboard, you actually just create some skin files. So, using the Heads-Up Display (HUD) I convert the artwork into a horizontal slider. After indicating the track and thumb, my skin file is now ready to be imported into Flash Builder.</p>
<p>Since I&#8217;m going to be creating a Flex theme, I don&#8217;t just save the Flash Catalyst project and open it in Flash Builder. I&#8217;m actually going to <strong>export the library components as a Flex library project (FXPL)</strong>, as shown below. When you import the FXPL file into Flash Builder it will automatically create the library project for you.</p>
<p><a href="http://www.flexpert.be/wp-content/Library-panel.png"><img src="http://www.flexpert.be/wp-content/Library-panel.png" alt="" title="Library panel" width="284" height="236" class="aligncenter size-full wp-image-816" /></a></p>
<p>If you look at the code now, you&#8217;ll see that the size of the slider skin is fixed. But <strong>since I want to create a theme that can be used in any circumstance and in any project, I need to make a few adjustments to the generated code to make the skin more dynamic</strong>. For that I&#8217;m going to make use of the <em>[HostComponent]</em> metadata tag. This gives me a reference to the actual component that this skin is applied to. Therefore I can get the size of that component and adjust the skin accordingly. The adjusted code for the main HSlider skin looks like this.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Skin</span> xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">		xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">		width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;17&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>[HostComponent(&quot;spark.components.HSlider&quot;)]<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:states</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;normal&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;disabled&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:states</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;track&quot;</span> x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;5&quot;</span> skinClass=<span style="color: #ff0000;">&quot;components.IOSSliderTrackSkin&quot;</span> width=<span style="color: #ff0000;">&quot;{hostComponent.width}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> x=<span style="color: #ff0000;">&quot;1&quot;</span> y=<span style="color: #ff0000;">&quot;6&quot;</span> width=<span style="color: #ff0000;">&quot;{thumb.x + (thumb.width / 2)}&quot;</span> height=<span style="color: #ff0000;">&quot;6&quot;</span> radiusX=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:LinearGradient</span> rotation=<span style="color: #ff0000;">&quot;90&quot;</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> alpha=<span style="color: #ff0000;">&quot;1.0&quot;</span> color=<span style="color: #ff0000;">&quot;#009CFF&quot;</span> ratio=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> alpha=<span style="color: #ff0000;">&quot;1.0&quot;</span> color=<span style="color: #ff0000;">&quot;#002FD1&quot;</span> ratio=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:LinearGradient</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;thumb&quot;</span> x=<span style="color: #ff0000;">&quot;134&quot;</span> y=<span style="color: #ff0000;">&quot;0&quot;</span> skinClass=<span style="color: #ff0000;">&quot;components.IOSSliderThumbSkin&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Skin</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>You&#8217;ll notice that I&#8217;ve bound the colored rectangle&#8217;s size to the position of the center point of the thumb. This will assure that the colored section follows the slider thumb position instead of being static and covering the whole component.<br />
Now, the default size for the slider is 300 pixels, but if you specify another width, the component will be resized properly. I didn&#8217;t take the height into account for this simple demo, but similarly you can also adjust the height of the component according to the height specified in the application.</p>
<p><strong>Next thing to do is to create a CSS file that attaches this skin to all HSlider components.</strong> This is very simple and straightforward, as you can see in the code below.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* CSS file */</span>
<span style="color: #a1a100;">@namespace s &quot;library://ns.adobe.com/flex/spark&quot;;</span>
<span style="color: #a1a100;">@namespace fc &quot;http://ns.adobe.com/flashcatalyst/2009&quot;;</span>
&nbsp;
s|HSlider <span style="color: #00AA00;">&#123;</span>
	skinClass<span style="color: #00AA00;">:</span> ClassReference<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">&quot;components.IOSSlider&quot;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>OK, so now our theme is ready to be used. There are a couple more steps to take before you an actually use it. First of all, you need to <strong>compile the library project</strong>, so you can link it to the actual project that you are going to apply the theme to. Since I&#8217;m using Flash Builder with automatic builds, this is already taken care of.</p>
<p>The next step is to load the CSS file into the theme selector, so you can actually apply the theme to the project using a few very simple clicks. For that, I&#8217;m going to the Design view in my project and click on the <em>Current Theme</em> link in the <em>Appearance</em> panel. This brings up the theme selector dialog.</p>
<p><a href="http://www.flexpert.be/wp-content/Import-theme.png"><img src="http://www.flexpert.be/wp-content/Import-theme-300x187.png" alt="" title="Import theme" width="300" height="187" class="aligncenter size-medium wp-image-823" /></a></p>
<p>In that dialog I&#8217;m importing the new theme by selecting the CSS file that I&#8217;ve just created and giving it a proper name. Since I&#8217;m going for an iOS look, I&#8217;ve simply named it <em>iOS</em>. Now, after the import, you can see the new theme displayed in the list of themes to choose from. So, obviously I choose that theme and click <em>OK</em>.</p>
<p><a href="http://www.flexpert.be/wp-content/Apply-theme.png"><img src="http://www.flexpert.be/wp-content/Apply-theme-300x181.png" alt="" title="Apply theme" width="300" height="181" class="aligncenter size-medium wp-image-825" /></a></p>
<p>Now that I have the new theme applied to the project, I can simply use a <em>HSlider</em> component in my application and it will automatically be styled according to the settings in the them. To prove that the theme is dynamically adjustable, I&#8217;m creating a component with a <em>width</em> property of 500 pixels.</p>
<p>If you compile the application now, you would get some errors, because the skin files cannot be found. <strong>The very last thing I need to do is to link the theme&#8217;s SWC file to my project.</strong> In this example I&#8217;ve just copied the SWC file to the <em>libs</em> folder in my project. However, you could create a RSL (Runtime Shared Library) even to have your theme deployed separately and only once for all your projects. The big advantage is that your resulting project SWF file doesn&#8217;t get affected by the theme and when you alter your theme, you can just deploy that RSL and every project that uses that theme will automatically be updated next time it is started up.</p>
<p>The result is a working slider bar that has dynamic content and is styled via a Flex theme inside of Flash Builder. Just try out the example below to see the result.</p>
<p><center>
<object width="550" height="50">
<param name="movie" value="http://www.flexpert.be/swfexamples/iOSTest.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<embed wmode="transparent" type="application/x-shockwave-flash" width="550" height="50" src="http://www.flexpert.be/swfexamples/iOSTest.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/04/creating-flex-themes-with-flash-catalyst/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Drawing charts in a Flex 4.5 mobile application</title>
		<link>http://www.flexpert.be/2010/12/drawing-charts-in-a-flex-4-5-mobile-application/</link>
		<comments>http://www.flexpert.be/2010/12/drawing-charts-in-a-flex-4-5-mobile-application/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 20:08:19 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[Flex 4.5]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[graphics]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=676</guid>
		<description><![CDATA[So, I started working on my first AIR on Android application that&#8217;s on the Android market. It&#8217;s called SolarLogger and it&#8217;s a small application that allows you to monitor your solar panel installation using a SolarLog device. If you&#8217;ve been here a while ago, you may remember that I had [...]]]></description>
			<content:encoded><![CDATA[<p>So, I started working on my first AIR on Android application that&#8217;s on the Android market. It&#8217;s called SolarLogger and it&#8217;s a small application that allows you to monitor your solar panel installation using a <a href="http://www.solarlog-home.eu">SolarLog device</a>.</p>
<p>If you&#8217;ve been here a while ago, you may remember that I had such a solarlogger component in my sidebar. But then I decided to remove it and turn it into a mobile application. Now, next to the standard gauge that displays the current power output, I&#8217;ve added a chart that displays the power output throughout the day. Below you can see an example of what it looks like on a sunny day. (screenshot taken from HTC Desire phone, hence the portrait orientation)</p>
<p><center><img src="http://www.flexpert.be/wp-content/mobileGraph.png" alt="Mobile Graph"></center></p>
<p>Unfortunately, in Flex 4.5 there are no charts available. That&#8217;s really a shame and I really do hope Adobe is going to put that in as well, because I can see multiple applications that use these charts. Oh well&#8230; But we have to live with it now and find another solution. Christophe Coenraets wrote an excellent <a href="http://coenraets.org/blog/2010/09/building-lightweight-mobile-ready-charts-with-fxg/">blog post</a> about using FXG to draw some lightweight charts in a mobile Flex application, but after some thorough testing I&#8217;ve found some redrawing issues with using the FXG and rotating the device.</p>
<p>The solution I came up with, is simply drawing the graph yourself using ActionScript. What you need is some container that provides you with a graphics property on which you can draw the graph, clear the current drawing and get cracking at it. In the code below you can clearly see that I&#8217;m drawing each line part of the graph manually, ending in a horizontal line until the end of the graph, filling the result with a semi-transparent color. Within this application, I&#8217;ve used a <s:Group> tag to get me the graphics property to draw on.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> d:<span style="color: #0066CC;">Date</span> = solarData.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>solarData.<span style="color: #0066CC;">length</span> - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">date</span>;
d.<span style="color: #0066CC;">setHours</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">6</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
minTime = d.<span style="color: #0066CC;">time</span>;
d.<span style="color: #0066CC;">setHours</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">22</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
maxTime = d.<span style="color: #0066CC;">time</span>;
&nbsp;
group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span>, 0X009900, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, group.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0x009900, <span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> xPos:<span style="color: #0066CC;">Number</span>;
<span style="color: #000000; font-weight: bold;">var</span> yPos:<span style="color: #0066CC;">Number</span>;
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = solarData.<span style="color: #0066CC;">length</span> - <span style="color: #cc66cc;">1</span>; i <span style="color: #66cc66;">&gt;</span>= <span style="color: #cc66cc;">0</span>; i--<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// Calculate the y coordinate on the value axis</span>
	yPos = group.<span style="color: #0066CC;">height</span> - <span style="color: #66cc66;">&#40;</span>solarData.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">P_MomentTotal</span> <span style="color: #66cc66;">/</span> maxPower<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> group.<span style="color: #0066CC;">height</span>;
	<span style="color: #808080; font-style: italic;">// Calculate the x coordinate on the time axis</span>
	xPos = <span style="color: #66cc66;">&#40;</span>solarData.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">date</span>.<span style="color: #0066CC;">time</span> - minTime<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span>maxTime - minTime<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> group.<span style="color: #0066CC;">width</span>;
	group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span>xPos, yPos<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span>xPos, group.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span>group.<span style="color: #0066CC;">width</span>, group.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
group.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>This way, you can draw whatever you want on your application without having to use heavy components or cracking your head on Bezier curves. The graph can be drawn on any device now and is still very much lightweight. If you want to download and try out the SolarLogger application on your Android device, you can use this QR code with your barcode scanner application. Enjoy!</p>
<p><img src="http://www.flexpert.be/wp-content/QRSolarLogger.png" alt="Solar Logger"></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/12/drawing-charts-in-a-flex-4-5-mobile-application/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adding swipe gestures to you mobile Flex application</title>
		<link>http://www.flexpert.be/2010/12/adding-swipe-gestures-to-you-mobile-flex-application/</link>
		<comments>http://www.flexpert.be/2010/12/adding-swipe-gestures-to-you-mobile-flex-application/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 09:18:33 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[BlackBerry PlayBook]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Hero]]></category>
		<category><![CDATA[gesture]]></category>
		<category><![CDATA[swipe]]></category>
		<category><![CDATA[touch screen]]></category>
		<category><![CDATA[TransformGestureEvent]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=661</guid>
		<description><![CDATA[With the Flex 4.5 SDK (aka Hero) you can now create some very nifty mobile applications to run on Android enabled devices as well as on the BlackBerry PlayBook. Now, one of the features you&#8217;ll use on any touch enabled device is the swipe gesture. You can use this gesture [...]]]></description>
			<content:encoded><![CDATA[<p>With the Flex 4.5 SDK (aka Hero) you can now create some very nifty mobile applications to run on Android enabled devices as well as on the BlackBerry PlayBook. Now, one of the features you&#8217;ll use on any touch enabled device is the swipe gesture. You can use this gesture to move things around or go from screen to screen etc. But how do you implement such a feature in your Flex application?</p>
<p>Well, there are 2 options you may choose from. The first one involves using ActionScript to <strong>attach an event listener</strong>. Upon initialisation of your View component, you write the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> initView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    addEventListener<span style="color: #66cc66;">&#40;</span>TransformGestureEvent.<span style="color: #006600;">GESTURE_SWIPE</span>, onSwipe<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The good thing about this method is the fact that it is exactly the same in plain ActionScript or Flash Professional projects. The second option can only be done in Flex applications and it is actually a little bit easier to implement. In fact, you just <strong>capture the gestureSwipe event on the View tag</strong>, as shown below.

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;s:View</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">            xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">            gestureSwipe=<span style="color: #ff0000;">&quot;onSwipe(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></div></div>

<p>So, that&#8217;s all there is to it for capturing the swipe on a touch enabled device, such as mobile phones, tablets or even large touch screens. But you only have one single swipe event, so <strong>how do you distinguish between a swipe left and swipe right?</strong> For that, you are going to have to use the event&#8217;s properties to determine the swipe direction. and more particularly, <strong>you&#8217;ll need the offsetX property for a horizontal swipe and the offsetY property for a vertical swipe</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onSwipe<span style="color: #66cc66;">&#40;</span>event:TransformGestureEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// A swipe to the left means the offsetX property will be -1</span>
    <span style="color: #808080; font-style: italic;">// A swipe to the right means the offsetX position will be 1</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">offsetX</span> == -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        doSwipeLeft<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">offsetX</span> == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        doSwipeRight<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// The same principle applies to the vertical swipe gesture, so</span>
    <span style="color: #808080; font-style: italic;">// a swipe to the top means the offsetY position will be -1</span>
    <span style="color: #808080; font-style: italic;">// A swipe to the bottom means the offsetY position will be 1</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">offsetY</span> == -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        doSwipeTop<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">offsetY</span> == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        doSwipeBottom<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/12/adding-swipe-gestures-to-you-mobile-flex-application/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Using your own components to convert artwork in Flash Catalyst</title>
		<link>http://www.flexpert.be/2010/10/using-your-own-components-to-convert-artwork-in-flash-catalyst/</link>
		<comments>http://www.flexpert.be/2010/10/using-your-own-components-to-convert-artwork-in-flash-catalyst/#comments</comments>
		<pubDate>Sun, 31 Oct 2010 09:53:54 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Burrito]]></category>
		<category><![CDATA[Panini]]></category>
		<category><![CDATA[skinnable components]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=631</guid>
		<description><![CDATA[With the new versions of both Flash Builder &#8220;Burrito&#8221; and Flash Catalyst &#8220;Panini&#8221; you get a whole lot of new possibilities. Well, to be honest, these possibilities should have been included from the start, but unfortunately they weren&#8217;t. But it has to be said that the development teams are working [...]]]></description>
			<content:encoded><![CDATA[<p>With the new versions of both Flash Builder &#8220;Burrito&#8221; and Flash Catalyst &#8220;Panini&#8221; you get a whole lot of new possibilities. Well, to be honest, these possibilities should have been included from the start, but unfortunately they weren&#8217;t. But it has to be said that the development teams are working very hard on improving the products in a lot of ways.</p>
<p>One such an improvement is the fact that you can now create your own custom components with skin parts in Flash Builder and use that component in the HUD (Heads-Up Display) in Flash Catalyst. That means that you&#8217;re no longer only working from Flash Catalyst towards Flash Builder, but you can go the other way around as well. Let me show you how.</p>
<p>First, you need to <strong>create a Flash Catalyst Compatible Project</strong>, which is just another option from the <em>File &gt; New</em> menu. In the project you have to <strong>create an ActionScript Skinnable Component</strong>, which can again be found in the <em>File > New</em> menu. When you do this, make sure that you have the <em>Generate Comments</em> option checked in the popup dialog, because it will help you a lot in creating your first components.</p>
<p>In the ActionScript file, you define a couple of skin states using the [SkinState] metadata tag. In this example, we are going to create an &#8220;open&#8221; and &#8220;closed&#8221; state. Then you also need to define the skin parts. This is done by using the [SkinPart] metadata tag. Optionally you can make skin parts required by defining the metadata tag as follows: [SkinPart(required:"true")]. When we define a button, text input field and a label in the skin, the resulting file will look like this.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #3f5fbf;">/* For guidance on writing an ActionScript Skinnable Component please refer to the Flex documentation: 
	www.adobe.com/go/actionscriptskinnablecomponents */</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.</span>Button<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.</span>RichText<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.</span>TextInput<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.</span>supportClasses<span style="color: #000066; font-weight: bold;">.</span>SkinnableComponent<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
&nbsp;
	<span style="color: #3f5fbf;">/* A component must identify the view states that its skin supports. 
	Use the [SkinState] metadata tag to define the view states in the component class. 
	[SkinState(&quot;normal&quot;)] */</span>
	<span style="color: #000000;">&#91;</span>SkinState<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;open&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>SkinState<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;closed&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MyCustomComponent <span style="color: #0033ff; font-weight: bold;">extends</span> SkinnableComponent
	<span style="color: #000000;">&#123;</span>
		<span style="color: #3f5fbf;">/* To declare a skin part on a component, you use the [SkinPart] metadata. 
		[SkinPart(required=&quot;true&quot;)] */</span>
		<span style="color: #000000;">&#91;</span>SkinPart<span style="color: #000000;">&#40;</span>required=<span style="color: #990000;">&quot;true&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: #6699cc; font-weight: bold;">var</span> input<span style="color: #000066; font-weight: bold;">:</span>TextInput<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#91;</span>SkinPart<span style="color: #000000;">&#40;</span>required=<span style="color: #990000;">&quot;true&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: #6699cc; font-weight: bold;">var</span> button<span style="color: #000066; font-weight: bold;">:</span>Button<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#91;</span>SkinPart<span style="color: #000000;">&#40;</span>required=<span style="color: #990000;">&quot;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: #6699cc; font-weight: bold;">var</span> label<span style="color: #000066; font-weight: bold;">:</span>RichText<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#91;</span>SkinPart<span style="color: #000000;">&#40;</span>required=<span style="color: #990000;">&quot;true&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: #6699cc; font-weight: bold;">var</span> resizeButton<span style="color: #000066; font-weight: bold;">:</span>Button<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MyCustomComponent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900; font-style: italic;">//TODO: implement function</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: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* Implement the getCurrentSkinState() method to set the view state of the skin class. */</span>
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> getCurrentSkinState<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; 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;">super</span><span style="color: #000066; font-weight: bold;">.</span>getCurrentSkinState<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span> 
&nbsp;
		<span style="color: #3f5fbf;">/* Implement the partAdded() method to attach event handlers to a skin part, 
		configure a skin part, or perform other actions when a skin part is added. */</span>	
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> partAdded<span style="color: #000000;">&#40;</span>partName<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> instance<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; 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;">super</span><span style="color: #000066; font-weight: bold;">.</span>partAdded<span style="color: #000000;">&#40;</span>partName<span style="color: #000066; font-weight: bold;">,</span> instance<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* Implement the partRemoved() method to remove the even handlers added in partAdded() */</span>
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> partRemoved<span style="color: #000000;">&#40;</span>partName<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> instance<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; 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;">super</span><span style="color: #000066; font-weight: bold;">.</span>partRemoved<span style="color: #000000;">&#40;</span>partName<span style="color: #000066; font-weight: bold;">,</span> instance<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Once you&#8217;ve completed the ActionScript Skinnable Component you then have to <strong>export the project</strong> by choosing <em>Project &gt; Flash Catalyst &gt; Export Flash Catalyst Project</em>. In Flash Catalyst you then have to open the FXP file to work on the project. Then you create some graphics to represent the component. You may end up with something like this.</p>
<p><img src="http://www.flexpert.be/wp-content/SkinnableComponent1.png" alt="" title="SkinnableComponent1" width="357" height="87" class="aligncenter size-full wp-image-632" /></p>
<p>The next step is where the magic happens, because when you select all of the graphics and you look in the HUD, you&#8217;ll notice that you can now <strong>convert those graphics into a Skinnable Component</strong>. This is the last option in the conversion dropdown. Once you&#8217;ve selected that option you&#8217;ll get a popup dialog which allows you to choose which component if you have more than one skinnable component available.</p>
<p><img src="http://www.flexpert.be/wp-content/SkinnableComponent2.png" alt="" title="SkinnableComponent2" width="340" height="300" class="aligncenter size-full wp-image-633" /></p>
<p>In this dialog you also have the option to load an FXPL library project in case the component you want is not yet loaded into the project. But since we&#8217;ve created the component inside of the project, we&#8217;re already having the component available. So, <strong>select that custom component and click OK</strong>. Once you&#8217;ve done that, you&#8217;ll notice that Flash Catalyst indicates that the component still needs some work, since you need to indicate all of the different skin parts you&#8217;ve defined earlier in Flash Builder.</p>
<p><img src="http://www.flexpert.be/wp-content/SkinnableComponent3.png" alt="" title="SkinnableComponent3" width="572" height="369" class="aligncenter size-full wp-image-636" /></p>
<p>Digging into the component, you&#8217;ll also notice the two skin states you&#8217;ve defined earlier on as well, which allows you to work with these different view states for your custom component. Now, <strong>assign the different skin parts and make some changes to the closed state</strong> to have two distinct states. For example, you can remove the label, resize the colored rectangle and change the label of the resize button in the closed state. Don&#8217;t forget to capture the click on the resize button to change view states at runtime.</p>
<p><img src="http://www.flexpert.be/wp-content/SkinnableComponent4.png" alt="" title="SkinnableComponent4" width="260" height="158" class="aligncenter size-full wp-image-638" /></p>
<p>As a final step, you just have to save the project and import it again in Flash Builder. You can overwrite the existing project now and when you run it, you&#8217;ll notice that the component is fully functioning now, as you can see below. Just hit the resize button to see it in action.</p>
<p><center>
<object width="400" height="100">
<param name="movie" value="http://www.flexpert.be/swfexamples/SkinnableComponents.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<embed wmode="transparent" type="application/x-shockwave-flash" width="400" height="100" src="http://www.flexpert.be/swfexamples/SkinnableComponents.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/10/using-your-own-components-to-convert-artwork-in-flash-catalyst/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

