<?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>Curious Minds Media Labs -</title>
	<atom:link href="http://www.curiousm.com/labs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.curiousm.com/labs</link>
	<description>ActionScript, ColdFusion, and Flash Tutorials</description>
	<lastBuildDate>Thu, 25 Aug 2011 23:25:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Building an iPhone/iPad/Android compatible HTML5 video player &#8211; Part 2: Support for Multiple Videos</title>
		<link>http://www.curiousm.com/labs/2011/08/25/building-an-iphoneipadandroid-compatible-html5-video-player-part-2-support-for-multiple-videos/</link>
		<comments>http://www.curiousm.com/labs/2011/08/25/building-an-iphoneipadandroid-compatible-html5-video-player-part-2-support-for-multiple-videos/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 23:16:42 +0000</pubDate>
		<dc:creator>Shannon</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[IPad]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[video]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1389</guid>
		<description><![CDATA[In part one, I showed you how to build a simple HTML5 video player. In part two, I will show you a way to create a simple video player that can display multiple videos. Step 1: Processing the video covers and thumbnails First things first, let&#8217;s process everything we will need for our player. Go [...]]]></description>
			<content:encoded><![CDATA[<p>In part one, I showed you how to build a simple HTML5 video player. In part two, I will show you a way to create a simple video player that can display multiple videos.</p>
<p><img class="alignnone size-full wp-image-1399" title="HTML5 Video Player" src="http://www.curiousm.com/labs/files/2011/08/vidPlayer.jpg" alt="" width="560" height="420" /></p>
<p><strong>Step 1: Processing the video covers and thumbnails</strong><br />
First things first, let&#8217;s process everything we will need for our player. Go ahead and export your videos in MP4 and OGG format and produce the poster images you will need (<a href="http://www.curiousm.com/labs/2011/07/01/building-an-iphoneipadandroid-compatible-html5-video-player-part-1/">see part 1</a> for the steps on how to do this). Next, produce the thumbnails for each video. The size is completely up to you, and depends on how many videos you are displaying and the layout of your player.<br />
Once you have your videos, poster images and thumbnails ready, place them all into your folder (mine is named &#8220;vids&#8221;) and continue on to step two.</p>
<p><strong>Step 2: Linking to jQuery</strong><br />
I use <a href="http://jquery.com/" target="_blank">jQuery</a> on virtually every project, it is a great framework for adding functionality to your site. You can link to jQuery in two ways: 1) download it and host it on your server or 2) use the hosted version. For this project, I used the hosted version, here is the code for that (just add it to the head of your file):</p>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>
<p><strong>Step 3: Adding the videos to your page</strong><br />
At this point, we what to put all of the code on the page that we need to show all of the videos plus the Flash version for IE. For my example, I will be using three videos, here is what my HTML code looks like:</p>
<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vid1&quot;</span>&gt;</span>
        <span style="color: #009900;">&lt;video controls poster<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid1.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;640&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;480&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid1.mp4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/mp4&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid1.theora.ogv&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/ogg&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">object</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;application/x-shockwave-flash&quot;</span> <span style="color: #000066;">data</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swf/videos.swf&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;640&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;480&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;allowfullscreen&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;allowScriptAccess&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sameDomain&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;wmode&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;transparent&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flashvars&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file=vids/vid1.mp4&quot;</span>&gt;</span>
            <span style="color: #808080; font-style: italic;">&lt;!--[if IE]&gt;&lt;!--&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;movie&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swf/videos.swf&quot;</span>&gt;</span>
            <span style="color: #808080; font-style: italic;">&lt;!--&lt;![endif]--&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid1.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;640&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;480&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Video&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">object</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>video&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vid2&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;video controls poster<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid2.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;640&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;480&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid2.mp4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/mp4&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid2.theora.ogv&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/ogg&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>video&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vid3&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;video controls poster<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid3.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;640&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;480&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid3.mp4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/mp4&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid3.theora.ogv&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/ogg&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>video&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>
<p>Here is how the structure breaks down: we first want a containing div with an ID of &#8220;vids&#8221;. Within this, we want containing divs for each video (three in my case). I named mine &#8220;vid1&#8243;, &#8220;vid2&#8243; and &#8220;vid3&#8243;. Each of these divs will hold the HTML5 video tags with the MP4 file followed by the OGG one for Firefox. Within the first div (#vid1), we also want to put the Flash embed fallback code for IE. This should go within the first video tag, directly after our OGG video is listed, before the first closing video tag. If you were to preview your page at this point, you would see the three videos one after another (Chrome, FF, Safari) or the single Flash player (IE).</p>
<p><strong>Step 4: Setting up the thumbs</strong><br />
Here is how my code looks for the thumbnails (this code immediately follows my closing div tag above):</p>
<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vidThumbs&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids.html&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids.html?vid=2&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids.html?vid=3&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>
<p>My containing div has an ID of &#8220;vidThumbs&#8221;, within this are my three thumbnails. Notice they are all linked to my &#8220;vids.html&#8221; page, but for #2 and #3, I have added &#8220;?vid=number&#8221; to the end. This will come into play soon.</p>
<p><strong>Step 5: adding the CSS</strong><br />
The next step is to add the CSS to style our thumbnails and give us the option of hiding the videos we do not what to be visible.<br />
I decided to use a yellow border when my thumbnails were moused over and in their active state.<br />
Here is my CSS for them:</p>
<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">#vidThumb1,#vidThumb2{
	display:block;
	width:118px;
	height:100px;
	border: #000 5px solid;
	float:left;
}
#vidThumbs a:hover #vidThumb1,#vidThumbs a:hover #vidThumb2{
	border:#FC0 5px solid;
}
#vidThumb1.active,#vidThumb2.active{
	border:#FC0 5px solid;
}</pre></div></div>
<p>So the thick yellow border will only show when I want it to. One note: be sure and set the initial border color to the background of your page if you are going to use this approach.<br />
One last simple piece of CSS that will hide the 2 videos we don&#8217;t what visible when another one is active:</p>
<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">.hide {
	display:none;
}</pre></div></div>
<p>Make sure to use display:none; rather than visibility:hidden: as they behave differently. We what to completely take the non-active videos out of the DOM.</p>
<p><strong>Step 6: adding the Javascript</strong><br />
We want to make it so that the following conditions are met:<br />
-if we are on <em>vids.html</em> page, we want to show vid1, make vidThumb1 active and hide the other two videos<br />
-if we are on <em>vids.html?vid=2</em>, we want to show vid2, make vidThumb2 active and hide the other two videos<br />
-if we are on <em>vids.html?vid=3</em>, we want to show vid3, make vidThumb3 active and hide the other two videos<br />
The easiest way to do this is with a bit of javascript, here&#8217;s how it looks:</p>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> query_string<span style="color: #339933;">=</span>document.<span style="color: #660066;">location</span>.<span style="color: #660066;">search</span><span style="color: #339933;">;</span>
    query_string<span style="color: #339933;">=</span>query_string.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> query_string_value<span style="color: #339933;">=</span>query_string<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>query_string_value<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#vid2'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#vidThumb1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>query_string_value<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#vid1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#vidThumb2'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>query_string_value<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;3&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#vid3'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#vidThumb3'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<p>First we check that our page is ready, then we check for the presence of a query string in our url. Depending on the value, we show and hide the appropriate videos and make the selected thumbnail active. Note: it&#8217;s basically the same three &#8220;if&#8221; statements in a row, if I was making a player with more than three videos I would create a loop to make it easier to add videos later without having to touch the javascript.</p>
