<?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>Sven Dens &#187; Flex</title>
	<atom:link href="http://www.svendens.com/category/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.svendens.com</link>
	<description>deserialize me</description>
	<lastBuildDate>Tue, 22 Sep 2009 09:32:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Aced my ACE: Adobe Certified Expert Flex 3 with AIR</title>
		<link>http://www.svendens.com/adobe-air/aced-my-ace-adobe-certified-expert-flex-3-with-air/</link>
		<comments>http://www.svendens.com/adobe-air/aced-my-ace-adobe-certified-expert-flex-3-with-air/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 09:32:48 +0000</pubDate>
		<dc:creator>Sven Dens</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.svendens.com/?p=74</guid>
		<description><![CDATA[Just a quick brag post 
This morning I passed the ACE Exam &#8220;Flex 3 with AIR&#8221;.  Feels good to have that one in the bank  
To be well prepared for the exam, I read the Flex 3 documentation and the Adobe AIR 1.5 documentation, especially the documents &#8220;Developing Adobe AIR 1.5 Applications with ADOBE [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick brag post <img src='http://www.svendens.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
This morning I passed the ACE Exam &#8220;Flex 3 with AIR&#8221;.  Feels good to have that one in the bank <img src='http://www.svendens.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>To be well prepared for the exam, I read the Flex 3 documentation and the Adobe AIR 1.5 documentation, especially the documents &#8220;Developing Adobe AIR 1.5 Applications with ADOBE FLEX 3&#8243; and the &#8220;Adobe Flex 3 Developer Guide&#8221;, both available free of charge from Adobe.  I also downloaded <a href="http://software.pxldesigns.com/attest/" target="_blank">Attest</a>, an Adobe AIR application that was developed by the lovely people over at <a href="http://www.pxldesigns.com/" target="_blank">PXL Designs</a> which you can download for free, and ran all the practice exams multiple times.  Unfortunately I must say, this effort was virtually worthless for what the exam was concerned.  Not a single question from the practice exams appeared on the real exam, nor did the &#8220;toughness&#8221; of the real questions reflect those in the practice exams.</p>
<p>To be honest, I must say that I found the exam quite hard.  After all, it&#8217;s been more than 3 years since I&#8217;ve been developing in Flex, and I would have expected the exam to be rather easy for a trained developer.  However, out of the 50 questions/problems I got, I would have to digg deep and long to find 20 of those that I&#8217;ve actually ever used in real-world application development.<br />
So, reading through those PDF&#8217;s sure wasn&#8217;t a luxury to be able to pass this exam, not for me at least.</p>
<p>I know there are many possible questions out of which you&#8217;re presented 50 at the exam, so maybe I just got unlucky in the selection that I was presented with.<br />
Anyway, if you&#8217;re looking to become certified too, make sure you&#8217;re well-prepared and good luck to you!</p>
<p>Sven</p>
]]></content:encoded>
			<wfw:commentRss>http://www.svendens.com/adobe-air/aced-my-ace-adobe-certified-expert-flex-3-with-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SOAP headers in Flex and WS-Security</title>
		<link>http://www.svendens.com/flex/soap-headers-in-flex-and-ws-security/</link>
		<comments>http://www.svendens.com/flex/soap-headers-in-flex-and-ws-security/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 15:00:04 +0000</pubDate>
		<dc:creator>Sven Dens</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.svendens.be/blog/archives/27</guid>
		<description><![CDATA[UPDATE (06-16-2009): The problem with generating a correct nonce has been fixed!
It turned out to be a problem in the WSSEUsernameToken class in the com.adobe.crypto package in as3corelib.
A VERY big thank you goes to Tom from FlexibleFactory for pointing me to the solution and to Koen Weyn for fixing the bugs!
Dear readers,
I just spent 2 [...]]]></description>
			<content:encoded><![CDATA[<p style="color: #FF0000;">UPDATE (06-16-2009): The problem with generating a correct nonce has been fixed!<br />
It turned out to be a problem in the WSSEUsernameToken class in the com.adobe.crypto package in as3corelib.<br />
A VERY big thank you goes to Tom from <a href="http://flexiblefactory.co.uk">FlexibleFactory</a> for pointing me to the solution and to <a href="http://code.google.com/u/koenweyn/">Koen Weyn</a> for fixing the bugs!</p>
<p>Dear readers,</p>
<p>I just spent 2 entire days trying to figure out how to consume a SOAP Webservice that requires a SOAP-header and WS-Security in Flex.  Hopefully this post will help you out if you&#8217;re looking to do the same thing.</p>
<p><a title="SOAP headers demo files" href="http://www.svendens.com/downloads/soapheaders.zip">Download demo files here</a>.</p>
<p>Let me start off by saying that <strong>the Import Web Service (WSDL) wizard in Flex 3 doesn&#8217;t work as it should!</strong><br />
The generated classes return invalid XML to the SOAP-request, and adding headers to your request is completely neglected.<br />
But I did get it to work using the classical &lt;mx:Webservice&gt; tag and some hand-coding.</p>
<p>Here&#8217;s how to do it:</p>
<p><span id="more-20"></span>First you need a copy of the <a title="as3corelib" href="http://code.google.com/p/as3corelib/" target="_blank">as3corelib</a> (only if you need the WS-Security), more specifically you need the com.adobe.crypto.WSSEUsernameToken.as class.<br />
This class returns a token as a String, which I think is not very convenient, so I added another function called &#8220;getUsernameTokenAsArray&#8221; which returns the different token elements required for WS-Security in an Array.  This way you can just &#8220;pluck&#8221; the parts you need without having to parse a String.</p>
<p>Next you need to write some AS3 classes to map the datatypes expected by the WebService to your Flex app, and vice-versa.</p>
<p>I wrote a little utility class that lets you easily insert different types of SOAP-headers to your requests.<br />
Currently methods are implemented for returning headers containing WS-Security.  Feel free to use it and add your own methods for additional SOAP-header-types to it.<br />
Here it is:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> be<span style="color: #000066; font-weight: bold;">.</span>svendens<span style="color: #000066; font-weight: bold;">.</span>util<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>soap<span style="color: #000066; font-weight: bold;">.</span>SOAPHeader<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>adobe<span style="color: #000066; font-weight: bold;">.</span>crypto<span style="color: #000066; font-weight: bold;">.</span>WSSEUsernameToken<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> SOAPHeaderUtil<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> static const WSSE_SECURITY<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=qname%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:qname.html"><span style="color: #004993;">QName</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=qname%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:qname.html"><span style="color: #004993;">QName</span></a><span style="color: #000000;">&#40;</span> <span style="color: #990000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;Security&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> returnWSSEHeaderWithNonceAndTimestamp<span style="color: #000000;">&#40;</span>username<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> password<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> nonce<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a>=<span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> timestamp<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=date%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:date.html"><span style="color: #004993;">Date</span></a>=<span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>SOAPHeader <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> userToken<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a>&nbsp; &nbsp; = <span style="color: #990000;">&quot;UsernameToken-&quot;</span><span style="color: #000066; font-weight: bold;">+</span><a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>999999<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> wsseToken<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> &nbsp; &nbsp; = WSSEUsernameToken<span style="color: #000066; font-weight: bold;">.</span>getUsernameTokenAsArray<span style="color: #000000;">&#40;</span>username<span style="color: #000066; font-weight: bold;">,</span> password<span style="color: #000066; font-weight: bold;">,</span> nonce<span style="color: #000066; font-weight: bold;">,</span> timestamp<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> headerXML<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a> &nbsp; &nbsp; &nbsp; = <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=security%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:security.html"><span style="color: #004993;">Security</span></a> xmlns<span style="color: #000066; font-weight: bold;">:</span>wsse=<span style="color: #990000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span>UsernameToken wsu<span style="color: #000066; font-weight: bold;">:</span>Id=<span style="color: #000000;">&#123;</span>userToken<span style="color: #000000;">&#125;</span> xmlns<span style="color: #000066; font-weight: bold;">:</span>wsu=<span style="color: #990000;">'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Username<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#123;</span>wsseToken<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Username<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Password Type=<span style="color: #990000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#123;</span>wsseToken<span style="color: #000000;">&#91;</span>1<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Password<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Nonce<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#123;</span>wsseToken<span style="color: #000000;">&#91;</span>2<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Nonce<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsu<span style="color: #000066; font-weight: bold;">:</span>Created<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#123;</span>wsseToken<span style="color: #000000;">&#91;</span>3<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">&lt;/</span>wsu<span style="color: #000066; font-weight: bold;">:</span>Created<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>UsernameToken<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Security<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> header<span style="color: #000066; font-weight: bold;">:</span>SOAPHeader &nbsp; = <span style="color: #0033ff; font-weight: bold;">new</span> SOAPHeader<span style="color: #000000;">&#40;</span> WSSE_SECURITY<span style="color: #000066; font-weight: bold;">,</span> headerXML <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> header<span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> returnWSSEHeaderWithoutNonceAndTimestamp<span style="color: #000000;">&#40;</span>username<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> password<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>SOAPHeader <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> userToken<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a>&nbsp; &nbsp; = <span style="color: #990000;">&quot;UsernameToken-&quot;</span><span style="color: #000066; font-weight: bold;">+</span><a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>999999<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> wsseToken<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> &nbsp; &nbsp; = WSSEUsernameToken<span style="color: #000066; font-weight: bold;">.</span>getUsernameTokenAsArray<span style="color: #000000;">&#40;</span>username<span style="color: #000066; font-weight: bold;">,</span> password<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> headerXML<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a> &nbsp; &nbsp; &nbsp; = <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=security%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:security.html"><span style="color: #004993;">Security</span></a> xmlns<span style="color: #000066; font-weight: bold;">:</span>wsse=<span style="color: #990000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span>UsernameToken wsu<span style="color: #000066; font-weight: bold;">:</span>Id=<span style="color: #000000;">&#123;</span>userToken<span style="color: #000000;">&#125;</span> xmlns<span style="color: #000066; font-weight: bold;">:</span>wsu=<span style="color: #990000;">'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Username<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#123;</span>wsseToken<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Username<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Password Type=<span style="color: #990000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#123;</span>wsseToken<span style="color: #000000;">&#91;</span>1<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Password<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>UsernameToken<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>wsse<span style="color: #000066; font-weight: bold;">:</span>Security<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> header<span style="color: #000066; font-weight: bold;">:</span>SOAPHeader &nbsp; = <span style="color: #0033ff; font-weight: bold;">new</span> SOAPHeader<span style="color: #000000;">&#40;</span> WSSE_SECURITY<span style="color: #000066; font-weight: bold;">,</span> headerXML <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> header<span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Now you can call your webservice and add headers like this:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> header<span style="color: #000066; font-weight: bold;">:</span>SOAPHeader = SOAPHeaderUtil<span style="color: #000066; font-weight: bold;">.</span>returnWSSEHeaderWithNonceAndTimestamp<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;username&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;password&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
myService<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addHeader</span><span style="color: #000000;">&#40;</span>header<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>Basically you create an &lt;mx:Webservice&gt;, pass it the correct parameters for your webservice.  Then create a function to add the headers.<br />
Call the clearHeaders method of your webservice (it&#8217;s a default method for a webservice object) to clear any existing headers, next call the addHeader method to attach the new header.</p>
<p>Finally call your webservice operation with the necessary input parameters and there you go: a nice SOAP-envelope with headers and WS-Security!</p>
<p><a title="SOAP headers demo files" href="http://www.svendens.be/downloads/soapheaders.zip">You can download a complete demo containing all necessary classes and a sample MXML file here</a>.</p>
<div class="codecolorer-container xml mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">WSDL loaded<br />
Invoking SOAP operation CreateCTAScheduleItem<br />
Encoding SOAP request envelope<br />
Encoding SOAP request body<br />
'B5C37908-53AE-B85B-EDE1-3C3A54EB5255' producer sending message 'F9F59B36-51D7-DCC7-C673-3C3A59283DE9'<br />
'direct_http_channel' channel sending message:<br />
(mx.messaging.messages::SOAPMessage)#0<br />
body = &quot;<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SOAP-ENV:Envelope</span> <span style="color: #000066;">xmlns:SOAP-ENV</span>=<span style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;</span> <span style="color: #000066;">xmlns:xsd</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SOAP-ENV:Header<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsse:Security</span> <span style="color: #000066;">SOAP-ENV:mustUnderstand</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">xmlns:wsse</span>=<span style="color: #ff0000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsse:UsernameToken</span> <span style="color: #000066;">wsu:Id</span>=<span style="color: #ff0000;">&quot;UsernameToken-502651&quot;</span> <span style="color: #000066;">xmlns:wsu</span>=<span style="color: #ff0000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsse:Username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Flex<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsse:Username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsse:Password</span> <span style="color: #000066;">Type</span>=<span style="color: #ff0000;">&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>mA5XaNPovDGiotMyb/e8A2fiIbU=<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsse:Password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsse:Nonce<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>MDU3NDc4OTIzODE2MjMzODc=<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsse:Nonce<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsu:Created<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-02-21T14:41:39.251Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsu:Created<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsse:UsernameToken<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsse:Security<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/SOAP-ENV:Header<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SOAP-ENV:Body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;schema:CreateCTAScheduleItemRequest</span> <span style="color: #000066;">xmlns:schema</span>=<span style="color: #ff0000;">&quot;http://yournamespace&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;timePeriod<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;StartDate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-02-21T13:41:38.654Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/StartDate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;EndDate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-02-21T13:41:38.654Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/EndDate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/timePeriod<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;priority<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/priority<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cta<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cta<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;applicationURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://blog.svendens.be<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/applicationURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;repeatInterval<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/repeatInterval<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/schema:CreateCTAScheduleItemRequest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/SOAP-ENV:Body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/SOAP-ENV:Envelope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;</div></div>
<p><del datetime="2009-06-16T21:03:23+00:00">I&#8217;m still struggling with the authentication however.<br />
The SOAP-request looks exactly as it should and validates fine by the WSDL, but when using the Nonce and Created elements my username/digest and nonce keep getting rejected by the server.  Without the nonce everything works like a charm.<br />
Any of you guru&#8217;s out there know how to tackle this last problem?</del></p>
]]></content:encoded>
			<wfw:commentRss>http://www.svendens.com/flex/soap-headers-in-flex-and-ws-security/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>FlexBook in Flex3 running in Adobe AIR</title>
		<link>http://www.svendens.com/flex/flexbook-in-flex3-running-in-adobe-air/</link>
		<comments>http://www.svendens.com/flex/flexbook-in-flex3-running-in-adobe-air/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 21:25:24 +0000</pubDate>
		<dc:creator>Sven Dens</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.svendens.be/blog/archives/22</guid>
		<description><![CDATA[Dear readers,
Sorry for the long silence, it&#8217;s been extremely busy at work for the past weeks.
I&#8217;ve also been making a website for my wedding next month, and for that I wanted to use the magnificent FlexBook component written by Elijah Greenfield.  I struggled a little getting it to work on my MacBook Pro without [...]]]></description>
			<content:encoded><![CDATA[<p>Dear readers,</p>
<p>Sorry for the long silence, it&#8217;s been extremely busy at work for the past weeks.<br />
I&#8217;ve also been making a website for my wedding next month, and for that I wanted to use the <a title="FlexBook Component" href="http://www.quietlyscheming.com/blog/components/flexbook/" target="_blank">magnificent FlexBook component written by Elijah Greenfield</a>.  I struggled a little getting it to work on my MacBook Pro without FlexBuilder installed, but finally managed to get it to work and I&#8217;d love to share it with you as the tutorials for this component on the web seem to be non-existing.</p>
<p>To take it one step further, I also got it working in Flex 3 (which has been released on Adobe Labs) and running in Adobe AIR (formerly Apollo), which I thought was pretty cool <img src='http://www.svendens.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<a title="Download FlexBook/AIR sources" href="http://www.svendens.com/downloads/AIRHelloWorld.zip" target="_blank">You can download the sources here</a>.</p>
<p>To make it extremely cool, I wondered if I could get it to work in Remoting also using AMFPHP 1.9, Flex3 and running in AIR.  And so I did:-)<br />
The sources for a simple &#8220;Hello World&#8221; demo and for the AMFPHP demo are also included in the same ZIP-file.</p>
<p>As always, everything was built using only Open Source software (in my case in Eclipse using the free Flex2/Flex3 SDK, the AIR SDK and the FlexBook component, and AMFPHP 1.9), it can run on any platform at no cost.</p>
<p>If you don&#8217;t have the Flex3 SDK or Adobe AIR SDK yet, <a title="Adobe Labs" href="http://labs.adobe.com" target="_blank">head over to Adobe Labs first to download them</a>.<br />
Included in the ZIP-file is everything you need to make it run.<br />
Simply unzip the contents of the ZIP-file to a directory on your PC/Mac, create a new project in Eclipse and import the files.<br />
You&#8217;ll notice the build.properties file.  It is set up to compile the FlexBook demo by default.  However, all that is needed to compile the HelloWorld demo and the AMFPHP demo is also set-up.  All you need to do to compileone of those is comment out the appropriate lines in the build.properties file, and comment the ones you don&#8217;t need anymore.</p>
<p>For more detailed instructions on how to set up your Eclipse environment and use the ANT-templates, check out my other post: <a href="http://www.svendens.com/blog/archives/7" target="_blank">&#8220;Build and compile AS3, Flex2 and Apollo applications in Eclipse using Mac OS X&#8221;</a>.</p>
<p>Basically, to use the FlexBook component, you only need to include the namespaces xmlns:controls=&#8221;qs.controls.*&#8221; and xmlns:effects=&#8221;qs.effects.*&#8221; in your mxml file.  Make sure you use the right classpath, including it like this presumes the folder &#8220;qs&#8221; is on the same level in the hierarchy as your MXML-file.  If you unzipped the contents of my download it should be in the right place.</p>
<p>Next, you can use the FlexBook component as such:</p>
<div class="codecolorer-container xml mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;controls:FlexBook</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;book&quot;</span> <span style="color: #000066;">y</span>=<span style="color: #ff0000;">&quot;70&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;580&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;435&quot;</span> <span style="color: #000066;">horizontalCenter</span>=<span style="color: #ff0000;">&quot;0&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; <span style="color: #000066;">animateCurrentPageIndex</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; <span style="color: #000066;">animatePagesOnTurn</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; <span style="color: #000066;">activeGrabArea</span>=<span style="color: #ff0000;">&quot;corner&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; <span style="color: #000066;">edgeAndCornerSize</span>=<span style="color: #ff0000;">&quot;50&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--create the cover page in the book--&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;controls:cover<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Label</span> <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;FlexBook AIR example&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;18&quot;</span> <span style="color: #000066;">horizontalCenter</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">verticalCenter</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">textAlign</span>=<span style="color: #ff0000;">&quot;center&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/controls:cover<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--create the back cover page--&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;controls:backCover<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Label</span> <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;And now, go study and have fun :-)&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;12&quot;</span> <span style="color: #000066;">horizontalCenter</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">verticalCenter</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">textAlign</span>=<span style="color: #ff0000;">&quot;center&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/controls:backCover<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Image</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;@Embed('assets/ss1.jpg')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Image</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;@Embed('assets/ss2.jpg')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Image</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;@Embed('assets/ss3.jpg')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Image</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;@Embed('assets/ss4.jpg')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Image</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;@Embed('assets/ss5.jpg')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Image</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;@Embed('assets/ss6.jpg')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/controls:FlexBook<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>The &#8220;controls&#8221; namespace is known because you referenced it in your Application tag.  To compile, the compiler also needs to know where to find the AS3 sources for the component.  That is handled by the build.xml file which serves the right source path to the compiler (qs.*).<br />
Next, you need to provide a front- and back-cover.  Between these tags you can use any Flex component you like, like a mx:Label, mx:Text, mx:Image and so on.</p>
<p>Following the &lt;/controls:backCover&gt; tag you start creating the pages of your FlexBook.  Each component you use represents a new page in the FlexBook.  In the demo I just used 6 &lt;mx:Image&gt; tags with embedded images to create 6 photo-pages.  Feel free to replace them with your own content, or to use entirely different stuff.  You can embed webpages, video, text, htmlText, images, &#8230; or your own components.</p>
<p>To compile them for Adobe AIR, you need 1 more XML file that describes your AIR Application.  There are 3 files included in the ZIP-archive, one for each demo.</p>
<p>If the compiler gives you cr@p about compile-time constants, edit the flex-config.xml and set the &#8220;strict&#8221;-option to false.  Then you should have no more trouble compiling the sources.</p>
<p>Use it, have fun with it, study it, and let me know what you think!</p>
<p>(P.S.: I&#8217;ll be posting more demo&#8217;s on Flex2/3, AIR and combining them with AMFPHP this weekend.  One of them will be an Flex3/AMFPHP example of how to create a guestbook once I&#8217;ve written that for my wedding website.  If you speak Dutch or are just curious, go and have a look <img src='http://www.svendens.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  -&gt; <a title="The website for my wedding" href="http://www.pinnemuts.be" target="_blank">http://www.pinnemuts.be</a> And let me know what you think about it.)</p>
<p>Sven</p>
]]></content:encoded>
			<wfw:commentRss>http://www.svendens.com/flex/flexbook-in-flex3-running-in-adobe-air/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Build and compile AS3, Flex2 and Apollo applications in Eclipse on Mac OS X</title>
		<link>http://www.svendens.com/adobe-air/build-compile-as3-flex2-apollo-eclipse/</link>
		<comments>http://www.svendens.com/adobe-air/build-compile-as3-flex2-apollo-eclipse/#comments</comments>
		<pubDate>Tue, 22 May 2007 10:42:50 +0000</pubDate>
		<dc:creator>Sven Dens</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.svendens.be/blog/archives/7</guid>
		<description><![CDATA[So today I wanted to compile a simple &#8220;Hello World&#8221; app and package it as an .air-file for installation in Adobe Apollo on my Mac&#8230;
This can already be done in FlashDevelop &#8211; a great editor, but it only runs on Windows &#8211; but I couldn&#8217;t yet find a source telling me how to do it [...]]]></description>
			<content:encoded><![CDATA[<p align="left">So today I wanted to compile a simple &#8220;Hello World&#8221; app and package it as an .air-file for installation in Adobe Apollo on my Mac&#8230;</p>
<p>This can already be done in <a href="http://www.flashdevelop.org">FlashDevelop</a> &#8211; a great editor, but it only runs on Windows &#8211; but I couldn&#8217;t yet find a source telling me how to do it from Eclipse or any other editor that runs on OS X. So it was time to roll-up my sleeves and figure out a way to do it.<br />
Didn&#8217;t turn out to be hard at all, using <a href="http://ant.apache.org/">ANT</a> and starting off from the <a href="http://www.boostworthy.com/blog/?p=140">nice Apollo ANT-template for FlashDevelop built by Ryan Taylor</a>.</p>
<p><span id="more-4"></span>First, a few things you&#8217;ll need before we kick off:</p>
<ol>
<li>Flex 2 SDK: download it from Adobe at <a href="http://www.adobe.com/products/flex/sdk/">http://www.adobe.com/products/flex/sdk/</a></li>
<li>Apollo runtime and SDK: download it from Adobe at <a href="http://labs.adobe.com/technologies/apollo/">http://labs.adobe.com/technologies/apollo/</a></li>
<li>Apache ANT: if you don&#8217;t have it yet (if you&#8217;re on OS X, you have it!), download it from <a href="http://ant.apache.org/bindownload.cgi">http://ant.apache.org/bindownload.cgi</a></li>
<li>Flash 9 debug player: download it from Adobe at <a href="http://www.adobe.com/support/flashplayer/downloads.html#fp9">http://www.adobe.com/support/flashplayer/downloads.html#fp9</a></li>
</ol>
<p>Install the SDK&#8217;s and the Apollo runtime.<br />
Download and unzip the <a href="http://www.svendens.com/downloads/OSX_ria_template.zip">OSX_ria_template.zip</a> to a location on your hard-drive.</p>
<p align="left">Next, fire up Eclipse and start a new project (File -&gt; new -&gt; project -&gt; General -&gt; project).<br />
I called mine &#8220;HelloWorld&#8221;, but you can use anything you like.</p>
<p align="left">Go back to Eclipse and right-click your project name, choose &#8220;Import&#8221; and import the files you just unzipped. You&#8217;ll probably be asked to overwrite the .project file, answer YES.<br />
<a href="http://www.flickr.com/photos/sventunus/499224674/" target="_blank">view screenshot on Flickr</a><br />
<a href="http://www.flickr.com/photos/sventunus/499224652/" target="_blank">view screenshot on Flickr</a></p>
<p align="left">You should now have a couple of folders:</p>
<ul>
<li>deploy</li>
<li>docs</li>
<li>html_template</li>
<li>icons</li>
<li>src</li>
</ul>
<p>and 3 files:</p>
<ul>
<li>application.xml</li>
<li>build.properties</li>
<li>build.xml</li>
</ul>
<p><a href="http://www.flickr.com/photos/sventunus/499273983/" target="_blank">view screenshot on Flickr</a></p>
<p align="left">The template contains everything you need to build and run Flash/Flex/Apollo apps from ActionScript source files or MXML (Flex2) source files.</p>
<p align="left">The build.properties file is where you&#8217;ll want to edit some stuff to make it match your Mac.<br />
First, let&#8217;s look at the important ones. Scroll down to the bottom of the file and find a line that starts with &#8220;flex2.dir&#8221;.<br />
Change the following lines to match the locations on your system where the SDK&#8217;s, browsers and Flash Player are installed:</p>
<blockquote>
<p align="left"># Location of the Flex 2 SDK and Apollo SDK directories.<br />
flex2.dir=/Users/desv/development/sdk/flex2<br />
apollo.dir=/Users/desv/development/sdk/apollo</p>
<p align="left"># Browsers &#8211; add others if you wish<br />
firefox=/Applications/Firefox.app<br />
safari=/Applications/Safari.app</p>
<p align="left"># Location of the Flash 9 debug player<br />
saplayer=/Applications/Adobe/FlashPlayers/FlashPlayer9_debug.app</p></blockquote>
<p align="left">Note there are <strong>NO TRAILING SLASHES</strong>!</p>
<p align="left"><a href="http://www.flickr.com/photos/sventunus/499273963/" target="_blank">view screenshot on Flickr</a></p>
<p align="left">Also in this file is mentioned what you want to use as source (mxml or as files), and where you want the output to go (browser, Flash Player, Apollo AIR file, Apollo Debug Launcher, &#8230;).<br />
Changing lines 27 and 36 in the build.properties file define this.<br />
The documentation should speak for itself.</p>
<p align="left"><a href="http://www.flickr.com/photos/sventunus/499224612/" target="_blank">view screenshot on Flickr</a></p>
<p align="left">That&#8217;s it, nothing left to do but compile now <img src='http://www.svendens.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
So how do you go about that?</p>
<p align="left">In the Eclipse menu, click Run -&gt; External Tools -&gt; External Tools.<br />
Create a new Ant configuration by clicking the top-left icon and give it a new (I used AS3MXMLCompile). On the Main tab, under &#8220;Buildfile&#8221;, click Browse Workspace and select the build.xml file. Under &#8220;Base Directory&#8221;, click Browse Workspace and select your project.</p>
<p align="left"><a href="http://www.flickr.com/photos/sventunus/499240614/" target="_blank">view screenshot on Flickr</a></p>
<p align="left">Now hit &#8220;Run&#8221; and you should see a &#8220;Hello World&#8221; window popping up in the Apollo Debug Launcher. Congratulations, you&#8217;ve just compiled your first Flex/Apollo app in Eclipse on OS X!</p>
<p><a href="http://www.flickr.com/photos/sventunus/499240572/" target="_blank">view screenshot on Flickr</a></p>
<p align="left">To try other combinations, check out the build.properties file and change the parameters on lines 27 and 36.</p>
<p align="left">I&#8217;ve documented all the steps in both build.xml and build.properties, so you *should* be able to figure out the rest for yourself.</p>
<p align="left">Let me know how you like it! <img src='http://www.svendens.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p align="left">Sven</p>
]]></content:encoded>
			<wfw:commentRss>http://www.svendens.com/adobe-air/build-compile-as3-flex2-apollo-eclipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
