<?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>Kalen Gibbons &#187; Flex</title>
	<atom:link href="http://www.kalengibbons.com/blog/index.php/category/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kalengibbons.com/blog</link>
	<description>The Dead Tree Blog</description>
	<lastBuildDate>Mon, 24 Oct 2011 20:43:10 +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>ActionScript Design Pattern Samples: The Singleton</title>
		<link>http://www.kalengibbons.com/blog/index.php/2010/03/actionscript-design-pattern-samples-the-singleton/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2010/03/actionscript-design-pattern-samples-the-singleton/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 07:28:09 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=421</guid>
		<description><![CDATA[I&#8217;ve decided to write a short blog series on ActionScript design patterns. This series will NOT contain in-depth discussions about the patterns, when to use them, why to use them, or any of that. Rather, each post will have a working example that demonstrates a pattern in use, and will be accompanied by a brief [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to write a short blog series on ActionScript design patterns.  This series will NOT contain in-depth discussions about the patterns, when to use them, why to use them, or any of that.  Rather, each post will have a working example that demonstrates a pattern in use, and will be accompanied by a brief description of key points.  These working samples may serve as a functional reference for myself or anyone else who may find them useful.  Enjoy.</p>
<h3>The Singleton Pattern</h3>
<p>The Singleton Pattern is a very commonly used pattern in ActionScript; Cairngorm&#8217;s ModelLocator is one of the most popular examples that people may be familiar with.  In short, a Singleton is used when you want to guarantee that only one instance of a class can exist.  </p>
<p>Why would you want this? Well, to avoid conflicts for one.  Imagine you have an application with a shopping cart, and various items can be added to the cart from different sections of your application.  You&#8217;d typically want all a user&#8217;s products in a single shopping cart.  If multiple carts existed each would have their its products, its own total, and it would be difficult (and problematic) to manage them all at checkout.  So how could you ensure that only one shopping cart exists, especially if you have multiple developers working on the different sections of the application?  The answer is to make the shopping cart class a Singleton, which ensures that only a single instance of the Singleton class can exist.</p>
<h3>The Code</h3>
<p>So, how can the Singleton pattern ensure that only one instance of a class exists?  Simple, limit access to the class&#8217; constructor and require the class to instantiate itself.  This is typically done with a private constructor in other languages, but ECMAScript, the current standard that ActionScript 3.0 is based on, does not support private constructors. So instead, we create a class like the following:</p>
<p><script src='http://pastie.org/862699.js'></script></p>
<ol>
<li>
<strong>Prohibit constructor access:</strong> The easiest way to prevent access to a class&#8217; constructor is to require a parameter that only the class itself has access to. In the example, the SingletonEnforcer class is declared in such a way that it cannot be accessed by any class other than <code>ShoppingCart</code>.  Then, by requiring the SingletonEnforcer class to be passed into its constructor, the <code>ShoppingCart</code> class ensures that it cannot be instantiated by anything else; it&#8217;s responsible for it&#8217;s own creation.
</li>
<li>
<strong>Provide a single entry point:</strong> Since Singleton classes cannot be instantiated directly, there needs to be an entry point for external classes to request an instance.  The <code>getInstance()</code> method serves this purpose.  It must be a static method for it to be exposed without requiring an existing instance of the class. This method simply checks to see if an internal instance exists (stored as the <code>instance</code> variable), creates an instance if not, and then returns that single instance.
</li>
</ol>
<h3>The Sample</h3>
<p>And here&#8217;s a working example, you can <a href="http://www.kalengibbons.com/assets/pages/srcview/singletonpattern/" target="_blank">view the source code here</a>.</p>
<div style="text-align:center">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_singletonPattern_443649463"
			class="flashmovie"
			width="610"
			height="470">
	<param name="movie" value="/assets/flash/singletonPattern.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/assets/flash/singletonPattern.swf"
			name="fm_singletonPattern_443649463"
			width="610"
			height="470">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>
<p>And that&#8217;s it.  Please let me know if you have any questions, comments, or suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2010/03/actionscript-design-pattern-samples-the-singleton/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Learning Parsley, Part 1: Dependency Injection</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/11/learning-parsley-part-1-dependency-injection/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/11/learning-parsley-part-1-dependency-injection/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 04:59:01 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[Parsley]]></category>
		<category><![CDATA[series]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=373</guid>
		<description><![CDATA[I decided to take a look at SpiceFactory&#8217;s Parsely framework for Flex, and I was pretty impressed. When I started to dig into the framework I discovered that although the framework&#8217;s documentation was very good, there weren&#8217;t many community examples or tutorials for the framework. So I decided to create a short series on getting [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="SpiceFactorys Parsley Framework" src="/assets/images/parsleyCog.gif" title="SpiceFactorys Parsley Framework" width="115" height="100" align="left" />I decided to take a look at <a href="http://www.spicefactory.org/parsley/">SpiceFactory&#8217;s Parsely framework</a> for Flex, and I was pretty impressed.  When I started to dig into the framework I discovered that although the framework&#8217;s documentation was very good, there weren&#8217;t many community examples or tutorials for the framework.  So I decided to create a short series on getting started with Parsley.  The examples in the series will be fairly simple and no advanced topics will be discussed; my aim is to help developers get a jump-start on development, by providing simple examples of working code. </p>
<h3>Defining Object Dependencies</h3>
<p>We&#8217;ll begin by learning how to add dependency injection into an application.  First, we need to recognize our object dependencies.  In the sample application below, the <b>ContactList</b> view requires the <b>ContactManager</b> model object to provide its data.  In Parsley, marking that dependency as an injection point is as simple as adding the <em>[Inject]</em> metadata tag above the property declaration.  </p>
<p>Parsley can also inject properties into constructors and other methods, and you can find more information on that <a href="http://www.spicefactory.org/parsley/docs/2.1/manual/injection.php#intro">here</a>.</p>
<div class="code">
<span class="mxmlSpecialString">&lt;mx:Script&gt;</span></p>
<div class="indent">&lt;![CDATA[</p>
<p>&nbsp;</p>
<div class="indent">
<span class="asReserved">import</span> com.kalengibbons.contactsManager.model.ContactManager;</p>
<p>&nbsp;</p>
<p>[Inject]<br />
[<span class="asReserved">Bindable</span>]<br />
<span class="asReserved">public</span> <span class="asVar">var</span> contactManager:ContactManager; </div>
<p>&nbsp;</p>
<p>]]&gt;</p></div>
<p><span class="mxmlSpecialString">&lt;/mx:Script&gt;</span>
</div>
<h3>Creating the IOC Container</h3>
<p>Next, we need to tell Parsley where to find the <b>ContactManager</b> class before it can inject it into the view.  To do this, we need to add it to the IOC Container, which is responsible for wiring all our dependencies together.  The container can be written as MXML, ActionScript, XML, or a combination of the three.  For more information on using these methods you can view the documentation <a href="http://www.spicefactory.org/parsley/docs/2.1/manual/config.php#intro">here</a>.  For this example, we will look at an MXML configuration.  To do this, simply create an MXML file with mx:Object as the root tag, and add references to the objects that we will need to wire, like so:</p>
<div class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
<span class="mxmlComponent">&lt;mx:Object</span> xmlns=&quot;<span class="mxmlString">*</span>&quot; xmlns:mx=&quot;<span class="mxmlString">http://www.adobe.com/2006/mxml</span>&quot;</p>
<div class="indent">
xmlns:model=&quot;<span class="mxmlString">com.kalengibbons.contactsManager.model.*</span>&quot;<span class="mxmlComponent">&gt;</span>
</div>
<p>&nbsp;</p>
<p><span class="mxmlComponent indent">&lt;model:ContactManager /&gt;</span></p>
<p>&nbsp;</p>
<p><span class="mxmlComponent">&lt;/mx:Object&gt;</span>
</div>
<h3>Wiring the View</h3>
<p>The framework won&#8217;t know to look in our <b>ContactList</b> view for injection points unless we tell it to.  To do this, we need to also add the view into the IOC Container.  There are two ways of doing this.  We could explicitly declare it in the container like we did in the previous step for the <b>ContactManager</b>.  But for views, Parsley allows us to dynamically wire them by simply dispatching a single configuration event like so:</p>
<div class="code">
<span class="mxmlComponent">&lt;mx:VBox</span> xmlns:mx=&quot;<span class="mxmlString">http://www.adobe.com/2006/mxml</span>&quot;<br />
<span class="indent">addedToStage=&quot;<span class="asReserved">this</span>.dispatchEvent( <span class="asReserved">new</span> Event(<span class="asString">&#8216;configureView&#8217;</span>, <span class="asReserved">true</span>) );&quot;<span class="mxmlComponent">&gt;</span></span>
</div>
<p>The <em>configureView</em> event tells Parsley that the view should be added to the IOC Container at runtime.</p>
<h3>Initializing the Framework</h3>
<p>Finally, to put it all together, we need to initialize the framework and provide Parsley with the IOC Container we created.  We want to do this as early as possible so doing this on the <em>addedToStage</em> event is common practice.  Simply call the <em>FlexContextBuilder.build()</em> method and provide the IOC Container and the root DisplayObject used for wiring (typically the application root).</p>
<div class="code">
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
    <span class="mxmlComponent">&lt;mx:Application</span> xmlns:mx=&quot;<span class="mxmlString">http://www.adobe.com/2006/mxml</span>&quot; layout=&quot;<span class="mxmlString">vertical</span>&quot;</p>
<div class="indent">
    xmlns:views=&quot;<span class="mxmlString">com.kalengibbons.contactsManager.views.*</span>&quot;<br />
    addedToStage=&quot;addedToStageHandler()&quot;<span class="mxmlComponent">&gt;</span></p>
<p>&nbsp;</p>
<p> <span class="mxmlSpecialString">&lt;mx:Script&gt;</span></p>
<div class="indent">&lt;![CDATA[</p>
<p>&nbsp;</p>
<div class="indent">
    <span class="asReserved">import</span> com.kalengibbons.contactsManager.config.ContactManagerConfig;<br />
    <span class="asReserved">import</span> org.spicefactory.parsley.flex.FlexContextBuilder;</p>
<p>&nbsp;</p>
<p>    <span class="asReserved">private</span> function addedToStageHandler():<span class="asReserved">void</span>{</p>
<div class="indent">
    <span class="asComment">// configure the IoC container</span><br />
    FlexContextBuilder.build(ContactManagerConfig, <span class="asReserved">this</span>);
    </div>
<p>    }
  </div>
<p>    ]]&gt;
    </p></div>
<p>    <span class="mxmlSpecialString">&lt;/mx:Script&gt;</span></p>
<p>&nbsp;</p>
<p>  <span class="mxmlComponent">&lt;views:ContactList width=&quot;</span><span class="mxmlString">100%</span><span class="mxmlComponent">&quot; height=&quot;</span><span class="mxmlString">100%</span><span class="mxmlComponent">&quot; /&gt;</span></p></div>
<p>&nbsp;</p>
<p>  <span class="mxmlComponent">&lt;/mx:Application&gt;</span></p>
</div>
<p>Here is a working example of the code.  The application is very simple; when you click the button it simply populates the <b>ContactModel</b> object with data, which is bound to the DataGrid.  The key is to notice how the <b>ContactModel</b> has successfully been injected into the view.</p>
<p>You can view the <a href="http://www.kalengibbons.com/assets/pages/srcview/contactsmanager/">source code here</a>.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_contactsManager_377529025"
			class="flashmovie"
			width="750"
			height="500">
	<param name="movie" value="/assets/flash/contactsManager.swf" />
	<param name="bgcolor" value="#000000" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/assets/flash/contactsManager.swf"
			name="fm_contactsManager_377529025"
			width="750"
			height="500">
		<param name="bgcolor" value="#000000" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3>Points to Remember</h3>
<ul>
<li>Dependency injection takes time, and your objects might not be immediately available.  In your views, even after the creationComplete event, your objects may still be null.  So what you need to do is use <em>[Init]</em> metadata to designate a function for Parsley to run after injection is complete.  Using this instead of a Flex event will ensure that your objects are all available and ready for use.
</li>
<li>Don&#8217;t forget to add the application root to the IOC Container, if necessary.  Even though you may initialize the framework in the application root, and use it as the view root of the Context, you will still need to dispatch the <em>configureView</em> event if you need dependency injection to take place in the application root.</li>
</ul>
<h3>Conclusion</h3>
<p>If you haven&#8217;t done so already, please read the <a href="http://www.spicefactory.org/parsley/docs/2.1/manual/">Parsley Documentation</a> for more information about dependency injection and the Parsley framework.  And like I stated in the intro, I&#8217;m new to Parsley myself so if anyone would like make corrections or suggest any best practices, please feel free to do so in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/11/learning-parsley-part-1-dependency-injection/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Update: Debugging Flex on a remote server</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/10/update-debugging-flex-on-a-remote-server/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/10/update-debugging-flex-on-a-remote-server/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 06:18:10 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[Flex Builder]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=354</guid>
		<description><![CDATA[In a previous post I described a hack I used for debugging Flex applications on a remote server. Well, shorty after making that post I stumbled upon a much better way of doing this. Flex Builder actually has functionality built into it to allow remote debugging, you just need to know where to find it. [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.kalengibbons.com/blog/index.php/2009/07/debugging-flex-on-a-remote-server/">previous post</a> I described a hack I used for debugging Flex applications on a remote server.  Well, shorty after making that post I stumbled upon a much better way of doing this.  Flex Builder actually has functionality built into it to allow remote debugging, you just need to know where to find it.</p>
<ol>
<li>
First, compile a debug version of your application and upload it to your remote server.<br/><br/>
</li>
<li>
Second, go to the Run/Debug Settings panel by clicking Project >> Properties and selecting the Run/Debug Settings option from the list.  There, you should see another list of launch configurations for your project.  Most likely, you&#8217;ll only have one, which will match the name of your application.  Select it and click on the &#8220;Edit&#8230;&#8221; button.<br/><br/>
</li>
<li>
Next, find the &#8220;URL or path to launch&#8221; section and deselect the &#8220;Use defaults&#8221; checkbox.  Within the first text input titled &#8220;Debug,&#8221; place the URL to your remote server.  This URL can point to the SWF file or to an HTML page that loads the SWF, the debugger will connect either way.<br />
If you&#8217;re connecting to the SWF directly you may need to add ?debug=true to your querystring.  If you are connecting to an HTML page &#8211; make sure it loads the debug version of your SWF and not the release build.<br/><br/>
</li>
<li>
Finally, save your project properties and run the debugger as normal.  You&#8217;ll see that the debugger will connect to the SWF file on your remote server and you can debug the same way you would locally, using breakpoints, expressions and everything else.<br/><br />
<img alt="" src="/assets/images/remoteDebugging_launchConfiguration.png" title="Remote Debugging - Launch configuration window" class="aligncenter" width="662" height="528" />
</li>
<li>
That&#8217;s it&#8230; enjoy!<br/><br/></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/10/update-debugging-flex-on-a-remote-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Presenting @ the IECFUG on Thursday</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/07/presenting-the-iecfug-on-thursday/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/07/presenting-the-iecfug-on-thursday/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 04:34:41 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[IECFUG]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=341</guid>
		<description><![CDATA[I&#8217;ll be presenting at the IECFUG this Thursday the 9th. The session will be a hands-on tutorial on connecting ColdFusion and Flex. It should be a good time, so come on down if you&#8217;re in the area. I&#8217;ll post the sample files here sometime after the meeting. It&#8217;s a little late, but here are the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be presenting at the <a href="http://iecfug.com/">IECFUG</a> this Thursday the 9th.  The session will be a hands-on tutorial on connecting ColdFusion and Flex. It should be a good time, so come on down if you&#8217;re in the area.</p>
<p><del datetime="2009-10-09T19:47:39+00:00">I&#8217;ll post the sample files here sometime after the meeting.</del><br />
It&#8217;s a little late, but here are the links to the files and the presentation, enjoy <img src='http://www.kalengibbons.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<a href="http://www.kalengibbons.com/assets/files/CF2FX.zip">Presentation Files</a><br />
<a href="http://experts.na3.acrobat.com/p45336977">Presentation on Adobe Connect</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/07/presenting-the-iecfug-on-thursday/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging Flex on a remote server</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/07/debugging-flex-on-a-remote-server/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/07/debugging-flex-on-a-remote-server/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 19:49:58 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[Flex Builder]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=327</guid>
		<description><![CDATA[Note: An update to this topic has been posted here. It provides a better solution than the one offered below, so I recommend you check it out before continuing. Have you ever had a Flex application that worked fine in your development environment but not when you moved it to your production server? How do [...]]]></description>
			<content:encoded><![CDATA[<p class="notice">Note: An update to this topic has been posted <a href="http://www.kalengibbons.com/blog/index.php/2009/10/update-debugging-flex-on-a-remote-server/">here</a>.  It provides a better solution than the one offered below, so I recommend you check it out before continuing.</p>
<p>Have you ever had a Flex application that worked fine in your development environment but not when you moved it to your production server?  How do you debug the problem?</p>
<p>You can use the following trick to enable Flex Builder to establish a debug connection to a remote server.</p>
<ol>
<li>
First, compile a debug version of the application and deploy it to your remote server.
</li>
<li>
Then go into the project&#8217;s properties in Flex Builder (Project >> Properties >> Flex Build Path) and change the &#8220;Output folder URL&#8221; to an invalid URL (this can be almost anything).<br/><br />
<img src="/assets/images/remoteDebug_badUrl.png" alt="Remote Debug: Bad URL" />
</li>
<li>
Compile your application again in debug mode.  This time, Flex Builder will launch the invalid url and will not be able to connect to the debugger.<br/><br />
<img src="/assets/images/remoteDebug_connecting.jpg" alt="Remote Debug: Connecting to debugger" />
</li>
<li>
While Flex Builder is waiting to connect to the debugger, navigate to the debug SWF that you put on your remote server.  Don&#8217;t forget to include <code>?debug=true </code>in the querystring.
</li>
<li>
Flex Builder will connect to the remote swf the same way it would have connected to your local version.  You can use breakpoints, inspect variables, and do everything you could do locally. <br/><br />
<img src="/assets/images/remoteDebug_debugPanel.png" alt="Remote Debug: Debug Panel" />
</li>
</ol>
<p>This trick comes in really handy when you have problem related to a specific environment.  I hope this can help ease the pains of debugging for some of you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/07/debugging-flex-on-a-remote-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a scroll-to list in Flex</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/06/creating-a-scroll-to-list-in-flex/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/06/creating-a-scroll-to-list-in-flex/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 20:31:25 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[AnimatedProperty]]></category>
		<category><![CDATA[easingFunction]]></category>
		<category><![CDATA[verticalScrollPosition]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=273</guid>
		<description><![CDATA[Here is an example of how you can create a scroll-to list using the AnimateProperty class. In this example I&#8217;m using a repeater instead of a List for simplicity, but for large data sets this would not be recommended. I have a DataGrid on the left hand side that simply lists the release date and [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an example of how you can create a scroll-to list using the <a href="http://livedocs.adobe.com/flex/3/langref/mx/effects/AnimateProperty.html" target="_blank">AnimateProperty</a> class.  In this example I&#8217;m using a repeater instead of a List for simplicity, but for large data sets this would not be recommended.</p>
<p>I have a DataGrid on the left hand side that simply lists the release date and title of several upcoming movie releases.  If you click on a row, the list on the right will scroll to the details for the movie selected.</p>
<p><a href="http://www.kalengibbons.com/assets/pages/srcview/scrollToList/index.html" target="_blank">&#8211; View application source &#8211;</a><br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_scrolltolist_211884108"
			class="flashmovie"
			width="750"
			height="400">
	<param name="movie" value="/assets/flash/scrolltolist.swf" />
	<param name="bgcolor" value="#000000" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/assets/flash/scrolltolist.swf"
			name="fm_scrolltolist_211884108"
			width="750"
			height="400">
		<param name="bgcolor" value="#000000" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The code is pretty straightforward, but there two main pieces to look at.  The first is how to use the AnimateProperty class to scroll the list to the desired location. The second, is how to allow the last item in the list to scroll all the way to the top.</p>
<h3>Scrolling to an item in the list</h3>
<div class="code">
<span class="asReserved">import</span> mx.effects.easing.Sine;<br />
<span class="asReserved">import</span> mx.effects.AnimateProperty;<br />
<span class="asReserved">import</span> mx.events.ListEvent;<br />
&nbsp;<br />
<span class="asReserved">private</span> <span class="asVar">var</span> scrollAnimation:AnimateProperty = <span class="asReserved">new</span> AnimateProperty();<br />
&nbsp;<br />
<span class="asReserved">private</span> <span class="asFunction">function</span> scrollToMovie(event:ListEvent):y{</p>
<div class="indent"><span class="asVar">var</span> yPosition:int = movieWrapper.getChildAt(event.rowIndex).y;<br />
scrollAnimation.stop();<br />
scrollAnimation.property = &quot;verticalScrollPosition&quot;;<br />
scrollAnimation.easingFunction = Sine.easeOut;<br />
scrollAnimation.duration = 900;<br />
scrollAnimation.toValue = yPosition;<br />
scrollAnimation.play([movieWrapper]);</div>
<p>}</p></div>
<h3>Allowing the last list item to scroll to the top</h3>
<div class="code">
<span class="asReserved">private</span> <span class="asFunction">function</span> addSpaceToBottom():<span class="asReserved">void</span>{</p>
<div class="indent">
<span class="asReserved">if</span>(movieWrapper.numChildren &gt; 2){</p>
<div class="indent">
<span class="asVar">var</span> lastChild:HBox = movieWrapper.getChildAt(movieWrapper.numChildren-2) <span class="asReserved">as</span> HBox;<br />
<span class="asVar">var</span> spacerHeight:int = movieWrapper.height &#8211; lastChild.height;<br />
<span class="asReserved">if</span>(spacerHeight &gt; 0)</p>
<div class="indent">spacerBottom.height = spacerHeight;</div>
</div>
<p>}</p></div>
<p>}
</p></div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/06/creating-a-scroll-to-list-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Performance testing static methods versus instance methods</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/05/performance-testing-static-methods-versus-instance-methods/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/05/performance-testing-static-methods-versus-instance-methods/#comments</comments>
		<pubDate>Wed, 06 May 2009 04:14:29 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[instance method]]></category>
		<category><![CDATA[performance testing]]></category>
		<category><![CDATA[static method]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=280</guid>
		<description><![CDATA[I was creating several static methods at work today and I started to wonder about how static methods perform versus instance methods. So I created a quick test, that simply calls a static method 5,000,000 times and an instance method the same number of times. Both methods are identical, they simply return true, but as [...]]]></description>
			<content:encoded><![CDATA[<p>I was creating several static methods at work today and I started to wonder about how static methods perform versus instance methods.  So I created a quick test, that simply calls a static method 5,000,000 times and an instance method the same number of times.  Both methods are identical, they simply return true, but as you can see from the results, the static method executes 20-50% slower than the instance method.</p>
<p>To test for yourself, simply click the &quot;Test Instance Method&quot; button to run the instance method test, and then when it’s done you can click the button again to start the static method test.  Your results for each test are displayed in the DataGrid.  All times are represented in milliseconds.</p>
<div style="text-align: center">
You can <a href="http://www.kalengibbons.com/assets/pages/srcview/MethodTesting/" target="_blank">view the source of this application here</a>.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_MethodTesting_1142334354"
			class="flashmovie"
			width="575"
			height="250">
	<param name="movie" value="/assets/flash/MethodTesting.swf" />
	<param name="bgcolor" value="#000000" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/assets/flash/MethodTesting.swf"
			name="fm_MethodTesting_1142334354"
			width="575"
			height="250">
		<param name="bgcolor" value="#000000" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/05/performance-testing-static-methods-versus-instance-methods/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Custom Printing with Flex, Part 3: Printing Data</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/04/custom-printing-with-flex-part-3-printing-data/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/04/custom-printing-with-flex-part-3-printing-data/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 06:19:52 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[AlivePDF]]></category>
		<category><![CDATA[Custom Printing with Flex]]></category>
		<category><![CDATA[series]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=254</guid>
		<description><![CDATA[In the first article of this series, I discussed how to prevent users from printing directly from Flash&#8217;s default context menu. In the second article, I wrote about using the AlivePDF library to create PDFs from your application for printing or saving. Today I will be covering how to print application data from Flex. The [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.kalengibbons.com/blog/index.php/2009/02/custom-printing-with-flex-part-1-overriding-flashs-built-in-printing/">first article</a> of this series, I discussed how to prevent users from printing directly from Flash&#8217;s default context menu.  In the <a href="http://www.kalengibbons.com/blog/index.php/2009/03/custom-printing-with-flex-part-2-generating-pdfs-with-alivepdf/">second article</a>, I wrote about using the <a href="http://alivepdf.org/" target="_blank">AlivePDF</a> library to create PDFs from your application for printing or saving. Today I will be covering how to print application data from Flex.</p>
<p>The Flex framework comes with several classes to assist you in printing; however, they don&#8217;t tend to produce the greatest results.  The <a href="http://livedocs.adobe.com/flex/3/langref/mx/printing/PrintDataGrid.html" target="_blank">PrintDataGrid</a> class is probably your best option when it comes to printing data, but whenever I&#8217;ve worked with it in the past I&#8217;ve always ended up disappointed.  Even after formatting, there are always issues; like rows getting cut off and pages breaks in weird places.</p>
<p>There have been talks about AlivePDF offering a Grid class to the library, which may be interesting, but it hasn&#8217;t been released and would probably only handle DataGrid data. So the best option I&#8217;ve found for printing data is to allow a server to generate a PDF, which can then be sent back to Flex and output however you want.</p>
<p>A great benefit of this option is the ability to easily format the print results.  You can use simple HTML and CSS to customize the printout much easier than you could using ActionScript.  You can also add custom styles, letterheads, and footers to fit your needs.</p>
<p>Here is an example, you can <a target="_blank" href="http://www.kalengibbons.com/assets/pages/srcview/PrintDataExample/index.html">view the source here</a>.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_PrintDataExample_954747325"
			class="flashmovie"
			width="750"
			height="500">
	<param name="movie" value="/assets/flash/PrintDataExample.swf" />
	<param name="bgcolor" value="#000000" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/assets/flash/PrintDataExample.swf"
			name="fm_PrintDataExample_954747325"
			width="750"
			height="500">
		<param name="bgcolor" value="#000000" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>This will work with any server-side script that can generate PDF content.  In this demo I am using a ColdFusion script which simply generates an HTML table and returns it in PDF format.  You can view the ColdFusion code along with the rest of the source code <a target="_blank" href="http://www.kalengibbons.com/assets/pages/srcview/PrintDataExample/index.html">here</a>.</p>
<p>The data from the server is returned to Flex as a ByteArray.  You can take that ByteArray and output it to the user in several different ways:</p>
<h3>Using the Browser</h3>
<p>Similar to the last article in this series, you can send the results to a server-side script to either display the PDF in the browser or prompt the user to open or save the document. This time, however, the AlivePDF library is no longer necessary since the PDF binary has already been created.</p>
<div class="code">
<span class="asReserved">private</span> <span class="asFunction">function</span> generatePDF(pdfBinary:ByteArray, method:String):<span class="asReserved">void</span>{</p>
<div class="indent">
		<span class="asComment">//result comes back as binary, create a new URL request and pass it back to the server</span><br />
        <span class="asVar">var</span> header:URLRequestHeader = <span class="asReserved">new</span> URLRequestHeader(&quot;<span class="asString">Content-type</span>&quot;, &quot;<span class="asString">application/octet-stream</span>&quot;);<br />
        <span class="asVar">var</span> urlString:String = &quot;<span class="asString">http://kalengibbons.com/assets/pages/pdfCreator.cfm</span>&quot;;<br />
        <span class="asReserved">if</span>(method == &quot;<span class="asString">inline</span>&quot;)</p>
<div class="indent">
        urlString += &quot;<span class="asString">?method=inline</span>&quot;;		</div>
<p>        <span class="asReserved">else</span></p>
<div class="indent">
        urlString += &quot;<span class="asString">?method=attachment&amp;name=dataPrintSample.pdf</span>&quot;;		</div>
<p>        <span class="asVar">var</span> sendRequest:URLRequest = <span class="asReserved">new</span> URLRequest(urlString);<br />
        sendRequest.requestHeaders.push(header);<br />
        sendRequest.method = URLRequestMethod.POST;<br />
        sendRequest.data = pdfBinary;<br />
        navigateToURL(sendRequest, &quot;<span class="asString">_blank</span>&quot;);		</div>
<p>        }
</p></div>
<h3>Save locally from Flash</h3>
<p>Thanks to new capabilities in <a href="http://www.adobe.com/products/flashplayer/features/" target="_blank">Flash Player 10</a>, you can also provide users the option to save the PDF directly from Flash.  This eliminates the need for the second server-side script.</p>
<div class="code">
<span class="asReserved">private</span> <span class="asFunction">function</span> savePDF(pdfBinary:ByteArray):<span class="asReserved">void</span>{</p>
<div class="indent">
		<span class="asVar">var</span> fileRef:FileReference = <span class="asReserved">new</span> FileReference();<br />
        fileRef.save(pdfBinary, &quot;<span class="asString">yourPrintout.pdf</span>&quot;);		</div>
<p>        }
</p></div>
<p>If you plan to use the save functionality you&#8217;ll need to set the &#8220;Required Flash Player version&#8221; in your project preferences to 10.0.0 or higher or else Flex Builder will complain.  You have to remember that only users with Flash Player 10 or above will be able to use this functionality, so some type of version validation is a necessity.</p>
<p>Another caveat is that the save method must be triggered by some type of <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=kb405546" target="_blank">user interaction</a>, that&#8217;s why the sample application prompts for system access before saving.  Although the user has clicked the &#8220;Print Data&#8221; button, that event is lost when the server call is made, so we need another interaction from the user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/04/custom-printing-with-flex-part-3-printing-data/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Custom Printing with Flex, Part 2: Generating PDFs with AlivePDF</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/03/custom-printing-with-flex-part-2-generating-pdfs-with-alivepdf/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/03/custom-printing-with-flex-part-2-generating-pdfs-with-alivepdf/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 08:10:27 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[AlivePDF]]></category>
		<category><![CDATA[Custom Printing with Flex]]></category>
		<category><![CDATA[series]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=191</guid>
		<description><![CDATA[In the first article of this series, Overriding Flash’s Built-In Print Option, I discussed how to prevent users from printing directly from Flash, by replacing the default context menu. I demonstrated how poorly Flash handles printing directly, and now we will start discussing what alternatives are available to developers. In this article I will demonstrate [...]]]></description>
			<content:encoded><![CDATA[<p>In the first article of this series, <a href="http://www.kalengibbons.com/blog/index.php/2009/02/custom-printing-with-flex-part-1-overriding-flashs-built-in-printing/">Overriding Flash’s Built-In Print Option</a>, I discussed how to prevent users from printing directly from Flash, by replacing the default context menu.  I demonstrated how poorly Flash handles printing directly, and now we will start discussing what alternatives are available to developers.</p>
<p>In this article I will demonstrate how to print and save any part of your application by utilizing the <a href="http://www.alivepdf.org/" target="_blank">AlivePDF library</a>.  AlivePDF is  an ActionScript 3 open-source PDF library that easily creates PDF documents from your Flex application.  The library is pretty robust and offers much more functionality than I will be able to cover here.  In this article I want to demonstrate how simple it is to dynamically generate PDF documents using ActionScript and AlivePDF.</p>
<p>To give you a better understanding of what can be done with AlivePDF, let&#8217;s revisit one of the printing examples that was used in <a href="http://www.kalengibbons.com/blog/index.php/2009/02/custom-printing-with-flex-part-1-overriding-flashs-built-in-printing/">part 1</a> of the series.  The two images below are printouts of the The <a href="http://examples.adobe.com/flex2/inproduct/sdk/flexstore/flexstore.html" target="_blank">Flex Store</a> &#8211; one printed with Flash&#8217;s default print option and the other with AlivePDF.</p>
<table>
<tr>
<td>
<strong>Flex Store printed using Flash&#8217;s default print option</strong><br />
<img src="/assets/images/flexStore_printout.jpg" alt="Flex Store Printed from Flash" />
</td>
<td>
<strong>Flex Store printed using AlivePDF</strong><br />
<img src="/assets/images/flexStore_alivePDF.jpg" alt="Flex Store PDF created with AlivePDF" />
</td>
</tr>
</table>
<p>In addition, here is a sample application for you to play with some of AlivePDF&#8217;s options.  You can <a href="http://www.kalengibbons.com/assets/pages/srcview/AlivePDFExample/index.html" target="_blank">view the source here</a>.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AlivePDFExample_934407241"
			class="flashmovie"
			width="750"
			height="500">
	<param name="movie" value="/assets/flash/AlivePDFExample.swf" />
	<param name="bgcolor" value="#000000" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/assets/flash/AlivePDFExample.swf"
			name="fm_AlivePDFExample_934407241"
			width="750"
			height="500">
		<param name="bgcolor" value="#000000" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>So now that you&#8217;ve had a taste of what AlivePDF can do, lets look at how it works:</p>
<h3>Adding AlivePDF to your project</h3>
<p>First, download the library from <a href="http://www.alivepdf.org/" target="_blank">www.AlivePDF.org</a>, and then add it to your project in one of two ways.  The easiest way is to copy the AlivePDF.swc into your project&#8217;s <em>lib</em> folder.  Flex Builder should automatically detect the swc and add it to the compile settings.  The second approach is to add it manually in Flex Builder, by clicking Project >> Properties >> Flex Build Path >> Library Path >> Add SWC&#8230; and selecting the swc from the file system.</p>
<h3>Displaying PDFs in the Browser</h3>
<p>After the swc has been added to your project you can begin working with the AlivePDF library.  The sample code below could be used to generate a PDF document from any UI component in your application.  We simply turn it into an image (think of it as a screenshot) and publish it to a PDF for the user to save or print.  </p>
<p>The code is fairly simple, we start by creating a new instance of the PDF class and adding a page to it. Then we add our UIComponent to the document as an image.  Finally, we tell AlivePDF how we want to generate the PDF with the save() method.  In this example, the third argument of the method, Download.INLINE, specifies that we want the PDF to be displayed in the browser instead of prompting the user to save (that will be covered in the next section).</p>
<div class="code">
<p><span class="asReserved">import</span> mx.core.UIComponent;</p>
<p>&nbsp;</p>
<p><span class="asReserved">import</span> org.alivepdf.display.Display;<br />
        <span class="asReserved">import</span> org.alivepdf.images.ResizeMode;<br />
        <span class="asReserved">import</span> org.alivepdf.layout.Layout;<br />
        <span class="asReserved">import</span> org.alivepdf.layout.Orientation;<br />
        <span class="asReserved">import</span> org.alivepdf.layout.Size;<br />
        <span class="asReserved">import</span> org.alivepdf.layout.Unit;<br />
        <span class="asReserved">import</span> org.alivepdf.pdf.PDF;<br />
        <span class="asReserved">import</span> org.alivepdf.saving.Download;</p>
<p><span class="asReserved">import</span> org.alivepdf.saving.Method;</p>
<p>&nbsp;</p>
<p>
        <span class="asReserved">private</span> <span class="asFunction">function</span> doPrint(whatToPrint:UIComponent):<span class="asReserved">void</span>{</p>
<div class="indent">
		<span class="asVar">var</span> printPDF:PDF = <span class="asReserved">new</span> PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );<br />
        printPDF.setDisplayMode( Display.FULL_PAGE, Layout.SINGLE_PAGE );<br />
        printPDF.addPage();<br />
        printPDF.addImage( whatToPrint, 0, 0, 0, 0, <span class="asString">&#8216;PNG&#8217;</span>, 100, 1, ResizeMode.FIT_TO_PAGE );<br />
        printPDF.save( Method.REMOTE, <span class="asString">&quot;/includes/pdfCreator.cfm&quot;</span>, Download.INLINE, <span class="asString">&quot;test.pdf&quot;</span> );    </div>
<p>    }</p>
</div>
<h3>Prompting Users to Save</h3>
<p>Now that works great and all&#8230; but what if you want to prompt the user to save or open in Adobe Reader?  Fortunately, AlivePDF makes that easy; all you have have to do is change Download.INLINE to Download.ATTACHMENT.</p>
<div class="code">
printPDF.save( Method.REMOTE, <span class="asString">&quot;/includes/pdfCreator.cfm&quot;</span>, Download.ATTACHMENT, <span class="asString">&quot;test.pdf&quot;</span> );
</div>
<h3>Using AlivePDF with ColdFusion</h3>
<p>A PHP script is provided with the download of the AlivePDF library, but if you don&#8217;t like PHP you can use any other server-side language that can generate PDF content.  For those of you who are ColdFusion fans, like myself, here is a basic example of a ColdFusion script that can be used.</p>
<div class="code">
<p><span class="cfComment">&lt;!&ndash;&ndash;&ndash; establish parameters &ndash;&ndash;&ndash;&gt;</span><br />
        <span class="cfTag">&lt;cfparam name=</span><span class="cfString">&quot;URL.method&quot;</span><span class="cfTag"> default=</span><span class="cfString">&quot;&quot;</span><span class="cfTag"> /&gt;<br />
&lt;cfparam name=</span><span class="cfString">&quot;URL.name&quot;</span><span class="cfTag"> default=</span><span class="cfString">&quot;&quot;</span><span class="cfTag"> /&gt;</span></p>
<p>&nbsp;</p>
<p>        <span class="cfComment">&lt;&ndash;&ndash;&ndash; get the content from the http data &ndash;&ndash;&ndash;&gt;</span><br />
        <span class="cfTag">&lt;cfset</span> httpContent = <span class="cfReserved">GetHttpRequestData()</span><span class="cfTag">&gt;</span><br /><br/>
    </p>
<p><span class="cfComment">&lt;!&ndash;&ndash;&ndash; make sure content was passed in &ndash;&ndash;&ndash;&gt;</span><br />
        <span class="cfTag">&lt;cfif</span> <span class="cfReserved">len(</span>httpContent.content<span class="cfReserved">)</span> <span class="cfReserved">gt</span> <span class="cfNumber">0</span><span class="cfTag">&gt;</span></p>
<div class="indent">
			<span class="cfComment">&lt;!&ndash;&ndash;&ndash; write the content to local pdf &ndash;&ndash;&ndash;&gt;</span><br />
<span class="cfTag">&lt;cfheader name=</span><span class="cfString">&quot;Content-Disposition&quot;</span><span class="cfTag"> value=</span><span class="cfString">&quot;#URL.method#; filename=#URL.name#&quot;</span>&nbsp;<span class="cfTag">/&gt;</span><br />
			<span class="cfTag">&lt;cfcontent type=</span><span class="cfString">&quot;application/pdf&quot;</span> <span class="cfTag">variable=</span><span class="cfString">&quot;#httpContent.content#&quot;</span><span class="cfTag">&gt;</span></div>
<p>	    <span class="cfTag">&lt;cfelse&gt;</span></p>
<div class="indent">
		<span class="cfComment">&lt;!&ndash;&ndash;&ndash; redirect to home page &ndash;&ndash;&ndash;&gt;</span><br />
		<span class="cfTag">&lt;cflocation url=</span><span class="cfString">&quot;/&quot;</span><span class="cfTag"> /&gt;</span></div>
<p>	<span class="cfTag">&lt;/cfif&gt;</span> </p>
</div>
<p>AlivePDF has a wide range of capabilities and we&#8217;ve barely scratched the surface here.  I encourage you to take a good look at the library and utilize it to its full potential.</p>
<p>In the next article in this serious we will discuss how to print data from Flex.  See you soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/03/custom-printing-with-flex-part-2-generating-pdfs-with-alivepdf/feed/</wfw:commentRss>
		<slash:comments>96</slash:comments>
		</item>
		<item>
		<title>Flex vs Silverlight: Debate at Cal Poly Pomona</title>
		<link>http://www.kalengibbons.com/blog/index.php/2009/02/flex-vs-silverlight-debate-at-cal-poly-pomona/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2009/02/flex-vs-silverlight-debate-at-cal-poly-pomona/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 21:15:24 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Cal Poly Pomona]]></category>
		<category><![CDATA[Debate]]></category>
		<category><![CDATA[Kevin Hoyt]]></category>
		<category><![CDATA[Sam Stokes]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog/?p=187</guid>
		<description><![CDATA[If you haven&#8217;t seen it yet, check out the debate between Adobe&#8217;s Kevin Hoyt and Microsoft&#8217;s Sam Stokes, which was presented last week at Cal Poly Pomona. Although my perspective is admittedly a bit skewed, seeing as I love Flex and hate Microsoft, I think the victor is fairly obvious. The Microsoft presentation was very [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t seen it yet, check out the debate between Adobe&#8217;s Kevin Hoyt and Microsoft&#8217;s Sam Stokes, which was presented last week at Cal Poly Pomona.  Although my perspective is admittedly a bit skewed, seeing as I love Flex and hate Microsoft, I think the victor is fairly obvious.  </p>
<p>The Microsoft presentation was very weak, relying heavily on the strength of one image manipulation library and a couple &#8220;non-Silverlight&#8221; services.  Even I expected more from Microsoft.  Give the video a watch and see if you agree.</p>
<p><a href="http://video.csupomona.edu/streaming/Events/FutureOfComputing.html" target="_blank">http://video.csupomona.edu/streaming/Events/FutureOfComputing.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2009/02/flex-vs-silverlight-debate-at-cal-poly-pomona/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