<p>So now that everything is set, we can click on our three thumbnails and show the appropriate video to play. I hope you enjoyed the tutorial on how to make a simple HTML5 video player, if you have any suggestions on how to make it better, feel free to let me know in the comments. Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/08/25/building-an-iphoneipadandroid-compatible-html5-video-player-part-2-support-for-multiple-videos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSV / XLS Exporting in Adobe Coldfusion 9</title>
		<link>http://www.curiousm.com/labs/2011/08/19/csv-xls-exporting-in-adobe-coldfusion-9/</link>
		<comments>http://www.curiousm.com/labs/2011/08/19/csv-xls-exporting-in-adobe-coldfusion-9/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 15:23:50 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[cfspreadsheet]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[spreadsheet]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1368</guid>
		<description><![CDATA[Let’s talk about XLS Exporting in Adobe Coldfusion 9 (Excel Spreadsheets). ColdFusion has this neat little tag called cfspreadsheet. It allows the writing of, updating of, and reading of CSV/XLS files in ColdFusion. This is a handy tool for exporting dynamically generated queries. It can make XLS Exporting in Adobe Coldfusion 9 very simple and [...]]]></description>
			<content:encoded><![CDATA[<p>Let’s talk about XLS Exporting in Adobe Coldfusion 9 (Excel Spreadsheets). ColdFusion has this neat little tag called <a href="http://www.curiousm.com//help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec17cba-7f87.html”">cfspreadsheet</a>. It allows the writing of, updating of, and reading of CSV/XLS files in ColdFusion. This is a handy tool for exporting dynamically generated queries. It can make XLS Exporting in Adobe Coldfusion 9 very simple and easy to implement. For example, generating reports and listings of information. Adobe documented the cfspreadsheet tag as such:</p>
<p><strong>Description</strong><br />
1. Manages Excel spreadsheet files<br />
2. Reads a sheet from a spreadsheet file and stores it in a ColdFusion spreadsheet object, query, CSV string, or HTML string.<br />
3. Writes single sheet to a new XLS file from a query, ColdFusion spreadsheet object, or CSV string variable.<br />
4. Add a sheet to an existing XLS file.</p>
<p>The description as outlined above shows that this tag is very useful, and can write XLS files from <a href="http://www.curiousm.com//help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7fae.html”">cfquery</a> objects, csv string variables, or html strings. You can also write a custom ColdFusion function to upload an XLS file, read the content, and input it into a database. However, XLS Exporting in Adobe Coldfusion 9 has its downsides.<span id="more-1368"></span></p>
<p>The problems with using the cfspreadsheet tag arise when your code logic that builds a ColdFusion spreadsheet object becomes lengthy. When manipulating a ColdFusion spreadsheet object, it slows down your code exponentially. This means the more you have to process, the longer it takes to do so. I got to the point where I could pull a 10,000 record cfquery from the database in 3-4 seconds, but it would take me about 4-5 minutes to put together the ColdFusion spreadsheet object and formatting it the way I wanted it.</p>
<p>Below is an example of a lengthy ColdFusion spreadsheet object being put together and exported to an .xls file.</p>
<pre class="brush: coldfusion; title: ; notranslate">
&lt;cfscript&gt;
	theDir=GetDirectoryFromPath(GetCurrentTemplatePath());
   theFile=theDir &amp; &quot;ExampleReport.xls&quot;;
	theSheet = SpreadsheetNew(&quot;testSpreadsheet&quot;);
&lt;/cfscript&gt;
&lt;cfset spacer = &quot;,,&quot;&gt;
&lt;cfset newTitle = &quot;Event / Ticket Type,Quantity&quot;&gt;
&lt;cfset SpreadsheetAddRow(theSheet,newTitle)&gt;
&lt;cfset tempCITY = ''&gt;
&lt;cfset tempTIME = ''&gt;
&lt;cfset totalTicketsArray = ArrayNew(1) /&gt;
&lt;cfloop query=&quot;collection.TICKETTYPES&quot;&gt;
	&lt;cfif #CITYNAME# NEQ tempCITY OR #PERFORMANCETIME# NEQ tempTIME&gt;
		&lt;cfset tempCITY = #CITYNAME#&gt;
		&lt;cfset tempTIME = #PERFORMANCETIME#&gt;
		&lt;cfif currentrow NEQ '1'&gt;
				&lt;cfset arraySum = &quot;Total Tickets: ,#REReplace(numberFormat(arraySum(totalTicketsArray)), &quot;,&quot;, &quot;&quot;, &quot;All&quot;)#&quot; /&gt;
				&lt;cfset SpreadsheetAddRow(theSheet,arraySum)&gt;
				&lt;cfset tmp = ArrayClear(totalTicketsArray)&gt;
 				&lt;/cfif&gt;
 				&lt;cfset SpreadsheetAddRow(theSheet,spacer)&gt;
		&lt;cfset newRowHeader = &quot;#CITYNAME#  ( #timeService.getFormattedDateDSTSimple(PERFORMANCETIME,TIMEZONEOFFSET)# @ #timeService.getFormattedTime(PERFORMANCETIME,TIMEZONEOFFSET)# )&quot;&gt;
		&lt;cfset SpreadsheetAddRow(theSheet,newRowHeader)&gt;
	&lt;/cfif&gt;
	&lt;cfset newTicket = &quot;#REReplace(TICKETNAME, &quot;,&quot;, &quot;&quot;, &quot;All&quot;)#,#TICKETQTY#&quot;&gt;
	&lt;cfset SpreadsheetAddRow(theSheet,newTicket)&gt;
	&lt;cfset arrayAppend(totalTicketsArray, #TICKETQTY#) /&gt;
	&lt;cfif currentrow EQ recordcount&gt;
			&lt;cfset arraySum = &quot;Total Tickets: ,#REReplace(numberFormat(arraySum(totalTicketsArray)), &quot;,&quot;, &quot;&quot;, &quot;All&quot;)#&quot; /&gt;
			&lt;cfset SpreadsheetAddRow(theSheet,arraySum)&gt;
			&lt;cfset tmp = ArrayClear(totalTicketsArray)&gt;
				&lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;cfset SpreadsheetAddRow(theSheet,spacer)&gt;
&lt;cfset newTitle = &quot;Payment Method,Amount&quot;&gt;
&lt;cfset SpreadsheetAddRow(theSheet,newTitle)&gt;
&lt;cfset tempCITY = ''&gt;
&lt;cfset tempTIME = ''&gt;
&lt;cfset tmp = ArrayClear(totalTicketsArray)&gt;
&lt;cfloop query=&quot;collection.CARDTYPES&quot;&gt;
	&lt;cfif #CITYNAME# NEQ tempCITY OR #PERFORMANCETIME# NEQ tempTIME&gt;
		&lt;cfset tempCITY = #CITYNAME#&gt;
		&lt;cfset tempTIME = #PERFORMANCETIME#&gt;
		&lt;cfif currentrow NEQ '1'&gt;
				&lt;cfset arraySum = &quot;Total Tickets: ,#REReplace(dollarFormat(arraySum(totalTicketsArray)), &quot;,&quot;, &quot;&quot;, &quot;All&quot;)#&quot; /&gt;
				&lt;cfset SpreadsheetAddRow(theSheet,arraySum)&gt;
				&lt;cfset tmp = ArrayClear(totalTicketsArray)&gt;
 				&lt;/cfif&gt;
 				&lt;cfset SpreadsheetAddRow(theSheet,spacer)&gt;
		&lt;cfset newRowHeader = &quot;#CITYNAME#  ( #timeService.getFormattedDateDSTSimple(PERFORMANCETIME,TIMEZONEOFFSET)# @ #timeService.getFormattedTime(PERFORMANCETIME,TIMEZONEOFFSET)# )&quot;&gt;
		&lt;cfset SpreadsheetAddRow(theSheet,newRowHeader)&gt;
	&lt;/cfif&gt;
	&lt;cfset newTicket = &quot;#REReplace(CARDTYPE, &quot;,&quot;, &quot;&quot;)#,#REReplace(dollarFormat(TICKETSALES), &quot;,&quot;, &quot;&quot;, &quot;All&quot;)#&quot;&gt;
	&lt;cfset SpreadsheetAddRow(theSheet,newTicket)&gt;
	&lt;cfset arrayAppend(totalTicketsArray, #TICKETSALES#) /&gt;
	&lt;cfif currentrow EQ recordcount&gt;
			&lt;cfset arraySum = &quot;Total Tickets: ,#REReplace(dollarFormat(arraySum(totalTicketsArray)), &quot;,&quot;, &quot;&quot;, &quot;All&quot;)#&quot; /&gt;
			&lt;cfset SpreadsheetAddRow(theSheet,arraySum)&gt;
			&lt;cfset tmp = ArrayClear(totalTicketsArray)&gt;
				&lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;cfspreadsheet
    action=&quot;write&quot;
	format=&quot;csv&quot;
    filename=&quot;#theFile#&quot;
	sheetname=&quot;ExampleReport&quot;
	name=&quot;theSheet&quot;
    overwrite=&quot;true&quot; /&gt;
</pre>
<p>The first part of the code is a <a href="http://www.curiousm.com//help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ebf.html”">cfscript</a> tag, which puts together the directory and spreadsheet variables that will be used to create the final spreadsheet file. Then follows some complex code logic that iterates through a ColdFusion variable called “collection”. This variable I instantiated previously as a ColdFusion structure that holds two cfquery variables, TICKETTYPES and CARDTYPES. I wanted both these queries to be added to the .xls spreadsheet.</p>
<p>In this complex code, I iterate through portions of each query, ordering them by a specific date value inside each query row. So, for example, my .xls spreadsheet would have headers on the top and for each instance of a specific date, include the TICKETTYPES (and then for the second part of the spreadsheet, the CARDTYPES).</p>
<p>For two queries of 10,000 rows each (one for TICKETTYPES and one for CARDTYPES) this complex code was taking forever to format a ColdFusion spreadsheet object. So I came up with a simple solution. When you format a query inside the SQL to display the way you want it on the spreadsheet, it offloads work from the ColdFusion server and onto the SQL database. In the end, all I had to do was include the below code to turn the generated cfquery into an .xls spreadsheet.</p>
<pre class="brush: coldfusion; title: ; notranslate">
&lt;cfscript&gt;
	theDir=GetDirectoryFromPath(GetCurrentTemplatePath());
    file1=theDir &amp; &quot;ExampleReports.xls&quot;;
&lt;/cfscript&gt;
&lt;cfspreadsheet
    action=&quot;write&quot;
    filename=&quot;#file1#&quot;
	sheetname=&quot;TicketTypes&quot;
	query=&quot;collection.TICKETTYPES&quot;
    overwrite=&quot;true&quot; /&gt;
&lt;cfspreadsheet
    action=&quot;update&quot;
    filename=&quot;#file1#&quot;
	sheetname=&quot;CardTypes&quot;
	query=&quot;collection.CARDTYPES&quot; /&gt;
</pre>
<p>The code for the first cfspreadsheet tag takes the first query and writes an .xls file to display records exactly as shown in the query variable. The second cfspreadsheet tag updates the current .xls file and adds a second spreadsheet onto it (Excel Spreadsheets can have multiple pages, or different spreadsheets in the same .xls file).</p>
<p>This brings the entire processing time down from 4-5 minutes, to 4-5 seconds. That’s a HUGE difference! Sure, I don’t have all the formatting capabilities that ColdFusion allows for me to have. But the point of understanding came when I realized the people using the spreadsheet need everything laid out in simple rows. They didn’t need headers, spacers or data that was spread out in any fashion. They just needed a row-by-row list of raw data. So, this solution worked out perfectly. This makes XLS Exporting in Adobe Coldfusion 9 very easy to use.</p>
<p>Always remember, when programming using a combined group of different languages (i.e. &#8211; Adobe ColdFusion 9 with an MS SQL Database) you can always offload work from one to the other, depending on the application. Here, we took a 4-5 minute process in ColdFusion and gave that job to the database, which helped it run in less than 4-5 seconds. Using this methodology, you can program less and achieve more, and produce efficient applications and web sites!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/08/19/csv-xls-exporting-in-adobe-coldfusion-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tools of the Trade &#8211;  free web development tools for Mac OSX</title>
		<link>http://www.curiousm.com/labs/2011/07/15/free-web-development-tools/</link>
		<comments>http://www.curiousm.com/labs/2011/07/15/free-web-development-tools/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 15:48:21 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1363</guid>
		<description><![CDATA[One of the things that I love the most about coding, and the web in general is the development of open and free standards. Along with those open and free standards comes the web development tools needed to build and deploy web applications. Here is a collection of some of our favorites, so download and [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that I love the most about coding, and the web in general is the development of open and free standards. Along with those open and free standards comes the web development tools needed to build and deploy web applications. Here is a collection of some of our favorites, so download and enjoy!</p>
<p><span id="more-1363"></span></p>
<p>#1 <a href="http://www.mamp.info" target="_blank">MAMP</a>. I love this program. MAMP is the everything you need in one download: APACHE web server, PHP, and MySQL installation for OSX. Simply put, it&#8217;s the easiest way to get your testing stack up and running on your local machine. We use MAMP mainly for local testing, but it is suitable for full production servers. You can get it here.</p>
<p>#2. <a href="http://dev.mysql.com/downloads/workbench/5.1.html" target="_blank">MySQL Workbench</a>. When I begin a project, I typically start with the database, if it requires one. There are a lot of database management tools out there that run on OSX, but there are not many that allow you to visualize a project, and work on it from ER diagram prospective. While there are still quite a few annoying bugs in the current version of the workbench, it&#8217;s still an invaluable tool for database development</p>
<p>#3. <a href="http://www.macupdate.com/app/mac/33751/fraise" target="_blank">Fraise</a> I don&#8217;t know about the ongoing status of this app. However, we all know and love Eclipse over here, but sometimes I just want to open up a single file really quickly and make a change to a variable or other entity. Having a versatile and easy to use text editor is an important part of any web development work flow. Fraise is fast, stable, and has a good UI. Simple is good.</p>
<p>#4 <a href="http://www.eclipse.org/downloads/" target="_blank">Eclipse</a> Whoa. this is the whole enchilada. If you are just starting out, the learning curve is a bit daunting. However, this is the workbench tool to rule all workbenches. Infinitely configurable, and capable of coding most any language, Eclipse earns major points in utility, and versatility. It&#8217;s not without it&#8217;s drawbacks, however. Eclipse can be a bit of a memory hog, and you can really get lost in all the packages, and add ons. Still, it&#8217;s one of the best things going out there.</p>
<p>#5. <a href="http://cyberduck.ch/" target="_blank">CyberDuck</a> This is a great FTP program with an active development cycle, and wonderful capabilities. There is not much more than needs to be said here. This program is a must have.</p>
<p>I hope that I have covered all of the basics. One glaring omission is a <a href="http://www.flashdevelop.org" target="_blank">FlashDevelop</a> like tool for Mac OSX. There are some projects out there that show promise, but nothing that matches the capabilities of FD on OSX.</p>
<p>We&#8217;d love to hear what you think. What free web development tolls are you using for OSX? &#8211; happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/07/15/free-web-development-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NetConnection: Flash Remoting in smaller AS3 projects</title>
		<link>http://www.curiousm.com/labs/2011/07/08/netconnection-flash-remoting-in-smaller-as3-projects/</link>
		<comments>http://www.curiousm.com/labs/2011/07/08/netconnection-flash-remoting-in-smaller-as3-projects/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 17:03:16 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[desktop application]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[AIR Application]]></category>
		<category><![CDATA[Desktop Application]]></category>
		<category><![CDATA[Flash Remoting]]></category>
		<category><![CDATA[Remote Services]]></category>
		<category><![CDATA[var]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1339</guid>
		<description><![CDATA[What is NetConnection? Located in the flash.net package, NetConnection inherits from EventDispatcher and then Object. It is a simple way to open a connection to a remote server, call services from it and then implement the return values into your ActionScript 3.0 project. This works even in standalone Adobe Air applications. Although it is not [...]]]></description>
			<content:encoded><![CDATA[<p>What is <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html" target="_blank">NetConnection</a>? Located in the flash.net package, NetConnection inherits from EventDispatcher and then Object. It is a simple way to open a connection to a remote server, call services from it and then implement the return values into your ActionScript 3.0 project. This works even in standalone Adobe Air applications. Although it is not the best option for larger projects, it is a simple way to call remote services from a server without having to set up Value Objects, let alone a complex system. <span id="more-1339"></span> Quoting directly from the Adobe site:</p>
<blockquote><p><em>&#8220;The NetConnection class creates a bidirectional connection between a Flash Player or AIR application and a Flash Media Server application or between a Flash Player or AIR application and an application server running Flash Remoting. A NetConnection object is like a pipe between the client and the server. Use NetStream objects to send streams through the pipe.<br />
Without Flash Media Server, you can use the NetConnection class to play video and MP3 files from a local file system or from a web server.&#8221;</em></p></blockquote>
<p>As you can see, NetConnection already opens up an array of possibilities. In this specific case scenario, let me first start off by saying that I was implementing the <a href="http://www.actionscript.org/resources/articles/679/1/MVC-Design-Pattern/Page1.html" target="_blank">MVC design pattern</a> (Model View Controller). I was building a small Adobe Air Application using the Flex 4 SDK, and heavily relying on ActionScript 3.0 for most of the coding. My objective was to call remote services on three different remote servers, which would return values stating that &#8220;Yes, this server is online.&#8221; Then using the variables that it returned, set up a custom event that would fire off stating whether or not the specific server was online. My Controller would listen for the event, and upon receiving it call the respective function that would change my view to say &#8220;Let&#8217;s turn on the green button instead of the red button, because this server is online!&#8221; Here is the code to set up a connection for a specific server:</p>
<div id="attachment_1356" class="wp-caption alignnone" style="width: 864px"><a href="http://www.curiousm.com/labs/files/2011/07/example.png"><img src="http://www.curiousm.com/labs/files/2011/07/example.png" alt="NetConnection Example" width="854" height="723" class="size-full wp-image-1356" /></a><p class="wp-caption-text">NetConnection Example</p></div>
<p><strong>Step 1: Import related classes</strong><br />
You&#8217;re going to want to import flash.net packages; NetConnection, ObjectEncoding, and Responder.</p>
<p><strong>Step 2: Implement variables and Constructor</strong><br />
Implement whatever public class variables you want, and then pass in an null IEventDispatcher object in the constructor function and call the super of that class. This is only to prevent any issues with dispatching events from this ConnectionController class.</p>
<p><strong>Step 3: Create a function to check a server</strong><br />
Make sure the return type of this function is void. Inside this, create a private variable by declaring the var keyword, for an instance of NetConnection, and any other variables having to do with this one specific function. Declare the ObjectEncoding variable, and the connect variable in the new NetConnection variable you just declared.</p>
<p><strong>Step 4: Call a function and set up dispatchers</strong><br />
Use _gateway.call(locationOfFunctionOnRemoteServer, new Responder(functionIfReturnValue, functionIfError), &#8230;.arguments); to make a call to the server, you can implement this line for however many functions you want to call in this one operation. After this, set up the nested functions that are called in the _gateway.call method, and fire off dispatchers with the related custom event based on a return from the server.</p>
<p>And there you have it, a simple way to call and get a return value from a remote server in AS3.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/07/08/netconnection-flash-remoting-in-smaller-as3-projects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building an iPhone/iPad/Android compatible HTML5 video player tutorial &#8211; Part 1</title>
		<link>http://www.curiousm.com/labs/2011/07/01/building-an-iphoneipadandroid-compatible-html5-video-player-part-1/</link>
		<comments>http://www.curiousm.com/labs/2011/07/01/building-an-iphoneipadandroid-compatible-html5-video-player-part-1/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 17:46:14 +0000</pubDate>
		<dc:creator>Shannon</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[IPad]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1306</guid>
		<description><![CDATA[One of the great things about modern smartphones and tablets is their ability to render webpages very closely to the way they are rendered on desktops. The only caveat here is Flash. Flash is of course blocked completely on iOS devices, and it&#8217;s compatibility and performance on Android devices varies widely. One of the most [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great things about modern smartphones and tablets is their ability to render webpages very closely to the way they are rendered on desktops. The only caveat here is Flash. Flash is of course blocked completely on iOS devices, and it&#8217;s compatibility and performance on Android devices varies widely. One of the most common uses for Flash has been to play video, so this is one area that you are most likely to need an alternative approach for those devices that don&#8217;t support it. Luckily, iOS and Android both feature modern browsers with full HTML5 support, including support for the video tag. Today, I will walk you through the steps of creating a simple HTML5 video player.</p>
<div id="attachment_1316" class="wp-caption alignnone" style="width: 570px"><img src="http://www.curiousm.com/labs/files/2011/07/vidExample1.jpg" alt="HTML5 video example" title="vidExample" width="560" height="321" class="size-full wp-image-1316" /><p class="wp-caption-text">HTML5 video example (Safari web browser)</p></div>
<p><strong>Step 1: Prepping your video file</strong><br />
The first thing you will want to do is encode your video at the proper format for HTML5 playback. I am using Quicktime Pro for this, feel free to use your favorite video editor or exporter*. With the video open, I select File>Export from the top menu. Under the Export drop down, select Movie to MPEG-4. Then click the Options… button next to it. Under the Video tab, set the Video Format. For this, use H.264, the data rate is up to you (with a higher setting the video will look better but be a larger file). I usually go with a setting around 800 in most cases. Here you can also set the size for your video if it needs changed (Letterbox will preserve the video&#8217;s aspect ratio and is most likely the setting you will want). Under the Audio tab, I usually go with a data rate of 128kbps and a Sample rate of 44.100 kHz. Finally, under the Streaming tab, click on Enable streaming. For Maximum pocket size I use 1500 bytes, for Maximum packet duration, 500 ms. Be sure to leave the Optimize for Server box unchecked (I have had iOS playback issues when this is checked). Once your settings are how you want them, click OK, then save the file (it should be exported with a .mp4 extension).</p>
<p>*Note: If you do not have Quicktime Pro or comparable software, there is a nice free video exporter that you can use called <a href="http://www.mirovideoconverter.com/" target="_blank">Miro Video Convertor</a>. It doesn&#8217;t allow the fine tuning that QT does, but will definitely get the job done. It is very simple to use, just install it, drag your video file to the window, then select the proper file type from the drop down (you can choose MP4).</p>
<p><strong>Step 2: Prepping your poster image</strong><br />
Ok, your video is all set, now we need a still image (preferably jpeg) to use as the poster image for the video (the poster image is the image that the viewer will see on your page before the video is triggered). First, scrub your video to the frame you would like to use. From there, you can either do a screen grab of the video window and edit it in Photoshop, or go to File>Export from the top menu, then select Movie to Picture from the Export drop down menu. If you use this method, you should probably re-save the file in Photoshop since Quicktime exports the file as a pct instead of a jpeg. Another good thing to do at this point is to create a simple Play Button for the file (a Play button automatically shows up in iOS devices but not in Android, which is why it&#8217;s a good idea to have it as part of the poster image). In Photoshop, open the still image and create a Play Button graphic on a separate layer. In it&#8217;s simplest form, this button is really just a sideways triangle, you can use one of Photoshop&#8217;s built-in shapes or just create it yourself. Place this graphic in the center of the image so that it will appear behind the automatic button that iOS creates. Ok, now your files are prepped and it&#8217;s time to embed the video on your page.</p>
<p><strong>Step3: Embedding the video</strong><br />
The HTML5 video tag makes it very easy to embed the video on your page. Here is an example of what the embed code looks like:</p>
<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;video <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vid1&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;560&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> poster<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVidPoster.jpg&quot;</span> durationHint<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;60&quot;</span> controls&gt;</span>
	<span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVid.mp4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/mp4&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>video&gt;</span></pre></div></div>
<p>The id attribute is useful if you need to access this element in CSS or Javascript. For the poster attribute, set the path to where your still image is stored. For durationHint, set this to the approximate length of your video in seconds. The controls attribute tells the player to use the default video controls. Set the width and height, then set the src attribute to the path to your .mp4 video file and you are all set.</p>
<p><strong>Step 4: Serving an OGG Theora video file to Firefox</strong><br />
As of this writing, Firefox does not support the H.264 codec used by MP4 videos, but it does support OGG Theora. So we will need to export and include an OGG Theora file as well in order for the file to play in Firefox. To export our video into this format, you can use the free video convertor I mentioned above-<a href="http://www.mirovideoconverter.com/" target="_blank">Miro Video Convertor</a>. Just choose &#8220;Theora&#8221; from the drop down and click &#8220;Convert&#8221;. With your video exported, you will need to modify the video embed code to include it. So our code will now look like this:</p>
<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;video <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vid1&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;560&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> poster<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVidPoster.jpg&quot;</span> durationHint<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;60&quot;</span> controls&gt;</span>
	<span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVid.mp4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/mp4&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
        <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVid.theora.ogv&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/ogg&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>video&gt;</span></pre></div></div>
<p>Basically, if the browser can read the video tag, it will attempt to load the videos in the order they are listed. So Safari/Chrome/Android/iOS etc will load the MP4, while Firefox will skip it and load the OGG Theora one instead. One word of caution- be sure to put the MP4 video before the OGG one, I have had issues with playback on iOS devices when they are switched.</p>
<p>Step 5: Serving Flash to browsers that don&#8217;t support the HTML5 video tag (I&#8217;m looking at you, IE)<br />
To account for older and incompatible browsers that don&#8217;t recognize the video tag, we will provide Flash fallback. To do this, first prep your Flash video player SWF. If you don&#8217;t have Adobe Flash, you can download and use one of the free Flash players available to generate your SWF. <a href="http://www.longtailvideo.com/players/jw-flv-player/">JW Player</a> and <a href="http://flowplayer.org/index.html" target="_blank">Flow Player</a> are good alternatives.</p>
<p>With your SWF file ready, change your embed tag to the following:</p>
<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;video <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vid1&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;560&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> poster<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVidPoster.jpg&quot;</span> durationHint<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;60&quot;</span> controls&gt;</span>
	<span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVid.mp4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/mp4&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
        <span style="color: #009900;">&lt;source <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVid.theora.ogv&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;video/ogg&quot;</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">object</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;application/x-shockwave-flash&quot;</span> <span style="color: #000066;">data</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid.swf&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;560&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;allowfullscreen&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;allowScriptAccess&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sameDomain&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;wmode&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;transparent&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flashvars&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file=vids/myVid.mp4&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;movie&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid.swf&quot;</span>&gt;</span>
            <span style="color: #808080; font-style: italic;">&lt;!--[if IE]&gt;&lt;!--&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;movie&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/vid.swf&quot;</span>&gt;</span>
            <span style="color: #808080; font-style: italic;">&lt;!--&lt;![endif]--&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vids/myVidPoster.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;560&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Video&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">object</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>video&gt;</span></pre></div></div>
<p>Now the browser will attempt to load the videos in this order: MP4, OGG, then the SWF. You are all set with a video that will play in virtually any browser. </p>
<p>That&#8217;s it for this time, a simple introduction to creating an HTML5 video and embedding it in your page. In part two, I will show you how to create a video player that supports the playback of multiple videos.<br />
Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/07/01/building-an-iphoneipadandroid-compatible-html5-video-player-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating ASDocs with ANT &amp; Flash Builder Part 3. Customizing the Documentation Template.</title>
		<link>http://www.curiousm.com/labs/2011/06/27/creating-asdocs-with-ant-flash-builder-part-3-customizing-the-documentation-template/</link>
		<comments>http://www.curiousm.com/labs/2011/06/27/creating-asdocs-with-ant-flash-builder-part-3-customizing-the-documentation-template/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 13:51:59 +0000</pubDate>
		<dc:creator>Nikolaeva G. Ralica</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[ANT]]></category>
		<category><![CDATA[ant build file]]></category>
		<category><![CDATA[ant tasks]]></category>
		<category><![CDATA[ant tools]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[asdoc]]></category>
		<category><![CDATA[build file]]></category>
		<category><![CDATA[buildfile.xml]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[generate documentation]]></category>
		<category><![CDATA[project documentation]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1145</guid>
		<description><![CDATA[3. Customizing the HTML template for your Flash Builder Project. There’s no point doing good work if others don’t know about it or can’t understand what you did. When it comes to developing lengthy applications a well written documentation is a must. A well written documentation which compliments your project&#8217;s design shows commitment to the project [...]]]></description>
			<content:encoded><![CDATA[<h3>3. Customizing the HTML template for your Flash Builder Project.</h3>
<p>There’s no point doing good work if others don’t know about it or can’t understand what you did. When it comes to developing lengthy applications a well written documentation is a must. A well written documentation which compliments your project&#8217;s design shows commitment to the project and a professional feel.</p>
<p>In <strong><a href="http://www.curiousm.com/labs/2011/04/18/creating-asdocs-with-ant-flash-builder-part-1/">Part 1</a></strong> of this tutorial we covered ANT installation. <strong><a href="http://www.curiousm.com/labs/2011/04/26/creating-asdocs-with-ant-flash-builder-part-2/">Part 2</a> </strong>explains the best practices for writing comments inside your project&#8217;s classes which later are read by ANT and included in the project documentation. <strong>Part 3</strong> is the final part of this series. It will help you understand how your documentation is structured, and what can be done to customize the HTML template used by ANT to generate the documentation.<br />
The default documentation template is the same as the one used by Adobe to document the ActionScript 3.0 language. Here is a link which I am sure you have visited before:</p>
<h5><strong><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/class-summary.html#top">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/class-summary.html#top</a></strong></h5>
<p><strong>Good to know:</strong></p>
<p><strong>What are HTML templates?</strong> An HTML template is a ready-made design of the HTML page. The HTML template usually include most of the source files necessary for further customizing the template. It can be edited using WYSIWYG editors such as Frontpage, Dreamweaver etc.</p>
<p><strong>CSS</strong> - <strong>Cascading Style Sheets </strong>is a language used to create stylesheets in which you can describe presentation semantics, its used mainly with HTML and XHTML pages. It can also be used with Adobe Flash Builder and other. It&#8217;s a good practice to separate the styling of your project in a CSS file. This way the designer and the developer for example can work together and have a smooth workflow.</p>
<p><strong>Where is the template used by ANT ?</strong></p>
<p>The path to the template should look like this:<br />
<span style="color: #ff6600"> /Applications/Adobe Flash Builder 4.5/sdks/4.5.0/asdoc/templates/</span>.</p>
<p><a href="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-5.41.49-AM.png"><img class="alignnone size-full wp-image-1258" src="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-5.41.49-AM.png" alt="" width="580" height="157" /></a></p>
<p>Inside the &#8220;templates&#8221; folder you will find all the components that make the HTML template. You cannot modify the template directly, but you can create a copy and assign it&#8217;s path in the ANT build script instead of using the default.</p>
<p><strong>The CSS:</strong></p>
<p><strong> </strong><a href="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-8.34.25-AM-e1309178339482.png"><img class="alignleft size-full wp-image-1266" src="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-8.34.25-AM-e1309178339482.png" alt="" width="326" height="174" /></a>Through this CSS file you can assign styles to all the components that make your documentation pages. You can easily make changes to the documentation pages by modifying the styles.css (path: /Applications/Adobe Flash Builder 4.5/sdks/4.5.0/asdoc/templates/style.css).</p>
<p>In order to modify an element&#8217;s style you need to begin your declaration with the element&#8217;s class name. From then it&#8217;s simple. Assign the new properties as shown on the image above.</p>
<p>You can see the class names of the elements you would like to modify by opening the .html files of the template. Here is an example that shows where and how the class is defined for the elements and also how the stylesheet is assigned to the HTML page. If you have found a CSS stylesheet that fits your needs you could even save time and assign it instead of the default one. Then just make sure to change the class names for the elements that require customization. The global settings would stay the same.</p>
<h3><a href="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-8.34.25-AM-e1309178339482.png"></a><a href="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-8.44.41-AM.png"><img src="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-8.44.41-AM.png" alt="" width="546" height="159" /></a></h3>
<p><strong>Manipulating the HTML itself:</strong></p>
<p>You could manipulate the HTML directly and change the layout of your page as well. I would recommend using Dreamweaver or other free editing software both for the CSS and the HTML. This would help you edit quickly and to see the results immediately as Dreamweaver for example has views that allow you to see the modifications live as you are making them.</p>
<p><a href="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-9.10.58-AM.png"><img class="aligncenter size-full wp-image-1282" src="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-9.10.58-AM.png" alt="" width="544" height="315" /></a></p>
<p><strong>Finishing up:</strong></p>
<p>The range of modifications you can make to your template has almost no limits. All you need is a basic understanding of the HTML and CSS language and a good editor software.</p>
<p>Once you are ready to use the template or test it you need to assign it inside your build.xml file. (explained in Part 2) Here&#8217;s the example syntax:</p>
<pre class="brush: plain; title: ; notranslate">&lt;arg line=&quot;-templates-path '/Applications/Adobe Flash Builder 4/sdks/4.1.0/asdoc/YourTemplateName'&quot;/&gt;</pre>
<p><a href="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-9.30.02-AM.png"><img class="aligncenter size-full wp-image-1288" src="http://www.curiousm.com/labs/files/2011/06/Screen-shot-2011-06-27-at-9.30.02-AM.png" alt="" width="565" height="56" /></a></p>
<p>Above is a snippet of one of CuriousMinds&#8217; project documentation build.xml files.  As you can see there are settings editable directly through the build.xml file like the window-title and other. One of my favorite things to do is to make sure the company branding is displayed as well as the client&#8217;s. An ideal place for the Author&#8217;s name and the Company branding is the footer (line 66).</p>
<p>This is all there is to customizing you template. If you have any questions post and I will try to be quick to answer.</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/06/27/creating-asdocs-with-ant-flash-builder-part-3-customizing-the-documentation-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Exercise in Trial &amp; Error: working with layers and symbols in Flash Catalyst</title>
		<link>http://www.curiousm.com/labs/2011/06/17/an-exercise-in-trial-error-working-with-layers-and-symbols-in-flash-catalyst/</link>
		<comments>http://www.curiousm.com/labs/2011/06/17/an-exercise-in-trial-error-working-with-layers-and-symbols-in-flash-catalyst/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 22:19:33 +0000</pubDate>
		<dc:creator>kate</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1205</guid>
		<description><![CDATA[On a recent round-trip voyage between Adobe Illustrator and Flash Catalyst I found myself frustrated, confused, and missing layers. I was new to Flash Catalyst, but my goal was pretty standard: to create interactive components using artwork created in Illustrator. According to the tutorials I read on the subject, editing between these programs would be [...]]]></description>
			<content:encoded><![CDATA[<p>On a recent round-trip voyage between Adobe Illustrator and Flash Catalyst I found myself frustrated, confused, and missing layers. I was new to Flash Catalyst, but my goal was pretty standard: to create interactive components using artwork created in Illustrator.</p>
<p><span id="more-1205"></span></p>
<p>According to the tutorials I read on the subject, editing between these programs would be easy thanks to Catalyst&#8217;s ability to preserve the structure of the original file.  I created my artwork in Illustrator- a button which included four layers I would assign  states (up, down, over, and disabled). The only problem was that I couldn&#8217;t seem to find any of these states once I opened the file in Catalyst. There was a single file with a single layer and that was all.</p>
<p><a><img class="aligncenter size-medium wp-image-1224" src="http://www.curiousm.com/labs/files/2011/06/FC-no-layers-e1308347960437-300x267.jpg" alt="" width="300" height="267" /></a></p>
<p>A little bit about my Illustrator artwork:  I decided to use 9-slice scaling for the buttons I was creating. My basic understanding of 9-slice scaling is that gives the designer control over what parts of a design are scaled, how they are scaled (vertically, horizontally, or both), and inhibits scaling where desired (I want my rounded corners left alone, for example). I definitely needed it for my rounded rectangle button shapes, but not for the eyeball graphic I was creating for the same project. To enable this magic feature I would need to work with symbols. I converted my button shape into a symbol and selected the property &#8220;enable 9-slice scaling.&#8221; I created a sublayer for each state of the button and saved it as an Illustrator file.</p>
<p><a href="http://www.curiousm.com/wp-content/uploads/2011/06/AI-symbol-to-player1.jpg"><img class="alignleft" src="http://www.curiousm.com/wp-content/uploads/2011/06/AI-symbol-to-player1-300x175.jpg" alt="" width="300" height="175" /></a></p>
<p>I imported the file into Catalyst (keeping the visible and non-visible layers editable) and attempted to create a button component. In order to assign the various states of the button with specific properties, I had to access those sublayers created in Illustrator. My file appeared to have only one accessible element,  the top level which I had made a symbol.</p>
<p>After some fruitless searching through tutorials for how to preserve Illustrator symbol layers upon import into Catalyst, I decided to play with the original artwork in the hopes of stumbling upon an answer. I discovered that I could create a symbol for each button state, and group them together within a non-symbol layer (a button name layer). Creating a sublayer for each state, I copied and pasted the common components (basic outline, center graphic), edited each as I wanted, and then converted them to symbols.  Creating separate symbols allowed me to continue to make changes to each one without affecting the others. I could have also repeated the same symbol within each layer, breaking the link so that I could edit them individually. As symbols within a non-symbol group, I could have my 9-slice scaling, and import all my illustrator layers within a single file too.</p>
<p><a href="http://www.curiousm.com/labs/files/2011/06/FC-Layers1.jpg"><img class="aligncenter size-medium wp-image-1226" src="http://www.curiousm.com/labs/files/2011/06/FC-Layers1-e1308348137222-300x213.jpg" alt="" width="300" height="213" /></a></p>
<p>Back in Catalyst  all my layers were where they should be. I selected &#8220;Button&#8221; from the &#8220;Change Artwork to Component&#8221; menu, clicked on each state at the top of the workspace, making my file layers visible or not to change their appearance, and exported the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/06/17/an-exercise-in-trial-error-working-with-layers-and-symbols-in-flash-catalyst/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex and Spring: Communication over BlazeDS &#8211; Part I</title>
		<link>http://www.curiousm.com/labs/2011/06/13/flex-and-spring-communication-over-blazeds-part-i/</link>
		<comments>http://www.curiousm.com/labs/2011/06/13/flex-and-spring-communication-over-blazeds-part-i/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 15:04:28 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Spring]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1181</guid>
		<description><![CDATA[Leveraging a Spring backend in your Flex application can be a great way to gain access to powerful java tools and server technologies, but getting your client and server all wired up can be pretty challenging, especially for the newcomer. I recently had the opportunity to explore this Pandora&#8217;s box, and came up with a [...]]]></description>
			<content:encoded><![CDATA[<p>Leveraging a Spring backend in your Flex application can be a great way to gain access to powerful java tools and server technologies, but getting your client and server all wired up can be pretty challenging, especially for the newcomer. I recently had the opportunity to explore this Pandora&#8217;s box, and came up with a Flex-Java solution that may work for you, depending on your project&#8217;s needs. In this series of tutorials I want to share with you the way in which I went about getting my application up and running in hopes that other newbies out there might have some success integrating these technologies.</p>
<p><span id="more-1181"></span></p>
<p>NOTE: Please download attached source files from <a href="http://clients.curiousm.com/flex_and_spring/example.zip">here</a> to help you with this tutorial.</p>
<p>I wanted to make use of the Spring framework in my Java backend because of its flexibility and streamlined development. I wanted Hibernate integration also for data persistence to a MySQL database, which I knew Spring could provide me. It seemed to me that this stack would be the perfect combination of tools to get my application off the ground, but I wasn&#8217;t quite sure how to go about putting all these pieces together.</p>
<p>A little research on this topic revealed some solutions like Spring Roo with the Flex scaffolding extensions which, at least at first, seemed would glue all these components together with ease. I&#8217;m sure the Spring Roo project, once it matures a little and stabilizes, will be a viable way to generate the Java classes and Flex remoting scaffold necessary to build an application. That being said, the amount of difficulty I had in getting Spring Roo and Flex to work together was immense. I also have a huge aversion to using new tools to generate code for me that are not yet widely embraced or supported by the community at large, and which I don&#8217;t fully understand inside and out. When eventually the excrement hits the air circulation device, I want to know exactly where a system is failing and why, even if it means spending a few extra hours writing boilerplate code from scratch. I do, however, appreciate the work that Jeremy Grelle et al. have done on this project, but at present, the Roo-Flex project isn&#8217;t stable enough for my tastes. Upon realizing this, I decided to roll up my sleeves and tie the pieces together myself.</p>
<p><strong>Setting up BlazeDS and Tomcat</strong></p>
<p>BlazeDS is a great way to get Flex and java talking to one another. It is free, which lowers the cost barrier for you and your client, and is relatively easy to install. A popular method of getting up and running quickly is to install the BlazeDS turnkey server. This is ostensibly a Tomcat server, bundled with a bunch of very typical examples of how BlazeDS can be utilized. You can download this package from the <a href="http://opensource.adobe.com/wiki/display/blazeds/BlazeDS">Adobe Labs Website</a>, or if you already have a Tomcat installation you want to develop against, you may grab the WAR file and deploy it yourself. Instructions for deploying BlazeDS, starting the server and running the examples can all be found on the website, and in the enclosed documentation.</p>
<p><strong>Maven Management</strong></p>
<p>Once you have a Tomcat installation and BlazeDS running in the container, we can start thinking about how to structure our java project and how to incorporate the Spring and Hibernate libraries into our project. I found SpringSource Tool Suite (STS) to be a useful IDE to develop the java side of my application. It is another Eclipse spinoff, so those familiar with this IDE will feel right at home in these environs. If you use Maven to manage your project dependencies, you can get almost everything you need by adding the requisite nodes to your pom.xml file, or by using the M2Eclipse pom editor to search for and manage your project jars. You can find instructions on installing M2Eclipse for STS on the <a href="http://m2eclipse.sonatype.org/"></a>M2Eclipse project website, and you can get SpringSource Tool Suite from <a href="http://www.springsource.com/developer/sts">here</a>.</p>
<p>Once we have these pieces in place, let&#8217;s start by making a new project in STS. Choose &#8216;New Java Project&#8217; from &#8216;File&#8217; in the main menu of the application, and give it a name. This is the most basic java project configuration, to which we are going to add Maven support, as well as some project facets to get the resources and structure of our project tightened up. The next thing we want to do is enable dependency management with Maven. We&#8217;ll do that by right clicking on the project in our package explorer, and choosing &#8216;Maven -&gt; Enable Dependency Management&#8217;. Here we are presented with some options. Because we are just creating a simple tutorial application here, I&#8217;m leaving my Group Id and Artifact Id alone, and providing a simple name and description for the heck of it. When finished with this step, a pom.xml file will be created in the project folder which we can edit to add dependencies automatically to the build path.</p>
<p><strong>Project Facets</strong></p>
<p>The way Eclipse organizes a project and structures a project to make it runnable in different environments is to add &#8216;facets&#8217; to the project. We are going to add facets to this project now to transform this &#8216;vanilla&#8217; java project into web application deployable to our Tomcat server. Again, right click on the project folder in the Package Explorer and choose &#8216;Properties&#8217;. You&#8217;ll see a menu item in the list called &#8216;Project Facets&#8217;. Choose that, and click the link to &#8216;Convert to faceted form…&#8217;. From the list that appears in the Project Facets Pane, select the &#8216;Dynamic Web Module&#8217; checkbox, leave the &#8216;Java&#8217; checkbox selected and click &#8216;OK&#8217;.</p>
<p>If you were paying attention you&#8217;ll notice that Eclipse just created a folder called &#8216;WebContent&#8217;, and  &#8216;META-INF&#8217; and &#8216;WEB-INF&#8217; folders inside that folder. This is the basic structure our java web application will take on when we export and deploy it.</p>
<p><strong>Spring Dependencies</strong></p>
<p>The Maven dependencies found in the attached project&#8217;s pom.xml file will give you the libraries we&#8217;re going to make use of in the next step of our tutorial. Note that there may be updates to some of these release jars by now, but avoiding the confusion of dependency compatibility is one of my goals in writing this post. Try using this list of dependencies before looking for newer releases, and save yourself some aggravation.</p>
<p>Feel free to copy this list directly into your project&#8217;s pom. Once we have done this, we are ready to begin building our java application&#8217;s context. You should also see that in the package explorer, our folder containing Maven Dependencies has 17 new jar files in it. These are, of course, the dependencies we&#8217;ve just added to our pom.xml.</p>
<p><strong>Spring Flex Integration Jars</strong></p>
<p>In addition to the above resources, we&#8217;re going to need the Flex Spring integration jars. You can get them from the following <a href="http://www.springsource.org/spring-flex">address</a>.</p>
<p>Once you&#8217;ve downloaded these jars, you&#8217;ll want to make sure they get deployed along with your maven managed jars. I made a folder inside my project called &#8216;jar&#8217; into which I&#8217;ve placed additional dependencies. I&#8217;ve included my jars folder here in the project archive, so you can unzip that folder into your project directory and use them. There are a few other jars in this folder. Do yourself a favor and use my jars because there are some dependencies that we have not discussed, which I spent too many hours starting and restarting my server, getting ClassDefinitionNotFound errors, and searching the web for the correct jars containing the right Classes to get this project running. Please trust me on this one. To get the items in the &#8216;jars&#8217; folder to deploy properly, you want to make sure there is a corresponding entry in your &#8216;Web Deployment Assembly&#8217; properties for this project. Go into the Properties for this project and select Deployment Assembly. This is where we can define mappings for deployment of our resources. If it isn&#8217;t done already, map your jar folder to &#8216;/WEB-INF/lib&#8217;. Our jars will now be in place when we deploy our web application.</p>
<p><strong>Part I Wrap Up</strong></p>
<p>Because this process of building all the components that make up this application is quite involved, I am breaking this into smaller, less daunting steps. We now have an STS project with all of the foundation to start coding our backend, and after that, to call our services from a Flex client. Be sure to check back soon for the second part of this tutorial, when we get into some of the more fun aspects of building this project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/06/13/flex-and-spring-communication-over-blazeds-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Components for IOS, IPad and IPhone. Or what to do while waiting for Adobe to update FlashBuilder</title>
		<link>http://www.curiousm.com/labs/2011/06/02/as3-components-for-ios-ipad-and-iphone-or-what-to-do-while-waiting-for-adobe-to-update-flashbuilder/</link>
		<comments>http://www.curiousm.com/labs/2011/06/02/as3-components-for-ios-ipad-and-iphone-or-what-to-do-while-waiting-for-adobe-to-update-flashbuilder/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 19:45:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[IPad]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[user interface design]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=1171</guid>
		<description><![CDATA[We&#8217;ve been playing with FlashBuilder 4.5 over here for the past few weeks, and we are pretty impressed. However one major setback remains: There are no mobile components for available for iOS devices. In the current 4.5 build, with AIR 2.6 an iOs project can only be a pure AS3 project no mxml or spark [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been playing with FlashBuilder 4.5 over here for the past few weeks, and we are pretty impressed. However one major setback remains: There are no mobile components for available for iOS devices. In the current 4.5 build, with AIR 2.6 an iOs project can only be a pure AS3 project no mxml or spark classes are allowed. This presents some real problems for developer who are used to having the prebuilt interactivity available. Luckily, there are some libraries out there that may help. Unfortunately none of them are idea. Read on to see what we have come up with.</p>
<p><span id="more-1171"></span>Option #1. Import the .fl classes into Flash Builder.</p>
<p>This probably the easiest way to get some components on the screen, and the only way that I have gotten controls to work properly.  Go into Flash and create a new AS3 project. Drag the components that you need onto the stage, and export as a .swc . Import this .swc into the classpath of your FlashBuilder project and you will have access to scrollbar, button, list and slider .fl classes.</p>
<p>Option #2. <a href="http://mromecki.fr/en/#/post?url=using-flex-3-component-without-mxml-only-as3" target="_blank">Try to bootstap mxm</a>l (not a real great idea.)<br />
The other option, for example, if you would like to use the super cool <a title="FlexPad Lib" href="http://code.google.com/p/flexpad/" target="_blank">FlexPadLib. </a> This is extremely difficult to get right, but you can find some resources on it here.</p>
<p>Option #2a. Hack Flex Mobile Project to compile to Ipad. This is probably your best option. The walkthrough can be found <a href="http://va.lent.in/blog/2011/03/25/air2-6-app-for-ios/#comment-1050" target="_blank">here</a>.</p>
<p>Option #3 try using Iphone styled components for As3. I don&#8217;t know the status of the project, but you can check it out <a href="http://code.google.com/p/as3iphonecomponents/" target="_blank">here</a>.</p>
<p>Option #3a use a very minimal comp set such as <a href="http://www.minimalcomps.com/">MinimalComps</a>, or <a href="http://reflexplatform.com/">Reflex</a></p>
<p>Option #4. Wait for Adobe to update Air for iOs Devices. Along with using the Flex Mobile components, we would also like to see some other nice to haves like native alert window, and background alerts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/06/02/as3-components-for-ios-ipad-and-iphone-or-what-to-do-while-waiting-for-adobe-to-update-flashbuilder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating ASDocs with ANT &amp; Flash Builder Part 2. Writing AsDoc Comments.</title>
		<link>http://www.curiousm.com/labs/2011/04/26/creating-asdocs-with-ant-flash-builder-part-2/</link>
		<comments>http://www.curiousm.com/labs/2011/04/26/creating-asdocs-with-ant-flash-builder-part-2/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 13:39:07 +0000</pubDate>
		<dc:creator>Nikolaeva G. Ralica</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[ANT]]></category>
		<category><![CDATA[ant build file]]></category>
		<category><![CDATA[ant tasks]]></category>
		<category><![CDATA[ant tools]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[asdoc]]></category>
		<category><![CDATA[build file]]></category>
		<category><![CDATA[buildfile.xml]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[generate documentation]]></category>
		<category><![CDATA[project documentation]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://www.curiousm.com/labs/?p=897</guid>
		<description><![CDATA[2. Project Documentation Process for Ant on standalone Flash Fuilder 4.5. Common Glossary and Output. This tutorial covers the documentation process for Ant on Adobe® Flash Builder 4.5. You will be presented with the most common ASDoc comments, their purpose and output in the generated documentation, and examples of documentation page templates and their customization [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="font-size: 20px"><strong>2. Project Documentation Process for Ant on standalone Flash Fuilder 4.5. Common Glossary and Output.</strong></span></h3>
<p>This tutorial covers the documentation process for Ant on Adobe® Flash Builder 4.5. You will be presented with the most common ASDoc comments, their purpose and output in the generated documentation, and examples of documentation page templates and their customization process.</p>
<p>This is <em>Part 2</em> of the Ant and Flash Builder 4.5 tutorial. If you have not yet installed and setup Ant on the standalone version of Flash Builder you can refer to <strong><a href="http://www.curiousm.com/labs/2011/04/18/creating-asdocs-with-ant-flash-builder-part-1/" target="_blank">Part 1</a></strong>. There you can get a step-by-step instruction on how to install and setup Ant.</p>
<p>Once you have installed and properly setup Ant on Flash Builder, it&#8217;s time to write some ASDoc comments in ActionScript® . When you generate the documentation later this code will be recognized by the Ant documentation tool and included in the generated project documentation. If you are thorough in your comments and update them along with the project&#8217;s development process, you will end up with one well written and detailed documentation and you will never forget what each class is used for.</p>
<h2>Good to know:</h2>
<h2><span style="font-size: 13px;font-weight: normal">•  Adobe&#8217;s help documentation is very detailed and shows all the best practices regarding the documentation process. It contains AsDoc comment examples and their formatting for all types of ActionScript classes.You can visit their documentation <span style="font-size: 15px;font-weight: bold"><a href="http://help.adobe.com/en_US/flex/using/WSd0ded3821e0d52fe1e63e3d11c2f44bb7b-7fed.html">here</a></span>.</span></h2>
<p>This post is an addition which will help you instantly see what the result of the most common AsDoc comments looks like in the generated documentation. I will also cover a few mistakes that are common and if not minded can slow down your workflow or be the cause for errors which can go unnoticed by the documentation tool.</p>
<p>•  There is a list of HTML tags you can use to format you AsDoc comments. Bear in mind that this list of tags is limited, and that while in some sections of an AsDoc comment you can use them, in other places they are not accepted and can produce an error.<br />
A summary of these HTML elements can be found <a href="http://help.adobe.com/en_US/flex/using/WSd0ded3821e0d52fe1e63e3d11c2f44bc36-8000.html"><strong><span style="font-size: medium">here</span></strong></a></p>
<p>•  There are two types of AsDoc comments: ActionScript comments and MXML comments.</p>
<h2>Examples:</h2>
<p><strong>ActionScript</strong> comments are declared to start with  /**  character sequence and the end is declared by */. Read the example below:</p>
<pre class="brush: as3; title: ; notranslate"> /**
*  The first sentence would be used to describe
*  the class. Next sentences only show in the
*  class' detail view.
*/
</pre>
<p><em><span style="font-size: small">An example of an AsDoc comment used to describe a class.</span></em><br />
<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: 13px;line-height: 19px"><em>output:</em></span></p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: 13px;line-height: 19px"><em><a href="http://www.curiousm.com/labs/files/2011/04/ClassDescr.png"><img class="alignnone size-full wp-image-1002" src="http://www.curiousm.com/labs/files/2011/04/ClassDescr.png" alt="" width="570" height="173" /></a></em></span><br />
<em><span style="font-size: small">Above is a list of classes and their short descriptions generated by the documentation tool. The short description on the right is the first sentence in your AsDoc comment for that class.</span></em></p>
<p>Below is a view of the same class&#8217; Detail Page.</p>
<p><a href="http://www.curiousm.com/labs/files/2011/04/classDetailView.png"><img class="size-full wp-image-1007 alignnone" src="http://www.curiousm.com/labs/files/2011/04/classDetailView.png" alt="" width="570" height="138" /></a></p>
<p>• Commenting Functions:</p>
<pre class="brush: as3; title: ; notranslate">/**
* AsDoc comment for the &lt;code&gt;onViewClick&lt;/code&gt;
* method.  HTML tags &lt;strong&gt;can&lt;/strong&gt; be used
* here.
* @param evt Parameter tags are
* descriptions of the parameters this
* method can take in.
*/
override protected function onViewClick(evt:MouseEvent):void{
switch(evt.currentTarget){</pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: 13px;line-height: 19px"><em>output:</em></span><br />
<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: 13px;line-height: 19px"><em><a href="http://www.curiousm.com/labs/files/2011/04/ClassComment1.png"><img class="alignnone size-full wp-image-1077" src="http://www.curiousm.com/labs/files/2011/04/ClassComment1.png" alt="" width="570" height="178" /></a></em></span><br />
<em><span style="font-size: small">Above is a snapshot of a Class Detail View page generated by the documentation tool.</span></em></p>
<p><strong>MXML</strong> AsDoc comments:</p>
<pre class="brush: plain; title: ; notranslate">Comments start with the &lt;!--- characters and
end with  --&gt; character.</pre>
<p>This comment is placed after the xml ecoding declaration and does not require a CDATA block. You can use the same comment structure when you are commenting MXML components such as buttons, DataGrids, etc.</p>
<p>Here is an example of invalid implementation of the &lt;h1&gt;<strong>Header 1</strong>&lt;/h1&gt; tag used where it does not belong. The text encapsulated in the wrong tag is simply omitted in the output. If these errors are not corrected you would end up with unreadable documentation.<br />
<img src="http://www.curiousm.com/labs/files/2011/04/AsDocComment1.png" alt="" width="572" height="75" /></p>
<p><em><span style="font-size: small">This is an MXML AsDoc comment.</span></em><br />
<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: 13px;line-height: 19px"><em>output:</em></span><br />
<a href="http://www.curiousm.com/labs/files/2011/04/AsDocCommentOutput1.png"><img src="http://www.curiousm.com/labs/files/2011/04/AsDocCommentOutput1.png" alt="" width="570" height="68" /></a><br />
<em><span style="font-size: small">Above is a snapshot of a Class Detail View page generated by the documentation tool.</span></em></p>
<h2>Errors</h2>
<p>My advice is when you start a new project always setup your documentation along with the project. There is nothing worse than an already built project that you have to create documentation for. When you are put in a situation where you have to document an already created project prepare to be patient and expect errors.<br />
Here are a few common things that would cause a Build fail:</p>
<p>• Improperly imported classes or classes that have not been imported at all. Even though Flash Builder will run your project, and build successfully, the documentation tools will fail at that obstacle.</p>
<p>• Undeclared in the build file external resources and related projects. If you have read <strong><a href="http://www.curiousm.com/labs/2011/04/18/creating-asdocs-with-ant-flash-builder-part-1/" target="_blank">Part 1</a></strong> of this tutorial,  you must now know about the &#8220;-source-path&#8221;, &#8220;-doc-sources&#8221;, &#8220;-external-library-path&#8221;, and my personal favorite &#8220;-exclude-classes&#8221;. Declare all external resources because they are mentioned in your project&#8217;s code and the documentation tool would look for them, but will not find them unless you specify their paths in your buildFile.xml.</p>
<p><a href="http://www.curiousm.com/labs/files/2011/04/externalPaths.png"><img class="alignnone size-full wp-image-1165" src="http://www.curiousm.com/labs/files/2011/04/thumbOfExtPaths.png" alt="" width="556" height="118" /></a></p>
<p>• Be careful where you place your build-file. You cannot modify the example build-file you will find in the Ant folder, but you can copy and customize it. I place my build-files directly in this location: /Applications/Adobe Flash Builder 4/sdks/4.1.0/ant/yourBuildFile.xml.</p>
<p>• Spark and Halo do not always mix when it comes to documentation. Below is an example of what happens when you have halo for a project theme but you have used a spark component. <a href="http://www.curiousm.com/labs/files/2011/04/Screen-shot-2011-04-21-at-3.03.47-PM.png"><img class="alignnone size-full wp-image-932" src="http://www.curiousm.com/labs/files/2011/04/Screen-shot-2011-04-21-at-3.03.47-PM-e1303478387986.png" alt="" width="570" height="63" /></a><br />
<em><span style="font-size: small">Ant build Error.</span></em></p>
<p>I will keep adding to this list every time I meet a new issue regarding documentation generation.</p>
<p>Next is <strong>Part 3</strong> of this tutorial, where I will cover template customization. This way your documentation can take on a view and feel closer to that of your project, and I promise you good presentation always pays!</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousm.com/labs/2011/04/26/creating-asdocs-with-ant-flash-builder-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

