<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
<!-- It contains information about your blog's posts, comments, and categories. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your blog. -->

<!-- To import this information into a WordPress blog follow these steps. -->
<!-- 1. Log into that blog as an administrator. -->
<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
<!-- 3. Choose "WordPress" from the list. -->
<!-- 4. Upload this file using the form provided on that page. -->
<!-- 5. You will first be asked to map the authors in this export file to users -->
<!--    on the blog.  For each author, you may choose to map to an -->
<!--    existing user on the blog or to create a new user -->
<!-- 6. WordPress will then import each of the posts, comments, and categories -->
<!--    contained in this file into your blog -->

<!-- generator="WordPress.com" created="2009-05-11 05:33"-->
<rss version="2.0"
	xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
	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:wp="http://wordpress.org/export/1.0/"
>

<channel>
	<title>Bauhouse</title>
	<link>http://bauhouse.wordpress.com</link>
	<description>Design to build community</description>
	<pubDate>Wed, 25 Feb 2009 15:42:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
	<wp:wxr_version>1.0</wp:wxr_version>
	<wp:base_site_url>http://wordpress.com/</wp:base_site_url>
	<wp:base_blog_url>http://bauhouse.wordpress.com</wp:base_blog_url>
	<wp:category><wp:category_nicename>blogroll</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Blogroll]]></wp:cat_name></wp:category>
	<wp:category><wp:category_nicename>symphony</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Symphony]]></wp:cat_name></wp:category>
	<wp:category><wp:category_nicename>technology</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Technology]]></wp:cat_name></wp:category>
	<wp:category><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
	<wp:category><wp:category_nicename>actionscript</wp:category_nicename><wp:category_parent>Technology</wp:category_parent><wp:cat_name><![CDATA[ActionScript]]></wp:cat_name></wp:category>
	<wp:category><wp:category_nicename>cms</wp:category_nicename><wp:category_parent>Technology</wp:category_parent><wp:cat_name><![CDATA[CMS]]></wp:cat_name><wp:category_description><![CDATA[content management systems]]></wp:category_description></wp:category>
	<wp:category><wp:category_nicename>css-technology</wp:category_nicename><wp:category_parent>Technology</wp:category_parent><wp:cat_name><![CDATA[CSS]]></wp:cat_name></wp:category>
	<wp:category><wp:category_nicename>mac-os-x</wp:category_nicename><wp:category_parent>Technology</wp:category_parent><wp:cat_name><![CDATA[Mac OS X]]></wp:cat_name></wp:category>
	<wp:category><wp:category_nicename>perl</wp:category_nicename><wp:category_parent>Technology</wp:category_parent><wp:cat_name><![CDATA[Perl]]></wp:cat_name></wp:category>
	<wp:tag><wp:tag_slug>actionscript</wp:tag_slug><wp:tag_name><![CDATA[ActionScript]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>apache</wp:tag_slug><wp:tag_name><![CDATA[Apache]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>aptana</wp:tag_slug><wp:tag_name><![CDATA[Aptana]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>css</wp:tag_slug><wp:tag_name><![CDATA[CSS]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>flex-sdk</wp:tag_slug><wp:tag_name><![CDATA[Flex SDK]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>framework</wp:tag_slug><wp:tag_name><![CDATA[Framework]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>mac-os-x</wp:tag_slug><wp:tag_name><![CDATA[Mac OS X]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>perl</wp:tag_slug><wp:tag_name><![CDATA[Perl]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>puremvc</wp:tag_slug><wp:tag_name><![CDATA[PureMVC]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>symphony</wp:tag_slug><wp:tag_name><![CDATA[Symphony]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>xhtml</wp:tag_slug><wp:tag_name><![CDATA[XHTML]]></wp:tag_name></wp:tag>
	<wp:tag><wp:tag_slug>xslt</wp:tag_slug><wp:tag_name><![CDATA[XSLT]]></wp:tag_name></wp:tag>
	<image>
		<url>http://www.gravatar.com/blavatar/e6ad7f8f0e35ed0de447be042f51d0f7?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Bauhouse</title>
		<link>http://bauhouse.wordpress.com</link>
	</image>
		<item>
<title>Configuring the debugger version of Flash Player</title>
<link>http://bauhouse.wordpress.com/?p=13</link>
<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=13</guid>
<description></description>
<content:encoded><![CDATA[It took me a while to find the correct documentation for <a href="http://livedocs.adobe.com/flex/3/html/logging_04.html">configuring the debugger version of Flash Player for Flex 3</a>.]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>13</wp:post_id>
<wp:post_date>0000-00-00 00:00:00</wp:post_date>
<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name></wp:post_name>
<wp:status>draft</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1216737269</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript 3.0 XML Loader</title>
<link>http://bauhouse.wordpress.com/?p=88</link>
<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[Uncategorized]]></category>

		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=88</guid>
<description></description>
<content:encoded><![CDATA[<p>Version 2. Adding to my little code repository here. I think I had too many public variables, but I wanted to be able to pass an XML file name to a utility whose sole function was to load an XML file. I think I still need to learn more about using retriever/modifier methods and get/set methods. Anyway, here's what I got so far.</p>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>88</wp:post_id>
<wp:post_date>0000-00-00 00:00:00</wp:post_date>
<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name></wp:post_name>
<wp:status>draft</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1217005545</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Accessing XML in ActionScript 3.0</title>
<link>http://bauhouse.wordpress.com/?p=91</link>
<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=91</guid>
<description></description>
<content:encoded><![CDATA[Say I have an XML file that I want to load:

<code>
&lt;slideshow width="400" height="400" speed="2"&gt;
&lt;image url="images/image1.jpg" title="Market Walk" /&gt;
&lt;image url="images/image2.jpg" title="History" /&gt;
&lt;image url="images/image3.jpg" title="Ying Yang" /&gt;
&lt;image url="images/image4.jpg" title="Kid Youth" /&gt;
&lt;image url="images/image5.jpg" title="Heart of Spice" /&gt;
&lt;image url="images/image6.jpg" title="Elissa" /&gt;
&lt;image url="images/image7.jpg" title="Silver Secret" /&gt;
&lt;image url="images/image8.jpg" title="Endless Mountains" /&gt;
&lt;image url="images/image9.jpg" title="Light of Hope" /&gt;
&lt;image url="images/image10.jpg" title="Bored?" /&gt;
&lt;/slideshow&gt;</code>

I can access the data using the following code:

<pre><code>
package {
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	import flash.text.*;
	import fl.transitions.Tween;
	import fl.transitions.easing.*;

	public class Slideshow extends Sprite {
		// XML gallery data
		private var xmlString:String;
		private var xmlURL:String;
		private var xmlData:XML;
		private var urlLoader:URLLoader;

		// slideshow attributes
		private var slideshowWidth:Number;
		private var slideshowHeight:Number;
		private var slideshowSpeed:Number;
		
		// slideshow images
		private var images:XMLList;
		private var imagesNum:uint; 
			
		// container
		private var container:Box;

		// constructor
		public function Slideshow () {
			loadXML("slideshow.xml");
		}
		
		// load XML
		private function loadXML (xmlURL:String):void {
			var urlRequest:URLRequest = new URLRequest(xmlURL);
			urlLoader = new URLLoader();
			urlLoader.addEventListener(Event.COMPLETE, loadXMLListener);
			urlLoader.load(urlRequest);
		}
		
		// event listener
		private function loadXMLListener(e:Event):void {
			xmlData = new XML(urlLoader.data);

			// slideshow attributes
			slideshowWidth = Number(xmlData.@width);
			slideshowHeight = Number(xmlData.@height);
			slideshowSpeed = Number(xmlData.@speed);

			// slideshow images
			images = xmlData.child("image");
			imagesNum = images.length(); 

			createContainer();
			displayText();
		}

		private function displayText():void {
			// list images as a string
			var imagesText:String = "Images:";
			for (var i:uint = 0; i &lt; imagesNum; i++) {
				var imageNum:uint = i;
				var imageURL:String = images[i].@url;
				var imageLabel:String = "Image " + imageNum;
				imagesText += "\n" + imageLabel + ": " + imageURL + stage.width;
				
			}
			
			// display XML in a text box on the stage
			addTextBox(slideshowWidth + ", " + slideshowHeight + ", " + slideshowSpeed 
					   + "\n" + imagesText
					   + "\nNumber of images: " + imagesNum);
		}

		// create container
		private function createContainer ():void {
			container = new Box (slideshowWidth, slideshowHeight, 0xFFFFFF);
			container.x = (stage.stageWidth - container.width) / 2;
			container.y = (stage.stageHeight - container.height) / 2;
			addChild(container);
			transition();
		}
		
		private function transition ():void {
			new Tween(container, "alpha", None.easeInOut, 0, 100, slideshowSpeed * 100, true);
		}

		// create text box to display XML on stage
		public function addTextBox(string:String):void {
			var string:String;
			var textBox:TextField = new TextField();
			var format:TextFormat = new TextFormat();
			format.font = "Arial";
			format.size = 15;
			format.color = 0x000000;

			textBox.text = string;
			textBox.setTextFormat(format);
			textBox.autoSize = TextFieldAutoSize.LEFT;

			addChild(textBox);
		}
		
	}
}</code></pre>
]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>91</wp:post_id>
<wp:post_date>0000-00-00 00:00:00</wp:post_date>
<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name></wp:post_name>
<wp:status>draft</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1219009077</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Install Strawberry Perl 5.10</title>
<link>http://bauhouse.wordpress.com/?p=98</link>
<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=98</guid>
<description></description>
<content:encoded><![CDATA[I wanted to see whether it was possible to not only have XAMPP ]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>98</wp:post_id>
<wp:post_date>2009-01-04 22:09:41</wp:post_date>
<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name></wp:post_name>
<wp:status>draft</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1231531463</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Novelty</title>
<link>http://bauhouse.wordpress.com/2006/06/26/novelty/</link>
<pubDate>Mon, 26 Jun 2006 23:38:19 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[Technology]]></category>

		<category domain="category" nicename="technology"><![CDATA[Technology]]></category>

<guid isPermaLink="false"></guid>
<description></description>
<content:encoded><![CDATA[It's amazing how far blogging has come since I first started. WordPress is quite an impressive application for something offered for free. There is so much that is available for free that I start to wonder what will retain any value. 

Is there any value in what I do? I am in the business of creating something that is unique. That which is novel still retains value.]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>1</wp:post_id>
<wp:post_date>2006-06-26 23:38:19</wp:post_date>
<wp:post_date_gmt>2006-06-26 23:38:19</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>novelty</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1214712424</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>About</title>
<link>http://bauhouse.wordpress.com/about/</link>
<pubDate>Mon, 26 Jun 2006 23:38:19 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[Uncategorized]]></category>

		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>

<guid isPermaLink="false"></guid>
<description></description>
<content:encoded><![CDATA[Not that I need another place to store information, since I have so many already scattered around the web. But a friend of mine suggested I try out WordPress. For the same reason, I tried LiveJournal, but I find WordPress offers much better themes and features. I'll give it a try and see how it goes. ]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>2</wp:post_id>
<wp:post_date>2006-06-26 23:38:19</wp:post_date>
<wp:post_date_gmt>2006-06-26 23:38:19</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>about</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>page</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1214717005</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Blogging is apparently not my thing</title>
<link>http://bauhouse.wordpress.com/2008/06/28/blogging-is-not-my-thing/</link>
<pubDate>Sat, 28 Jun 2008 20:47:41 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[Technology]]></category>

		<category domain="category" nicename="technology"><![CDATA[Technology]]></category>

		<category domain="tag"><![CDATA[CSS]]></category>

		<category domain="tag" nicename="css"><![CDATA[CSS]]></category>

		<category domain="tag"><![CDATA[Symphony]]></category>

		<category domain="tag" nicename="symphony"><![CDATA[Symphony]]></category>

		<category domain="tag"><![CDATA[XHTML]]></category>

		<category domain="tag" nicename="xhtml"><![CDATA[XHTML]]></category>

		<category domain="tag"><![CDATA[XSLT]]></category>

		<category domain="tag" nicename="xslt"><![CDATA[XSLT]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=3</guid>
<description></description>
<content:encoded><![CDATA[It has taken me two years to get back to this blog. It really is not a huge priority to keep writing about whatever is on my mind. But I would like to keep track of all the things that I am trying to learn. It always feels like I'm merely scratching the surface. It's like chasing the wind.

My next project? Talk about chasing the wind. I'm toying with the idea of recreating <a title="an XSLT-based content management system" href="http://www.symphony21.com/" target="_self">Symphony</a> in Perl. I spend most of my time developing solutions to web development problems using the tools available in the web standards toolbox: XHTML, CSS, XSLT. I work with open source scripting languages and tools. I'm going to make my process, erratic as it is, open as well.

I don't tend to work with Wordpress much, but this allows me the ability to write without worrying about the structure of the site, the design, etc. I can just write and switch my theme as I please. I just applied the Hemingway theme today, and I'll see how I like it.]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>3</wp:post_id>
<wp:post_date>2008-06-28 12:47:41</wp:post_date>
<wp:post_date_gmt>2008-06-28 20:47:41</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>blogging-is-not-my-thing</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1214718418</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Setting Up a Development Environment in Mac OS X</title>
<link>http://bauhouse.wordpress.com/2008/06/28/setting-up-a-development-environment-in-mac-os-x/</link>
<pubDate>Sun, 29 Jun 2008 05:47:18 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[Mac OS X]]></category>

		<category domain="category" nicename="mac-os-x"><![CDATA[Mac OS X]]></category>

		<category><![CDATA[Perl]]></category>

		<category domain="category" nicename="perl"><![CDATA[Perl]]></category>

		<category><![CDATA[Technology]]></category>

		<category domain="category" nicename="technology"><![CDATA[Technology]]></category>

		<category domain="tag"><![CDATA[Apache]]></category>

		<category domain="tag" nicename="apache"><![CDATA[Apache]]></category>

		<category domain="tag"><![CDATA[Aptana]]></category>

		<category domain="tag" nicename="aptana"><![CDATA[Aptana]]></category>

		<category domain="tag"><![CDATA[Mac OS X]]></category>

		<category domain="tag" nicename="mac-os-x"><![CDATA[Mac OS X]]></category>

		<category domain="tag"><![CDATA[Perl]]></category>

		<category domain="tag" nicename="perl"><![CDATA[Perl]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=5</guid>
<description></description>
<content:encoded><![CDATA[<p>I work at a web agency called Domain7 in Abbotsford, BC, Canada. It's a fun group of people to work with. I'm about a decade older than most of them. It helps keep my young. Domain7 has a suite of tools that the owner, Shawn Neumann has been developing for the last ten years, called RouteOne. The application and its components are written in Perl and developed in a Linux environment. Perl is a language that I have very little experience with. I once played around with MovableType. That's about it.</p>

<p>I have been doing interface design for the Project Manager module of the system, and we have it to the point that our entire team has been using it to track time for Projects and Tickets. I like to be able to understand how the system works so I can add functionality in a way that works. To be able to help with the development of the application, I want to learn a little Perl to help me understand our templating system better. Also, I have some ideas about how we might be able to make things better by using XSLT as a templating engine for the system. I'm a big fan of open source and web standards, plus my experience with a web publishing application called Symphony has sold me on the idea of using XSLT to develop a much more flexible system for managing content.</p>

<h3>Requirements</h3>
<p>To that end, I wanted to set up a development environment for working on RouteOne, our suite of proprietary web tools and modules. To accomplish this, I needed Apache, MySQL, Perl and an Eclipse-based IDE with CVS support. Here are the steps I took to set up my system.</p>

<p>I started with a fresh install of Mac OS X 10.5.3 on my Power Mac G5 booting off an external LaCie Firewire drive. This allows me to have a portable system, separate from the system I use for home use.</p>

<h4>Hardware Overview</h4>

<pre>Model Name:            Power Mac G5
Model Identifier:      PowerMac7,3
Processor Name:        PowerPC G5 (3.0)
Processor Speed:       2 GHz
Number Of CPUs:        2
L2 Cache (per CPU):    512 KB
Memory:                2 GB
Bus Speed:             1 GHz
Boot ROM Version:      5.2.4f1</pre>

<h4>System Software Overview</h4>

<pre>System Version:        Mac OS X 10.5.3 (9D34)
Kernel Version:        Darwin 9.3.0</pre>

<h3>Mac OS X Software</h3>

<p>To start with, I don't need a whole lot as far as software goes. I can generally find free software for everything that I might want to do. I recommend the following if you want to go the free/open source route:</p>

<h4>Free/Open Source Tools</h4>
<ul>
<li><a href="http://www.getfirefox.com/">Firefox</a> - web browser</li>
<li><a href="http://getfirebug.com/">Firebug</a> - an indispensable Firefox web developer plugin</li>
<li><a href="http://barebones.com/products/textwrangler/">TextWrangler</a> - text editor</li>
<li><a href="http://aptana.com/studio/">AptanaStudio</a> - a nice open source IDE (integrated development environment)</li>
<li><a href="http://cyberduck.ch/">Cyberduck</a> - FTP/SFTP client</li>
<li><a href="http://www.mamp.info/">MAMP</a> - Apache, MySQL and PHP for Mac OS X</li>
<li><a href="http://21degrees.com.au/products/symphony/">Symphony</a> - a web publishing system based on PHP, XML and XSLT</li>
</ul>

<h4>Commercial Tools</h4>

<p>Panic produces two of what have become my favourite tools for web development. Also, Adobe Creative Suite 3 rounds out requirements as a graphic designer/web developer.</p>
<ul>
<li><a href="http://www.panic.com/transmit/">Transmit</a> - FTP/SFTP client</li>
<li><a href="http://www.panic.com/coda/" title="One Window Web Development">Coda</a> - text editor, FTP client, terminal, css editor, browser</li>
<li><a href="http://www.adobe.com/products/creativesuite/">Adobe Creative Suite</a> - Illustrator, Photoshop - graphics and image editing</li>
</ul>

<h3>Installation Procedure</h3>

<p>The system I needed to set up required several Perl modules to be installed, in addition to Apache and MySQL. I decided, based on previous experience, that I was going to avoid using CPAN to install Perl modules as much as possible. I found that using MacPorts was much faster by far, and less prone to additional user input and errors resulting from missing dependencies.</p>

<h4>Install MacPorts</h4>

<p>According to the <a href="http://www.macports.org/">MacPorts</a> website:</p>

<blockquote>The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system. To that end we provide the command-line driven MacPorts software package under a BSD License, and through it easy access to thousands of ports that greatly simplify the task of compiling and installing open-source software on your Mac.</blockquote>

<p>Before installing MacPorts, it is required to install Apple's XCode Developer Tools and X11. This software is included on the install disks for the Mac. However, the latest version of <a href="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=19897">XCode</a> is available for download from the <a href="http://developer.apple.com/">Apple Developer Connection</a>.</p>

Download the appropriate MacPorts package installer. Run the package installer. When installed, open Terminal and run the following command to update MacPorts to the latest version:</p>

<code><pre>	sudo port -v selfupdate</pre></code>

<h4>Install MySQL</h4>

<p>Review instructions for <a href="http://dev.mysql.com/doc/refman/5.0/en/installation-overview.html">upgrading/installing MySQL</a></p>

<p>Marc Liyanage provides a good set of instructions for <a href="http://www.entropy.ch/software/macosx/mysql/">installing and upgrading MySQL</a>. Download latest version of the <a href="http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg">Mac OS X package installer for MySQL 5.0</a>. Install MySQL by running the installer:</p>

<code><pre>	mysql-5.0.51b-osx10.4-powerpc.pkg</pre></code>

<p>Install MySQL Startup Item by running the installer:</p>

<code><pre>	MySQLStartupItem.pkg</pre></code>

<p>Install MySQL.prefPane:</p>

<code><pre>	/Library/PreferencePanes/MySQLStartupItem.pkg</pre></code>

<p>Add aliases to .profile. (By the way, I am using TextWrangler here with the command line tools installed so that when I type <code>edit filename</code>, this will automatically open the file <code>filename</code> in TextWrangler for editing. One of the things I like about TextWrangler is its integration with Terminal in Mac OS X. As an alternative, use <code>nano</code> to edit this file. It will not be visible in the Finder because any file that starts with a <code>.</code> is a hidden file in the Finder. Use Terminal or an application such as TextWrangler, Transmit or Coda which can be enabled to view hidden or invisible files.)</p>

<code><pre>	cd ~
	edit .profile</pre></code>

<p>Add the following to the .profile</p>

<code><pre>	alias mysql=/usr/local/mysql/bin/mysql
	alias mysqladmin=/usr/local/mysql/bin/mysqladmin</pre></code>

<p>Start up MySQL server:</p>

<code><pre>	sudo /usr/local/mysql/bin/mysqld_safe</pre></code>

<p>Login to MySQL monitor</p>

<code><pre>	mysql -u root</pre></code>

<p>Verify that MySQL server 5.0.51b is installed. Upon typing the above command in Terminal, you should receive a message similar to the welcome message below. You may want to follow the <a href="http://dev.mysql.com/doc/refman/5.0/en/user-account-management.html" title="MySQL User Account Management">recommended instructions</a> to change the root password and set up a new user.</p>

<code><pre>	Welcome to the MySQL monitor.  Commands end with ; or \g.
	Your MySQL connection id is 1
	Server version: 5.0.51b MySQL Community Server (GPL)

	Type 'help;' or '\h' for help. Type '\c' to clear the buffer.</pre></code>

<p>To view the databases available to the root MySQL user, type the following at the <code>mysql&gt;</code> prompt</p>

<code><pre>	mysql&gt; show databases;
	+--------------------+
	| Database           |
	+--------------------+
	| information_schema | 
	| mysql              | 
	| test               | 
	+--------------------+
	3 rows in set (0.00 sec)

	mysql&gt; exit
	Bye</pre></code>

<p>Shutdown MySQL server:</p>

<code><pre>	sudo /usr/local/mysql/bin/mysqladmin shutdown</pre></code>

<h3>Install Apache 2.0 with MacPorts</h3>

<p>Because I wanted to maintain an Apache install independent of the default Mac OS X Apache WebServer, I chose to use MacPorts, which installs into <code>/opt/local/apache2/</code>. Find the latest version of Apache from MacPorts:</p>

<code><pre>	port search apache</pre></code>

<p>Find the latest port for Apache 2.8.8</p>

<code><pre>	apache2	www/apache2	2.2.8	The extremely popular second version of the Apache http server</pre></code>

<p>Get more information on the Apache 2 port</p>

<code><pre>	port info apache2</pre></code>

<p>List dependencies</p>

<code><pre>	port deps apache2</pre></code>

<p>Install Apache 2.2.8</p>

<code><pre>	sudo port install apache2
	fetch failed</pre></code>

<p>Apache 2.2.9 has been released, so the old version is no longer available</p>

<code><pre>	http://trac.macports.org/ticket/15630</pre></code>

<p>Install Apache 2.2.9</p>

<code><pre>	sudo env MASTER_SITE_LOCAL=http://distfiles.macports.org/apache2 port -v fetch apache2
	sudo port install apache2</pre></code>

<p>The install process provides feedback like this in Terminal:</p>
<code><pre>		...
		---&gt;  Verifying checksum(s) for apache2
		---&gt;  Extracting apache2
		---&gt;  Configuring apache2
		---&gt;  Building apache2 with target all
		---&gt;  Staging apache2 into destroot
		---&gt;  Creating launchd control script
		###########################################################
		# A startup item has been generated that will aid in
		# starting apache2 with launchd. It is disabled
		# by default. Execute the following command to start it,
		# and to cause it to launch at startup:
		#
		# sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
		###########################################################
		Warning: apache2 requests to install files outside the common directory structure!
		---&gt;  Installing apache2 2.2.9_1+darwin_9
		---&gt;  Activating apache2 2.2.9_1+darwin_9
		---&gt;  Cleaning apache2
</pre></code>

<h3>Install Perl with MacPorts</h3>

<p>Find the latest version of Perl from MacPorts:</p>

<code><pre>	port search perl</pre></code>

<p>Find the port for Perl 5.8.8</p>

<code><pre>	perl5.8	lang/perl5.8	5.8.8	Perl 5.8.x - Practical Extraction and Report Language</pre></code>
	
<p>Get more information on the Perl 5.8 port</p>

<code><pre>	port info perl5.8

		perl5.8 5.8.8, Revision 2, lang/perl5.8 (Variants: darwin, threads, shared, darwin_8, darwin_9)
		http://www.perl.org/

		Perl is a general-purpose programming language originally developed for text manipulation and now used for a wide range of tasks including system administration, web development, network programming, GUI development, and more.
		
		Platforms: darwin freebsd linux
		Maintainers: nomaintainer@macports.org</pre></code>

<p>Install Perl 5.8.8</p>

<code><pre>	sudo port install perl5.8

		Skipping org.macports.activate (perl5.8 +darwin_8) since this port is already active
		---&gt;  Cleaning perl5.8</pre></code>
	
<p>I believe Perl had already been installed as one of the dependencies of Apache.</p>

<h3>Install Mod Perl Apache Module with MacPorts</h3>

<p>Find the latest version of Perl from MacPorts:</p>

<code><pre>	port search perl</pre></code>

<p>Find the port for mod_perl2</p>

<code><pre>	mod_perl2	www/mod_perl2	2.0.3	Embeds a Perl interpreter in the Apache2 server</pre></code>

<p>Install mod_perl</p>

<code><pre>	sudo port install mod_perl2</pre></code>

<h3>Stop Mac OS X WebServer</h3>

<p>Stop the native web server to avoid conflicts with MacPorts version</p>
	
<code><pre>	sudo apachectl stop</pre></code>

<p>A list of apachectl commands</p>

<code><pre>	start      - start httpd
	stop       - stop httpd
	restart    - restart httpd if running by sending a SIGHUP or start if 
				 not running
	fullstatus - dump a full status screen; requires lynx and mod_status enabled
	status     - dump a short status screen; requires lynx and mod_status enabled
	graceful   - do a graceful restart by sending a SIGUSR1 or start if not running
	configtest - do a configuration syntax test
	help       - this screen</pre></code>

<h3>Modify the Apache Configuration file</h3>

<p>Copy the sample configuration file</p>

<code></pre>	cd /opt/local/apache2/conf
	sudo cp httpd.conf.sample httpd.conf</pre></code>

<p>Enable mod_perl in the httpd.conf file by adding the following line to httpd.conf</p>

<code><pre>	LoadModule perl_module modules/mod_perl.so</pre></code>

<h4>Start MacPorts Apache2	</h4>

<p>Start Apache with the following command</p>

<code><pre>	sudo /opt/local/apache2/bin/apachectl start</pre></code>


<h4>Test Apache Server</h4>

<p>Go to <a href="http://localhost/">http://localhost/</a>. If all went well, there should be a message in the browser window with the following message:</p>
	
<blockquote>It works!</blockquote>

<h3>Check out CVS project with AptanaStudio</h3>

<p>Assuming AptanaStudio is already installed, documentation for CVS support can be found on the <a href="http://www.aptana.com/plugins">Aptana Plugins</a> page:</p>

<blockquote>
<p>CVS Support. This adds the Eclipse CVS plugins not bundled with Aptana Studio standalone.</p>
<ol>
<li>Go to the Update Manager in Aptana Studio via Help-&gt;Software Updates-&gt;Find and Install...</li>
<li>Add a new Remote Update site to the following url: http://update.aptana.com/install/cvs/</li>
<li>Install the Eclipse CVS feature from that update site</li>
</ol>
</blockquote>

<p>In Aptana, create a new project</p>

<code><pre>	File &gt; New &gt; Project &gt; CVS &gt; Projects from CVS</pre></code>

<h3>Install Perl Packages</h3>

<p>Several Perl modules are available from the CPAN. On the Mac, it seems to be far easier to use MacPorts for as many modules as are available. These are the modules that were required that could be found at MacPorts, listed according to the commands used to install the packages:</p>

<code><pre>	sudo port install p5-archive-tar
	sudo port install p5-archive-zip
	sudo port install p5-authen-sasl
	sudo port install p5-bsd-resource
	sudo port install p5-bit-vector
	sudo port install p5-cache-cache
	sudo port install p5-class-singleton
	sudo port install p5-crypt-passwdmd5
	sudo port install p5-module-build
	sudo port install p5-datetime
	sudo port install p5-date-calc
	sudo port install p5-digest
	sudo port install p5-digest-hmac
	sudo port install p5-email-valid
	sudo port install p5-file-mmagic
	sudo port install p5-html-parser
	sudo port install p5-html-tree
	sudo port install p5-libwww-perl
	sudo port install p5-mailtools
	sudo port install p5-mime-lite
	sudo port install p5-module-install
	sudo port install p5-net-telnet
	sudo port install p5-soap-lite
	sudo port install p5-string-crc32
	sudo port install p5-text-csv
	sudo port install p5-timedate
	sudo port install p5-time-piece
	sudo port install p5-time-modules
	sudo port install p5-xml-simple
	sudo port install p5-cgi-simple
	sudo port install p5-mail-imapclient
	sudo port install p5-xml-rss
	sudo port install p5-perl-ldap
	sudo port install ImageMagick +perl	
</pre></code>

<p>I found a few more packages that might aid in developing an XSLT templating solution for our suite of tools</p>

<code><pre>	sudo port install p5-xml-libxml
	sudo port install libxslt
	sudo port install p5-xml-libxslt
</pre></code>

<p>Those packages I could not find in MacPorts, I installed using <a href="http://cpan.org/">CPAN</a>, the Comprehensive Perl Archive Network. Mac OS X comes installed with Perl, along with a command line program, <code>cpan</code>, for installing Perl modules. Running the first <code>cpan</code> command begins an initialization process. I initialized it with all the default settings, by pressing the <em>Return</em> button when prompted to select an option, and ignoring any missing software.</p>

<code><pre>	sudo cpan -i Crypt::Util
	sudo cpan -i Net::FTPServer::XferLog
	sudo cpan -i Chart::Graph::Gnuplot
	sudo cpan -i Math::FixedPrecision
	sudo cpan -i Net::LDAP
	sudo cpan -i SOAP::Amazon::S3
	sudo cpan -i MIME::WordDecoder
	sudo cpan -i DBI
	sudo cpan -i DBD::mysql</pre></code>

<h3>Configure Apache</h3>

<p>To configure Apache to run Perl scripts in a specific directory, edit the configuration file.</p>

<code><pre>	edit httpd.conf</pre></code>

<p>Then add directives for each directory:</p>

<code><pre>	### Perl directories: execute scripts in these directories
	&lt;Directory "/opt/local/apache2/htdocs/perl/*"&gt;
		Options Indexes FollowSymLinks +ExecCGI
		AllowOverride All
		Order allow,deny
		Allow from all
	&lt;/Directory&gt;
	
	&lt;Directory "/opt/local/apache2/htdocs/symperl/*"&gt;
		Options Indexes FollowSymLinks +ExecCGI
		AllowOverride All
		Order allow,deny
		Allow from all
	&lt;/Directory&gt;</pre></code>

<h3>Running Multiple Apache Web Servers</h3>

<p>To be able to run the default Mac OS X Web Server, the MacPorts Apache 2 Web Server, and MAMP simultaneously, I can run each server on a different port. For the MacPorts server, I modified the Apache configuration file to run the server on port 3000.<p>

<code><pre>	cd /opt/local/apache2/conf
	edit httpd.conf</pre></code>

<p>Look for a line that directs the server to run on the default port, port 80:</p>

<code><pre>	Listen 80</pre></code>

<p>Then, to run the server on port 3000, change the line to this:</p>

<code><pre>	Listen 3000</pre></code>

<p>To have completely separate installs of Apache, including separate MySQL installs, I should also install MySQL using MacPorts. That way, I can have multiple instances of MySQL running on different ports. However, that seems a little overkill (if this whole setup doesn't already). So, that's my development environment.</p>
]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>5</wp:post_id>
<wp:post_date>2008-06-28 21:47:18</wp:post_date>
<wp:post_date_gmt>2008-06-29 05:47:18</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>setting-up-a-development-environment-in-mac-os-x</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1214806196</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>12</wp:comment_id>
<wp:comment_author><![CDATA[sufcboy]]></wp:comment_author>
<wp:comment_author_email>sufcboy@yahoo.com</wp:comment_author_email>
<wp:comment_author_url>http://www.nickbennett.co.uk</wp:comment_author_url>
<wp:comment_author_IP>90.212.19.86</wp:comment_author_IP>
<wp:comment_date>2008-07-16 13:40:18</wp:comment_date>
<wp:comment_date_gmt>2008-07-16 20:40:18</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Excellent tutorial. Recently moved from PC to Mac and I've been struggling to get my environment set up. This has been a great help cheers!]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>13</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>70.69.140.3</wp:comment_author_IP>
<wp:comment_date>2008-07-17 08:51:09</wp:comment_date>
<wp:comment_date_gmt>2008-07-17 15:51:09</wp:comment_date_gmt>
<wp:comment_content><![CDATA[@sufcboy, glad this was helpful for you. I intended this to be less a tutorial and more a reminder of what I did. But if I can make your switch to Mac more enjoyable, all the better. If you're looking for an easier set up, I would recommend <a href="http://www.mamp.info/" rel="nofollow">MAMP</a> as well. I just needed something I could customize with MacPorts.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>21</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>70.69.162.138</wp:comment_author_IP>
<wp:comment_date>2008-07-25 07:19:13</wp:comment_date>
<wp:comment_date_gmt>2008-07-25 14:19:13</wp:comment_date_gmt>
<wp:comment_content><![CDATA[I have this in my httpd-vhosts.conf file:

<code>&lt;Directory "/Users/*/Sites"&gt;
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All  
    Order allow,deny
    Allow from all
&lt;/Directory&gt;

NameVirtualHost 127.0.0.1
</code>]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>19</wp:comment_id>
<wp:comment_author><![CDATA[sufcboy]]></wp:comment_author>
<wp:comment_author_email>sufcboy@yahoo.com</wp:comment_author_email>
<wp:comment_author_url>http://www.nickbennett.co.uk</wp:comment_author_url>
<wp:comment_author_IP>90.212.19.86</wp:comment_author_IP>
<wp:comment_date>2008-07-25 04:01:57</wp:comment_date>
<wp:comment_date_gmt>2008-07-25 11:01:57</wp:comment_date_gmt>
<wp:comment_content><![CDATA[I'm having permission issues and wondered if you might have the answer. 

I want to use the virtual host entries i had for the default installation of apache. I've uncommented the line

Include conf/extra/httpd-vhosts.conf

in the httpd.conf file. And copied my entries across to the  httpd-vhosts.conf file. Unfortunately I'm getting forbidden errors, even after I've changed the permission on that directory?

The directories are based here

/Users/MYUSERNAME/Sites/

Any ideas? Thanks in advance]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>22</wp:comment_id>
<wp:comment_author><![CDATA[sufcboy]]></wp:comment_author>
<wp:comment_author_email>sufcboy@yahoo.com</wp:comment_author_email>
<wp:comment_author_url>http://www.nickbennett.co.uk</wp:comment_author_url>
<wp:comment_author_IP>90.212.19.86</wp:comment_author_IP>
<wp:comment_date>2008-07-25 10:37:59</wp:comment_date>
<wp:comment_date_gmt>2008-07-25 17:37:59</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Brilliant...that worked. However the sites in this directory are written in PHP. I think I'll just have PHP running from the default apache and mod_perl running from this instance.

Thanks for your help!]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>52</wp:comment_id>
<wp:comment_author><![CDATA[Nick Bennett &raquo; Blog Archive &raquo; Creating new sites for Mac Ports]]></wp:comment_author>
<wp:comment_author_email></wp:comment_author_email>
<wp:comment_author_url>http://www.nickbennett.co.uk/?p=20</wp:comment_author_url>
<wp:comment_author_IP>85.234.138.57</wp:comment_author_IP>
<wp:comment_date>2008-11-30 08:12:34</wp:comment_date>
<wp:comment_date_gmt>2008-11-30 15:12:34</wp:comment_date_gmt>
<wp:comment_content><![CDATA[[...] different as I&#8217;m using the Macports installation for Apache, MySQL, PHP and Perl. I found bauhouse&#8217;s blog to be the biggest help with setting this [...] ]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type>pingback</wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>Essential ActionScript 3.0</title>
<link>http://bauhouse.wordpress.com/2008/06/29/essential-actionscript-30/</link>
<pubDate>Sun, 29 Jun 2008 14:08:34 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

		<category><![CDATA[Technology]]></category>

		<category domain="category" nicename="technology"><![CDATA[Technology]]></category>

		<category domain="tag"><![CDATA[ActionScript]]></category>

		<category domain="tag" nicename="actionscript"><![CDATA[ActionScript]]></category>

		<category domain="tag"><![CDATA[Flex SDK]]></category>

		<category domain="tag" nicename="flex-sdk"><![CDATA[Flex SDK]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=7</guid>
<description></description>
<content:encoded><![CDATA[<p><a href="http://moock.org/" title="Colin Moock's website">Colin Moock</a> has written a book called <em><a href="http://moock.org/eas3/examples/" title="ActionScript 3.0 Code Examples">Essential ActionScript 3.0</a></em> and I am making it one of my goals to learn how to use as many open source languages as possible to expand on the knowledge I have gained building applications in Symphony, using XML, XSLT and CSS. I'm keenly interested in knowing how the open source <a href="http://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_sdk.html" title="Flex 3 SDK Release Notes">Flex SDK 3</a> can be used to create Rich Internet Applications that integrate with applications like Symphony, built on open source standards such as XML and XSLT.</p>

<p>I will be adding to this document as I go.</p>

<h3>Getting Started</h3>

<p>First, I need a compiler. For whatever reason, I cannot use Adobe Flash CS3 at home, even though I have a license that allows having Flash installed at home and at work. For whatever reason, the CS3 install I have at home just stopped working. Strange. I'll have to reinstall at some point. For now, I'm going to use the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK">Flex 3 SDK</a> to compile ActionScript from source. I have a previous version of Flex, the Flex 2 SDK, but I'm going to download the latest Software Developers Kit to see how compatible Colin's book will be with the latest version of Flex. ActionScript 3.0 has not changed, so I don't foresee a problem.</p>

<p>Adobe has provided some documentation on <a href="http://www.adobe.com/devnet/flex/?tab:quickstart=1">Getting Started with Flex 3 SDK</a> in the Adobe Flex Developer Center. The <a href="http://opensource.adobe.com/wiki/display/flexsdk/Developer+Documentation">Developer Documentation for Adobe Flex</a> is also available at <a href="http://opensource.adobe.com/">Adobe Open Source</a>.</p>

<p>To start with, I have downloaded the Flex 3 SDK and installed it where I can easily access it on the command line:</p>

<code><pre>~/flex_sdk_3</pre></code>

<p>I'm using Mac OS X 10.5.3, so that means I have installed the Flex 3 SDK at the root of my user directory:</p>

<code><pre>/Users/stephen/flex_sdk_3</pre></code>


<p>I also followed the <a href="http://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_sdk.html">recommendation</a> to <a href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14157">uninstall the Flash Player</a> before installing the player supplied with the SDK.</p>

<code><pre>~/flex_sdk_3/runtimes/player/mac/Install Flash Player 9 UB.dmg</pre></code>

<p>I have chosen to use <a href="http://www.panic.com/coda/" title="One-Window Web Development for Mac OS X">Panic's Coda</a> as my IDE for developing ActionScript. It is a text editor with some nice extras, including a built in Terminal and web browser based on Apples's <a href="http://webkit.org/">WebKit</a> project used to build Safari. There's no reason you couldn't use free tools: Terminal, Safari and <a href="http://barebones.com/products/textwrangler/">TextWrangler</a>, for instance. But I love working with Panic's well-designed tools, such as Coda and Transmit.

<h3>Chapter 1: Core Concepts</h3>

<p>In the first chapter, Colin provides an overview of the tools for writing ActionScript code: text editor, Adobe Flex Builder, and Adobe Flash; describes the Flash Client Runtime Environment, Compilation. Then, he jumps right into  a step-by-step process of creating a virtual zoo example program to teach the core concepts about:</p>

<ul>
<li>Packages</li>
<li>Classes</li>
<li>Access Control Modifiers</li>
<li>Constructor Methods</li>
<li>Objects</li>
<li>Variables and Values</li>
<li>Constructor Parameters and Arguments</li>
<li>Expressions</li>
<li>Instance Variables</li>
<li>Instance Methods</li>
<li>Method Return Values</li>
</ul>






]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>7</wp:post_id>
<wp:post_date>2008-06-29 06:08:34</wp:post_date>
<wp:post_date_gmt>2008-06-29 14:08:34</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>essential-actionscript-30</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1214806182</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Compiling ActionScript 3.0 with Flex 3 SDK</title>
<link>http://bauhouse.wordpress.com/2008/06/29/compiling-actionscript-30-with-flex-3-sdk/</link>
<pubDate>Mon, 30 Jun 2008 05:45:48 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

		<category domain="tag"><![CDATA[ActionScript]]></category>

		<category domain="tag" nicename="actionscript"><![CDATA[ActionScript]]></category>

		<category domain="tag"><![CDATA[Flex SDK]]></category>

		<category domain="tag" nicename="flex-sdk"><![CDATA[Flex SDK]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=9</guid>
<description></description>
<content:encoded><![CDATA[<p>Upon installation of the Flex 3 SDK in Mac OS X, I installed Flex in a place that I could find easily on the command line without having to worry about permissions too much.</p>

<code>
<pre>~/flex_sdk_3</pre>
</code>

<p>According to the <a href="http://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_sdk.html">Flex 3 SDK Release Notes</a>, I should be able to review the explorer example by running the following script.</p>

<code>
<pre>install_root/samples/explorer/build.sh</pre>
</code>

<p>Well, I mistakenly thought I could navigate to that directory and run the script.</p>

<code>
<pre>cd ~/flex_sdk_3/samples/explorer
build.sh</pre>
</code>

<p>However, that didn't work. I needed to run the script using the full path.</p>

<code>
<pre>/Users/stephen/flex_sdk_3/samples/explorer/build.sh</pre>
</code>

<p>The code is still compiling several minutes later. I think I'm going to need a faster processor for testing large applications like this. I suppose it should be fine for short snippets of ActionScript code.</p>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>9</wp:post_id>
<wp:post_date>2008-06-29 22:45:48</wp:post_date>
<wp:post_date_gmt>2008-06-30 05:45:48</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>compiling-actionscript-30-with-flex-3-sdk</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1215054390</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Rewriting Symphony in Perl</title>
<link>http://bauhouse.wordpress.com/2008/06/30/rewriting-symphony-in-perl/</link>
<pubDate>Tue, 01 Jul 2008 00:46:07 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[Perl]]></category>

		<category domain="category" nicename="perl"><![CDATA[Perl]]></category>

		<category domain="tag"><![CDATA[Perl]]></category>

		<category domain="tag" nicename="perl"><![CDATA[Perl]]></category>

		<category domain="tag"><![CDATA[Symphony]]></category>

		<category domain="tag" nicename="symphony"><![CDATA[Symphony]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=11</guid>
<description></description>
<content:encoded><![CDATA[<p>Rewrite <a href="http://beta.overture21.com/forum/comments.php?DiscussionID=352">Symphony in Perl</a>?</p>

<blockquote>What a ridiculous idea.</blockquote>

<p>Yeah. Pretty much. But if I'm going to spend some time learning how to program in PHP and Perl, what better way to pay homage to the best content management system I've ever had the pleasure to use. Problem is, it's always a work in progress. I've been spending time with Symphony 2 Beta Revision 5, building XSLT templates for a <a href="http://beta.overture21.com/forum/?CategoryID=7">number of applications</a>. These can be saved as what are called "Ensembles", a ZIP file containing all you need to install the application in seconds on the PHP, MySQL and XSL enabled server of your choice. Of course, they are all crippled, unfinished example applications of what can be developed with Symphony. As soon as I discovered that the Beta version will be incompatible with Release Candidate 1, I lost interest in continuing the development of these ensembles, at least for the moment.</p>

<h3>Symphony Ensembles</h3>

<ul>
<li><a href="http://beta.overture21.com/forum/comments.php?DiscussionID=153">System Navigation</a></li>
<li><a href="http://beta.overture21.com/forum/comments.php?DiscussionID=170">Address Book</a></li>
<li><a href="http://beta.overture21.com/forum/comments.php?DiscussionID=181">Projects</a></li>
<li><a href="http://beta.overture21.com/forum/comments.php?DiscussionID=209">Finances</a></li>
<li><a href="http://beta.overture21.com/forum/comments.php?DiscussionID=201">Calendar</a></li>
<li><a href="http://beta.overture21.com/forum/comments.php?DiscussionID=333">Destinations / XML Importer</a></li>
</ul>

<p>I'd like to get to a point that I can build my own Symphony Extensions, so I'd like to understand what's going on under the hood. If I can translate from one language to another, I think I'll have a pretty good grasp of how the application works.</p>

<p>So, where to start. I figured the configuration file would be a good place to start. I first need to know how to translate the variables the will be necessary to interact with the database and file system.</p>

<p>Probably not the simplest place to start, since it appears that the configuration settings are stored as a multidimensional array in the configuration file. Consulting with Larry Wall's book, <em>Programming Perl</em>, published by O'Reilly, I found a section on hashes of hashes. So, I came up with a couple ways I could generate code that could duplicate the Symphony configuration settings.</p>

<code><pre>#!/opt/local/bin/perl
# Symperl Configuration File

# To simulate the multidimensional array used for Symphony's 
# configuration settings, use hashes of hashes to define values

# %settings = (
# 	admin =&gt; {
# 		max_upload_size =&gt; "5242880",
# 	},
# 	symphony =&gt; {
# 		pagination_maximum_rows =&gt; "17",
# 		allow_page_subscription =&gt; "1",
# 		lang =&gt; "en",
# 		build =&gt; "2000",
# 		cookie_prefix =&gt; "sym-",
# 	},
# 	log =&gt; {
# 		archive =&gt; "1",
# 		maxsize =&gt; "102400",
# 	},
# 	general =&gt; {
# 		sitename =&gt; "Symperl: Symphony in Perl",
# 		useragent =&gt; "Symperl/1000",
# 	},
# 	image =&gt; {
# 		cache =&gt; "1",
# 		quality =&gt; "90",
# 	},
# 	database =&gt; {
# 		driver =&gt; "mysql",
# 		character_set =&gt; "utf8",
# 		character_encoding =&gt; "utf8",
# 		runtime_character_set_alter =&gt; "0",
# 		disable_query_caching =&gt; "no",
# 		host =&gt; "localhost",
# 		port =&gt; "3306",
# 		user =&gt; "root",
# 		password =&gt; "",
# 		db =&gt; "sym2_beta",
# 		tbl_prefix =&gt; "sym_",
# 	},
# 	public =&gt; {
# 		maintenance_mode =&gt; "no",
# 	},
# 	region =&gt; {
# 		time_format =&gt; "g:i a",
# 		date_format =&gt; "j F Y",
# 		timezone =&gt; "America/Vancouver",
# 	},
# 	file =&gt; {
# 		write_mode =&gt; "0777",
# 	},
# 	directory =&gt; {
# 		write_mode =&gt; "0755",
# 	},
# );

# Hashes can also be created by defining values in this way
# $settings{admin}{username} = "stephen";

# To emulate Symphony's configuration settings
# declare $settings as above

$settings{admin}{max_upload_size} = '5242880';
$settings{symphony}{pagination_maximum_rows} = '17';
$settings{symphony}{allow_page_subscription} = '1';
$settings{symphony}{lang} = 'en';
$settings{symphony}{build} = '2000';
$settings{symphony}{cookie_prefix} = 'sym-';
$settings{log}{archive} = '1';
$settings{log}{maxsize} = '102400';
$settings{general}{sitename} = 'Spectrum: Symphony Theme';
$settings{general}{useragent} = 'Symphony/2000';
$settings{image}{cache} = '1';
$settings{image}{quality} = '90';
$settings{database}{driver} = 'mysql';
$settings{database}{character_set} = 'utf8';
$settings{database}{character_encoding} = 'utf8';
$settings{database}{runtime_character_set_alter} = '0';
$settings{database}{disable_query_caching} = 'no';
$settings{database}{host} = 'localhost';
$settings{database}{port} = '3306';
$settings{database}{user} = 'root';
$settings{database}{password} = '';
$settings{database}{db} = 'sym2_beta';
$settings{database}{tbl_prefix} = 'sym_';
$settings{public}{maintenance_mode} = 'no';
$settings{region}{time_format} = 'g:i a';
$settings{region}{date_format} = 'j F Y';
$settings{region}{timezone} = 'America/Vancouver';
$settings{file}{write_mode} = '0777';
$settings{directory}{write_mode} = '0755';


# Print configuration settings, Symphony style
# (Required a lot of character escaping for single quotes)
foreach $setting_type ( keys %settings ) {
	foreach $setting_value (keys %{ $settings{$setting_type} } ) {
		print '$settings[\'', "$setting_type", '\'][\'', "$setting_value", '\'] = \'', "$settings{$setting_type}{$setting_value}", '\';', "\n";
	}
}

# Awesome. It works!</pre></code>

<p>Running this code on the command line produced output identical to the list of settings in the config.php file.</p>

]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>11</wp:post_id>
<wp:post_date>2008-06-30 17:46:07</wp:post_date>
<wp:post_date_gmt>2008-07-01 00:46:07</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>rewriting-symphony-in-perl</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1214874588</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>38</wp:comment_id>
<wp:comment_author><![CDATA[Kamy Lamm]]></wp:comment_author>
<wp:comment_author_email>kamylamm@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://www.cattechnologies.com/1to5employees.aspx</wp:comment_author_url>
<wp:comment_author_IP>220.227.250.186</wp:comment_author_IP>
<wp:comment_date>2008-08-22 02:18:41</wp:comment_date>
<wp:comment_date_gmt>2008-08-22 09:18:41</wp:comment_date_gmt>
<wp:comment_content><![CDATA[The information you have given about Rewriting Symphony in Perl is really so good, I got some nice tips from the coding part you mentioned. thanks for your effort]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>Understanding Symphony's File Structure</title>
<link>http://bauhouse.wordpress.com/2008/06/30/understanding-symphonys-file-structure/</link>
<pubDate>Tue, 01 Jul 2008 01:00:51 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[CMS]]></category>

		<category domain="category" nicename="cms"><![CDATA[CMS]]></category>

		<category><![CDATA[Symphony]]></category>

		<category domain="category" nicename="symphony"><![CDATA[Symphony]]></category>

		<category domain="tag"><![CDATA[Symphony]]></category>

		<category domain="tag" nicename="symphony"><![CDATA[Symphony]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=12</guid>
<description></description>
<content:encoded><![CDATA[This is incomplete. I'll be adding to this as I go.

<code> </code>
<pre>-----------------------------------------------
Symphony 2.0 File Structure (default install)
-----------------------------------------------

  .htaccess
+ extensions
    + export_ensemble
          extension.driver.php
        + lib
              class.mysqldump.php
              installer.tpl
          LICENCE
          README
    + maintenance_mode
          extension.driver.php
          LICENCE
          README
    + markdown
          extension.driver.php
        + lib
              markdown_extra.php
              markdown.php
              smartypants.php
          LICENCE.txt
        + text-formatters
              formatter.pb_markdown.php
              formatter.pb_markdownextra.php
              formatter.pb_markdownextrasmartypants.php
    + selectbox_link_field
          extension.driver.php
        + fields
              field.selectbox_link.php
          LICENCE
          README
  index.php
  install-log.txt
  install.php
  LICENCE.txt
+ manifest
    + cache
      congif.php
    + logs
          main
    + tmp
  README.txt
+ symphony
      .htaccess
    + assets
          admin.css
          admin.js
          basic.css
          code.css
          debug.css
          error.css
          forms.css
        + images
              bookmark.png
              configure-field.png
              configure.png
              create.png
              delete.png
              logo.png
              navigation.png
        + installer
              logo.png
              main.css
              main.js
          legacy.css
          login.css
          navigation.xml
          tables.css
    + content
          content.ajaxreorder.php
          content.blueprintscomponents.php
          content.blueprintsdatasources.php
          content.blueprintsevents.php
          content.blueprintspages.php
          content.blueprintssections.php
          content.blueprintsutilities.php
          content.login.php
          content.logout.php
          content.publish.php
          content.systemauthors.php
          content.systemextensions.php
          content.systemlog.php
          content.systempreferences.php
      image.php
      index.php
    + lib
        + boot
              bundle.php
              class.object.php
              defines.php
              func.utilities.php
        + core
              class.administration.php
              class.cacheable.php
              class.configuration.php
              class.cookie.php
              class.datetimeobj.php
              class.frontend.php
              class.log.php
              class.symphony.php
        + lang
              lang.en.php
        + toolkit
              class.administrationpage.php
              class.ajaxpage.php
              class.archivezip.php
              class.author.php
              class.authormanager.php
              class.bitterhtml.php
              class.datasource.php
              class.datasourcemanager.php
              class.debugpage.php
              class.entry.php
              class.entrymanager.php
              class.event.php
              class.eventmanager.php
              class.extension.php
              class.extensionmanager.php
              class.field.php
              class.fieldmanager.php
              class.frontendpage.php
              class.gateway.php
              class.general.php
              class.htmlpage.php
              class.image.php
              class.imagefilters.php
              class.lang.php
              class.manager.php
              class.mutex.php
              class.mysql.php
              class.page.php
              class.parsexml.php
              class.profilepage.php
              class.profiler.php
              class.section.php
              class.sectionmanager.php
              class.textformatter.php
              class.textformattermanager.php
              class.widget.php
              class.xmldoc.php
              class.xmlelement.php
              class.xsltpage.php
              class.xsltprocess.php
            + data-sources
                  datasource.author.php
                  datasource.dynamic_xml.php
                  datasource.navigation.php
                  datasource.section.php
            + events
                  event.section.php
            + fields
                  field.author.php
                  field.checkbox.php
                  field.date.php
                  field.input.php
                  field.select.php
                  field.taglist.php
                  field.textarea.php
                  field.upload.php
              include.install.php
              util.validators.php
    + template
          datasource.tpl
          event.tpl
          tpl.database-error.php
          tpl.error.php
          tpl.xslt-error.php
+ workspace
    + css
          maintenance.css
          styles.css
    + data-sources
          data.archive.php
          data.article_image.php
          data.articles.php
          data.comments.php
          data.drafts.php
          data.homepage_article.php
          data.navigation.php
          data.notes.php
          data.rss_articles.php
          data.website_owner.php
    + events
          event.login.php
          event.publish_article.php
          event.save_comment.php
          event.save_message.php
    + images
          background.gif
          border.gif
          button.gif
          comment-authorized.gif
          grid.gif
          grid-test.gif
          hr.gif
          paper.jpg
          ribbon.gif
          spectrum.gif
    + pages
          404-page-not-found.xsl
          about.xsl
          archive.xsl
          articles.xsl
          drafts.xsl
          home.xsl
          maintenance.xsl
          rss.xsl
    + utilities
          date-time.xsl
          get-archive.xsl
          get-article.xsl
          get-comments.xsl
          get-drafts.xsl
          get-images.xsl
          get-notes.xsl
          master.xsl
          navigation.xsl
          page-title.xsl    </pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>12</wp:post_id>
<wp:post_date>2008-06-30 18:00:51</wp:post_date>
<wp:post_date_gmt>2008-07-01 01:00:51</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>understanding-symphonys-file-structure</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1230569306</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Getting Started with ActionScript 3.0</title>
<link>http://bauhouse.wordpress.com/2008/07/06/getting-started-with-actionscript-30/</link>
<pubDate>Sun, 06 Jul 2008 18:56:31 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=14</guid>
<description></description>
<content:encoded><![CDATA[<p>A good place to begin is at the beginning. Adobe's <a href="http://www.adobe.com/devnet/actionscript/articles/actionscript3_overview.html">ActionScript 3.0 Overview</a> provides a good starting point, describing how ActionScript has developed, what has changed, where to go from here.</p>

<p>For my purposes, that is, learning ActionScript 3.0, to develop my understanding of object oriented programming and to become more familiar with an ECMAScript-based language, which I can later extend to JavaScript for working with AJAX and DOM Scripting, all I need is a text editor and the open source Flex SDK.</p>

<p>I picked up a copy of Colin Moock's <em>Essential ActionScript 3.0</em> and have completed a broad overview of object oriented programming in the context of the ActionScript 3.0 language. Now, I would like to go a little deeper into developing a basic interface for working with these concepts. The new view-based search engine, <a href="http://www.viewzi.com/">Viewzi</a>, demonstrates creative uses for using Flash to aggregate data from various sources into engaging interfaces, allowing search to become much more than a wall of text with links to information of often dubious relevance. One of the most interesting interfaces for me is the <a href="http://www.viewzi.com/search/therecordstore/">Album View</a>. I'd like to find out how to create a gallery of images, such as this, that uses a liquid layout which can reconfigure itself when the browser window is resized or when the image sizes are scaled.</p>

<h3>Where to Start</h3>

<p>I will need references beyond Colin Moock's introduction to the concepts needed to program in ActionScript. Adobe is the first logical source for more information.</p>

<ul>
<li><a href="http://www.adobe.com/devnet/actionscript/articles/actionscript3_overview.html">ActionScript 3.0 Overview</a></li>
<li><a href="//www.adobe.com/go/programmingAS3">Programming ActionScript 3.0</a></li>
<li><a href="http://www.adobe.com/go/AS3LR">ActionScript 3.0 Language Reference</a></li>
<li><a href="http://www.adobe.com/devnet/actionscript/articles/actionscript_tips.html">Tips for Learning ActionScript 3.0</a></li>
<li><a href="http://www.adobe.com/devnet/actionscript/articles/ora_learning_as3.html">Learning ActionScript 3.0 excerpts: OOP overview, display list, and programmatic motion</a></li>
</ul>

<p>For more specific information, I'll see if Google can help me out. I'll need some good resources on liquid layouts, easing in animation, and sliders.</p>

<ul>
<li><a href="http://www.adobe.com/devnet/flash/articles/liquid_gui.html">Creating liquid GUIs with Flash and ActionScript 3.0</a></li>
<li><a href="http://www.soundstep.com/blog/2008/06/23/flash-liquid-layout-with-baseui-version-2/">Flash Liquid Layout with BaseUI version 2</a></li>
<li><a href="http://www.blog.noponies.com/archives/53">ActionScript 3 Liquid Layout Manager</a></li>
<li><a href="http://www.adobe.com/devnet/flash/articles/creating_animation_as3.html">Creating animation in ActionScript 3.0</a></li>
</ul>

<h4>Other Resources</h4>
<ul>
<li><a href="http://senocular.com/">senocular.com</a></li>
<li><a href="http://actionscript.com/">actionscript.com</a></li>
<li><a href="http://actionscript.org/">actionscript.org</a></li>
</ul>

<h3>Good Examples of Liquid Layouts</h3>

<p>I am particularly inspired by these examples of liquid, full screen layouts:</p>

<ul>
<li><a href="http://burnkit.com/">Burnkit</a></li>
<li><a href="http://www.firstbornmultimedia.com/">Firstborn</a></li>
<li><a href="http://www.fromscratch.us/">From Scratch</a></li>
<li><a href="http://trollback.com/">Trollback</a></li>
<li><a href="http://yugop.com/">Yugop</a></li>
<li><a href="http://yugop.com/ver2/">The original Yugop</a></li>
</ul>

<h3>Model View Controller (MVC) Design Patterns</h3>

<ul>
<li><a href="http://www.adobe.com/devnet/flash/articles/mv_controller.html">The Model-View-Controller Design Pattern</a> &mdash; Colin Moock</li>
<li><a href="http://www.as3dp.com/2007/12/27/minimalist-mvc-example-using-the-puremvc-framework/">Minimalist MVC example using the PureMVC Framework</a></li>
<li><a href="http://www.adobe.com/devnet/actionscript/articles/ora_as3_design_patterns.html">ActionScript 3.0 Design Patterns</a></li>
<li><a href="http://tyleralanlarson.com/blog/2008/04/actionscript-101-and-simple-mvc.html">ActionScript 101 and simple MVC</a></li>
</ul>

<h3>ActionScript Frameworks</h3>

<ul>
<li><a href="http://puremvc.org/">PureMVC</a></li>
<li><a href="http://labs.adobe.com/wiki/index.php/Cairngorm">Cairngorm</a></li>
<li><a href="http://asaplibrary.org/">ASAP Library for Flash ActionScript 3.0</a></li>
<li><a href="http://jumpshipframework.blogspot.com/">JumpShip MVC Framework</a></li>
</ul>

<h3>ActionScript Applications</h3>

<ul>
<li><a href="http://blog.papervision3d.org/">Papervision3D</a></li>
<li><a href="http://www.fotoviewr.com/">FotoViewr</a></li>
<li><a href="http://www.viewzi.com/">Viewzi</a></li>
</ul>

]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>14</wp:post_id>
<wp:post_date>2008-07-06 11:56:31</wp:post_date>
<wp:post_date_gmt>2008-07-06 18:56:31</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>getting-started-with-actionscript-30</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1216879338</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>4</wp:comment_id>
<wp:comment_author><![CDATA[ActionScript 3.0 Image Galleries &laquo; Bauhouse]]></wp:comment_author>
<wp:comment_author_email></wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/2008/07/12/actionscript-30-image-galleries/</wp:comment_author_url>
<wp:comment_author_IP>66.135.48.187</wp:comment_author_IP>
<wp:comment_date>2008-07-12 22:00:46</wp:comment_date>
<wp:comment_date_gmt>2008-07-13 05:00:46</wp:comment_date_gmt>
<wp:comment_content><![CDATA[[...] Getting Started with ActionScript&nbsp;3.0  [...] ]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type>pingback</wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>29</wp:comment_id>
<wp:comment_author><![CDATA[Bookmarks about Actionscript]]></wp:comment_author>
<wp:comment_author_email></wp:comment_author_email>
<wp:comment_author_url>http://www.remmrit.com/actionscript</wp:comment_author_url>
<wp:comment_author_IP>67.228.47.154</wp:comment_author_IP>
<wp:comment_date>2008-08-05 01:00:08</wp:comment_date>
<wp:comment_date_gmt>2008-08-05 08:00:08</wp:comment_date_gmt>
<wp:comment_content><![CDATA[[...] - bookmarked by 2 members originally found by simohome on 2008-07-19  Getting Started with ActionScript 3.0  http://bauhouse.wordpress.com/2008/07/06/getting-started-with-actionscript-30/ - bookmarked by 3 [...] ]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type>pingback</wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>28</wp:comment_id>
<wp:comment_author><![CDATA[feaskefeavesy]]></wp:comment_author>
<wp:comment_author_email>sweet0608@ua.fm</wp:comment_author_email>
<wp:comment_author_url>http://www.imeem.com/people/UrLHU6j</wp:comment_author_url>
<wp:comment_author_IP>189.60.214.185</wp:comment_author_IP>
<wp:comment_date>2008-08-02 19:02:28</wp:comment_date>
<wp:comment_date_gmt>2008-08-03 02:02:28</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks !]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>ActionScript 3.0 Image Galleries</title>
<link>http://bauhouse.wordpress.com/2008/07/12/actionscript-30-image-galleries/</link>
<pubDate>Sun, 13 Jul 2008 05:00:37 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=16</guid>
<description></description>
<content:encoded><![CDATA[<p>While Colin Moock's <em>Essential ActionScript 3.0</em> provides a great foundation for understanding how ActionScript works, I find myself straying from the book to find solutions to common problems, such as how to build an image gallery. As I <a href="http://bauhouse.wordpress.com/2008/07/06/getting-started-with-actionscript-30/">mentioned before</a>, I was looking at developing an interface similar to the <a href="http://www.viewzi.com/search/therecordstore/">Album View</a> used by Viewzi. Here's what I've come up with so far:</p>

<h3>The Box Class</h3>

<p>First, I started by creating a <code>Box</code> class that I could use to build frames for the images. It's pretty basic, providing parameters for width, height and color.</p>

<pre><code>package {
	import flash.display.Shape;
	
	public class Box extends Shape {
		public function Box (w:Number,
                             h:Number,
                             fillColor:uint):void {
			graphics.beginFill(fillColor, 1);
			graphics.drawRect(0, 0, w, h);
		}
	}
}</code></pre>

<h3>The ImageFrame Class</h3>

<p>Next, I created a class that creates an image frame with two instances of the <code>Box</code> class, one for the image placeholder, with parameters for width, height, color and margin, and one for the image frame, with parameters for color and padding.</p>

<pre><code>package {
	import flash.display.*;
	
	public class ImageFrame extends Sprite {
		public function ImageFrame (imageWidth:uint, imageHeight:uint, imageColor:uint, frameColor:uint, padding:uint):void {
			var imageFrame:Sprite = new Sprite();

			// Create image placeholder
			var imageWidth:uint;
			var imageHeight:uint;
			var imageColor:uint;
			var image:Box = new Box(imageWidth, imageHeight, imageColor);

			// Create frame
			var padding:uint;
			var frameWidth:uint = imageWidth + (padding * 2);
			var frameHeight:uint = imageHeight + (padding * 2);
			var frameColor:uint = 0xFFFFFF;
			var frame:Box = new Box(frameWidth, frameHeight, frameColor);
			
			// Add frame and image to container
			imageFrame.addChild(frame);
			imageFrame.addChild(image);
			
			// Center image in frame
			image.x = padding;
			image.y = padding;
			
			// Add imageFrame
			addChild(imageFrame);
		}
	}
}</code></pre>

<h3>Floating Grid</h3>

<p>These two classes then provided the basic building blocks to experiment with gallery configurations. The first attempt produced a grid of images that could be centered on the stage with a Tween effect added. To access the <code>fl.transitions</code> library, I copied the directory from the Flash CS3 ActionScript 3.0 classes built into the application. I found them here:</p>

<pre><code>/Applications/Adobe Flash CS3/Configuration/ActionScript 3.0/Classes/fl/</code></pre>

<p>I copied the classes into my development directory:</p>

<pre><code>~/flex/data/interface/fl/</code></pre>

<p>That way, I could access these classes using the Flex 3 SDK by importing the classes:</p>

<pre><code>
	import fl.transitions.*;
	import fl.transitions.easing.*;</code></pre>

<p>To compile SWF files, I use this command in Terminal:</p>

<pre><code>flex/bin/mxmlc flex/data/interface/FloatingGrid.as</code></pre>

<p>I ran into some interesting problems created by attempting to add transitions to a scale effect on the mouse over state of each of the image frames. The Tween class appears to override the variables set to position the image frames in the container sprite. I may be able to solve the problem by setting a different registration point, something which doesn't appear to exist in pure ActionScript 3.0 code, but can be created dynamically with a class such as the <a href="http://www.oscartrelles.com/archives/dynamic_movieclip_registration_with_as3">Dynamic MovieClip Registration</a> class adapted by Oscar Trelles. At any rate, here's what I came up with:</p>

<pre><code>package {
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
	import fl.transitions.*;
	import fl.transitions.easing.*;
	
	public class FloatingGrid extends Sprite {
		// Instantiate stage variables
		public var sw:Number = stage.stageWidth;
		public var sh:Number = stage.stageHeight;
		public var bg:Shape = new Shape();

		// Instantiate container variables
		public var container:MovieClip = new MovieClip();
		public var containerX:Number;
		public var containerY:Number;
		public var containerWidth:Number;
		public var containerHeight:Number;

		// Instantiate image parameters
		public var imageNumber:uint = 36;
		public var imageWidth:uint = 40;
		public var imageHeight:uint = 40;
		public var margin:uint = 25;
		public var padding:uint = 4;
		public var imageColor:uint = 0x999999;
		public var frameColor:uint = 0xFFFFFF;
		
		// Set size on mouse over
		public var overScale:Number = 1.5;

		public function FloatingGrid () {
			// Turn scaling off and set alignment to top left
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			// Add a background color
			bg.graphics.beginFill(0x666666, 1);
			bg.graphics.drawRect(0,0,sw,sh);
			addChild(bg);
			
			// Add image frames to stage with the following parameters:
			// (number, width, height, margin, padding)
			imageFrames(imageNumber, imageWidth, imageHeight, imageColor, frameColor, margin, padding);

			// Register event listener for stage resizing
			stage.addEventListener(Event.RESIZE, resizeListener);

			// Register event listener for mouse over effects
			container.addEventListener(MouseEvent.MOUSE_OVER, over);
			container.addEventListener(MouseEvent.MOUSE_OUT, out);

			// apply tween
			var myTween:Tween = new Tween(container, "x", Elastic.easeOut, 0, containerX, 3, true);

		}

		private function resizeListener (e:Event):void {
			// Instantiate variables for current container position
			var initContainerX:Number = container.x;
			var initContainerY:Number = container.y;
			
			// Determine stage width and height
			sw = stage.stageWidth;
			sh = stage.stageHeight;
			
			// Set background to width and height of stage
			bg.width = sw;
			bg.height = sh;
			
			// Center the container on the Stage
			containerX = (sw / 2) - (containerWidth / 2);
			containerY = (sh / 2) - (containerHeight / 2);
			container.x = containerX;
			container.y = containerY;
			
			var containerTweenX:Tween = new Tween(container, "x", Elastic.easeOut, initContainerX, containerX, 3, true);
			var containerTweenY:Tween = new Tween(container, "y", Elastic.easeOut, initContainerY, containerY, 3, true);
		}

		private function over (e:MouseEvent):void {
			
			DisplayObject(e.target).scaleX = overScale;
			DisplayObject(e.target).scaleY = overScale;

			DisplayObject(e.target).x -= (imageWidth * (overScale - 1)) / 2;
			DisplayObject(e.target).y -= (imageHeight * (overScale - 1)) / 2;

			// var imageFreeTweenScaleX:Tween = new Tween(DisplayObject(e.target), "scaleX", Elastic.easeOut, 1, overScale, .5, true);
			// var imageFreeTweenScaleY:Tween = new Tween(DisplayObject(e.target), "scaleY", Elastic.easeOut, 1, overScale, .5, true);
			
			// var imageFreeTweenX:Tween = new Tween(DisplayObject(e.target), "x", Elastic.easeOut, 1, overScale, .5, true);
			// var imageFreeTweenY:Tween = new Tween(DisplayObject(e.target), "y", Elastic.easeOut, 1, overScale, .5, true);

		}

		private function out (e:MouseEvent):void {
			DisplayObject(e.target).scaleX = 1;
			DisplayObject(e.target).scaleY = 1;

			DisplayObject(e.target).x += (imageWidth * (overScale - 1)) / 2;
			DisplayObject(e.target).y += (imageHeight * (overScale - 1)) / 2;
		}

		private function imageFrames (
				imageNumber:uint,
				imageWidth:uint, 
				imageHeight:uint,
				imageColor:uint,
				frameColor:uint, 
				margin:uint, 
				padding:uint):void {
			// Instantiate image parameters
			var imageCount:uint = imageNumber;
			var imageX:int;
			var imageY:int;
			var imageOffset:Number = imageWidth + (padding * 2) + margin;
			var imageFrames:Array = new Array();

			// Calculate the columns and rows of images
			var columns:uint = Math.floor(sw / imageOffset);
			var rows:uint = Math.ceil(imageNumber / columns);

			// Number of images per row
			var imagesPerRow:uint = columns;
			
			// Calculate the width and height of the container
			containerWidth = columns * imageOffset - margin;
			containerHeight = rows * imageOffset - margin;
			
			// Create the container for the images
			addChild(container);
			
			// Center the container on the Stage
			containerX = (sw / 2) - (containerWidth / 2);
			containerY = (sh / 2) - (containerHeight / 2);
			container.x = containerX;
			container.y = containerY;
			
			// Add image frames to the container
			for (var row:int = 0; row &lt; rows; row++) {
				imageX = 0;
				imageY = row * imageOffset;

				// Determine number of images for last row
				if (imageCount &lt; imagesPerRow) {
					imagesPerRow = imageCount;
				}
				
				for (var i:int = 0; i &lt; imagesPerRow; i++) {
					imageFrames[i] = new ImageFrame(imageWidth, imageHeight, imageColor, frameColor, padding);
					
					// Add images for the current row
					imageFrames[i].x = imageX + (i * imageOffset);
					imageFrames[i].y = imageY;
					container.addChild(imageFrames[i]);

					// Decrement images left to display
					imageCount--;
				}
			}
		}
	}
}</code></pre>

<h3>Gallery Slider</h3>

<p>I never did find exactly what I was looking for in a gallery slider, although there are lots of examples out there. However, once I figured out that I shouldn't be using a <code>MouseEvent</code> listener, but rather an <code>Event.ENTER_FRAME</code> listener and using the <code>DisplayObject.mouseX</code> variable, it all fell into place. By using some simple math, I could change the rate of acceleration based on how close the mouse position was to the left or right edges of the stage.</p>

<pre>package {
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
	import fl.transitions.*;
	import fl.transitions.easing.*;
	
	public class GallerySlider extends Sprite {
		// Instantiate stage variables
		public var sw:Number = stage.stageWidth;
		public var sh:Number = stage.stageHeight;
		public var bg:Shape = new Shape();

		// Instantiate container variables
		public var container:MovieClip = new MovieClip();
		public var containerX:Number;
		public var containerY:Number;
		public var containerWidth:Number;
		public var containerHeight:Number;

		// Instantiate image parameters
		public var imageNumber:uint = 40;
		public var imageWidth:uint = 100;
		public var imageHeight:uint = 60;
		public var margin:uint = 25;
		public var padding:uint = 4;
		public var imageColor:uint = 0x999999;
		public var frameColor:uint = 0xFFFFFF;
		
		// Set size on mouse over
		public var overScale:Number = 1.25;

		public function GallerySlider () {
			// Turn scaling off and set alignment to top left
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			// Add a background color
			bg.graphics.beginFill(0x666666, 1);
			bg.graphics.drawRect(0,0,sw,sh);
			addChild(bg);
			
			// Add image frames to stage with the following parameters:
			// (number, width, height, margin, padding)
			imageFrames(imageNumber, imageWidth, imageHeight, imageColor, frameColor, margin, padding);

			// Register event listener for stage resizing
			stage.addEventListener(Event.RESIZE, resizeListener);

			// Register event listener for mouse position
			stage.addEventListener(Event.ENTER_FRAME, mousePositionListener);

			// Register event listener for mouse over effects
			container.addEventListener(MouseEvent.MOUSE_OVER, over);
			container.addEventListener(MouseEvent.MOUSE_OUT, out);

			// apply tween
			var myTween:Tween = new Tween(container, "x", Elastic.easeOut, 0, containerX, 3, true);

		}

		private function resizeListener (e:Event):void {
			// Instantiate variables for current container position
			var initContainerX:Number = container.x;
			var initContainerY:Number = container.y;
			
			// Determine stage width and height
			sw = stage.stageWidth;
			sh = stage.stageHeight;
			
			// Set background to width and height of stage
			bg.width = sw;
			bg.height = sh;
			
			// Center the container on the Stage
			containerX = (sw / 2) - (containerWidth / 2);
			containerY = (sh / 2) - (containerHeight / 2);
			container.x = containerX;
			container.y = containerY;
			
			var containerTweenX:Tween = new Tween(container, "x", Elastic.easeOut, initContainerX, containerX, 3, true);
		}

		private function mousePositionListener (e:Event):void {
			var stageCenter:Number = sw / 2;
			var quietZone:uint = 50;
			var stageLeft:Number = stageCenter - quietZone;
			var stageRight:Number = stageCenter + quietZone;
			var maxOffsetX:Number = stageCenter - imageWidth;

			// Move gallery left or right depending on mouse position
			// Movement accelerates as mouse gets close to left or right edges of the stage
			// A maximum offset value prevents the gallery from moving off the stage
			if (stage.mouseX &lt; stageLeft &amp;&amp; container.x  stageRight &amp;&amp; (containerWidth + container.x &gt; sw - maxOffsetX)) {
				container.x -= (stage.mouseX - stageRight) / 10;
			}
		}

		private function over (e:MouseEvent):void {
			
			DisplayObject(e.target).scaleX = overScale;
			DisplayObject(e.target).scaleY = overScale;

			DisplayObject(e.target).x -= (imageWidth * (overScale - 1)) / 2;
			DisplayObject(e.target).y -= (imageHeight * (overScale - 1)) / 2;

			// var imageFreeTweenScaleX:Tween = new Tween(DisplayObject(e.target), "scaleX", Elastic.easeOut, 1, overScale, .5, true);
			// var imageFreeTweenScaleY:Tween = new Tween(DisplayObject(e.target), "scaleY", Elastic.easeOut, 1, overScale, .5, true);
			
			// var imageFreeTweenX:Tween = new Tween(DisplayObject(e.target), "x", Elastic.easeOut, 1, overScale, .5, true);
			// var imageFreeTweenY:Tween = new Tween(DisplayObject(e.target), "y", Elastic.easeOut, 1, overScale, .5, true);

		}

		private function out (e:MouseEvent):void {
			DisplayObject(e.target).scaleX = 1;
			DisplayObject(e.target).scaleY = 1;

			DisplayObject(e.target).x += (imageWidth * (overScale - 1)) / 2;
			DisplayObject(e.target).y += (imageHeight * (overScale - 1)) / 2;
		}

		private function imageFrames (imageNumber:uint,
		                              imageWidth:uint, 
		                              imageHeight:uint,
		                              imageColor:uint,
		                              frameColor:uint, 
		                              margin:uint, 
		                              padding:uint):void {
			// Instantiate image parameters
			var imageX:int;
			var imageY:int;
			var imageOffset:Number = imageWidth + (padding * 2) + margin;
			var imageFrames:Array = new Array();

			// Calculate the width and height of the container
			containerWidth = imageNumber * imageOffset - margin;
			containerHeight = imageHeight;

			// Create the container for the images
			addChild(container);
			
			// Center the container on the Stage
			containerX = (sw / 2) - (containerWidth / 2);
			containerY = (sh / 2) - (containerHeight / 2);
			container.x = containerX;
			container.y = containerY;
			
			// Add image frames to the container
			for (var i:int = 0; i &lt; imageNumber; i++) {
				imageFrames[i] = new ImageFrame(imageWidth, imageHeight, imageColor, frameColor, padding);
				
				// Add images for the current row
				imageFrames[i].x = imageX + (i * imageOffset);
				imageFrames[i].y = imageY;
				container.addChild(imageFrames[i]);
			}
		}
	}
}</pre>

<p><strong>Note:</strong> I updated the code by adding a maximum offset value to prevent the gallery from moving off the stage.</p>

<h3>ActionScript 3.0 Galleries</h3>

<p>There are some code examples available that I've been able to find so far:</p>

<ul>
<li><a href="http://www.blog.noponies.com/archives/65">ActionScript 3 Full Browser XML Slideshow</a></li>
<li><a href="http://www.blog.noponies.com/archives/89">Simple ActionScript 3 Slideshow Engine</a></li>
<li><a href="http://www.blog.noponies.com/archives/61">ActionScript 3 Drag, Pan, Zoom XML Content</a></li>
<li><a href="http://www.f-90.co.uk/blog/?p=7">Array based perpetual scrolling navigation AS3</a></li>
</ul>

<h3>Flash Galleries</h3>

<ul>
<li><a href="http://www.graphictherapy.com/index2.html">GraphicTherapy</a></li>
<li><a href="http://www.noponies.com/dev/simplegallery/">ActionScript 3 Simple Gallery</a></li>
<li><a href="http://www.noponies.com/dev/as3_xslideshow/">Simple ActionScript 3 SlideShow</a></li>
<li><a href="http://www.noponies.com/dev/as3_slideimages/">ActionScript 3 Sliding Images XML Gallery</a></li>
<li><a href="http://www.thereformation.co.nz/">The Reformation</a></li>
<li><a href="http://www.noponies.com/dev/as3_pan_zoom/">ActionScript 3 Pan Zoom Drag Content</a></li>
<li><a href="http://erikalmas.com/">Erik Almas Photography</a></li>
<li><a href="http://joelhooks.com/2008/05/11/continuous-scrolling-image-thumbnail-and-slideshow-component-for-flex/">Continuous Scrolling Thumbnail Slideshow</a></li>
<li><a href="http://2210media.com/xmlGallery/">XMLGallery</a></li>
</ul>

]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>16</wp:post_id>
<wp:post_date>2008-07-12 22:00:37</wp:post_date>
<wp:post_date_gmt>2008-07-13 05:00:37</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-30-image-galleries</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1218599647</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>5</wp:comment_id>
<wp:comment_author><![CDATA[Joel Hooks]]></wp:comment_author>
<wp:comment_author_email>imlowdown@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>75.20.175.144</wp:comment_author_IP>
<wp:comment_date>2008-07-13 00:02:35</wp:comment_date>
<wp:comment_date_gmt>2008-07-13 07:02:35</wp:comment_date_gmt>
<wp:comment_content><![CDATA[I'm looking forward to giving your code a thorough study. Thanks for sharing your research. I'm 100% happy with my solution, though it does work for our purpose.

http://joelhooks.com/session

u/p:demo_client

Here it is in the actual application.

Cheers,

Joel]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>7</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>70.69.162.138</wp:comment_author_IP>
<wp:comment_date>2008-07-13 06:57:16</wp:comment_date>
<wp:comment_date_gmt>2008-07-13 13:57:16</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks for the demo of your application. That looks very promising. And the photography is beautiful. I'm especially intrigued by what appears to be a work in progress: the Wall Designer. Nice work.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>11</wp:comment_id>
<wp:comment_author><![CDATA[noponies]]></wp:comment_author>
<wp:comment_author_email>work@noponies.com</wp:comment_author_email>
<wp:comment_author_url>http://www.blog.noponies.com</wp:comment_author_url>
<wp:comment_author_IP>202.27.211.110</wp:comment_author_IP>
<wp:comment_date>2008-07-15 17:04:37</wp:comment_date>
<wp:comment_date_gmt>2008-07-16 00:04:37</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Hi,

Nice example you are working through here!]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>14</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>70.69.140.3</wp:comment_author_IP>
<wp:comment_date>2008-07-17 08:57:39</wp:comment_date>
<wp:comment_date_gmt>2008-07-17 15:57:39</wp:comment_date_gmt>
<wp:comment_content><![CDATA[@noponies, thanks. I'm merely documenting my climb up the learning curve. I've been inspired by your code examples, and hope to incorporate your <a href="http://www.blog.noponies.com/" rel="nofollow">ActionScript 3 FullScreen Object Resize Class</a> at some point.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>30</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>70.69.162.138</wp:comment_author_IP>
<wp:comment_date>2008-08-09 08:21:34</wp:comment_date>
<wp:comment_date_gmt>2008-08-09 15:21:34</wp:comment_date_gmt>
<wp:comment_content><![CDATA[@cliffzim, that might not be a trivial question. I didn't know that I didn't have to declare the function parameters as variables within the function. The reason for doing this might be plain ignorance on my part.

The simple answer would be that this is legacy code from when I had first created the ImageFrame class. I was using the class on its own to create a single image frame, declaring instance variables for each of the characteristics of the object. Then, I decided to control the characteristics of multiple ImageFrame objects by passing the values as method arguments, which I defined as variables declared in the classes that invoked the method.

I hadn't realized that the instance variables of the ImageFrame class that are set by method parameters are now redundant and can be removed (<code>imageWidth, imageHeight, imageColor, frameColor, padding</code>). Thanks for pointing that out.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>27</wp:comment_id>
<wp:comment_author><![CDATA[cliffzim]]></wp:comment_author>
<wp:comment_author_email>cliff@cliffzimmerman.us</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>75.177.145.180</wp:comment_author_IP>
<wp:comment_date>2008-08-01 11:10:55</wp:comment_date>
<wp:comment_date_gmt>2008-08-01 18:10:55</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Please excuse what might be a trivial question, but in the ImageFrame class the function parameters are redefined in the body of the function as variables.  What's the reason for doing that??  I would have thought that the compiler would have choked on that, but it appears to make no difference whether those vars are commented out or not.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>46</wp:comment_id>
<wp:comment_author><![CDATA[Paul Sparks]]></wp:comment_author>
<wp:comment_author_email>paul@sparkyoursoul.com</wp:comment_author_email>
<wp:comment_author_url>http://www.sparkyoursoul.com</wp:comment_author_url>
<wp:comment_author_IP>76.90.123.203</wp:comment_author_IP>
<wp:comment_date>2008-11-21 12:45:36</wp:comment_date>
<wp:comment_date_gmt>2008-11-21 19:45:36</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Hey, 
  I'm actually trying to put all of your script together and make a gallery. How do you go about actually executing the script? 
I'm using Flash CS3.

When I execute the FloatingGrid.as, I just get a white blank SWF.
   Secondly, how would you suggest I go about loading images from an array into the grid? (or better yet, getting data from an XML file, and then converting that to an array).?

Thanks for sharing your code!! I'd love to get this working!]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>48</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>216.232.127.58</wp:comment_author_IP>
<wp:comment_date>2008-11-24 08:40:22</wp:comment_date>
<wp:comment_date_gmt>2008-11-24 15:40:22</wp:comment_date_gmt>
<wp:comment_content><![CDATA[To compile the script, you'll notice that I was using the Flex 3 SDK. Using Flash CS3, you'll likely need to add a document class to your FLA file. Consult the documentation if you need some assistance with this.

I haven't quite reached that point in my development to load data from an XML file, load photos and populate the grid with images. That would be next, of course, but I haven't found the time lately. (And I wouldn't hold my breath.)]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>Flex 3 CSS Properties List</title>
<link>http://bauhouse.wordpress.com/2008/07/13/flex-3-css-properties-list/</link>
<pubDate>Sun, 13 Jul 2008 14:32:20 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

		<category><![CDATA[CSS]]></category>

		<category domain="category" nicename="css-technology"><![CDATA[CSS]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=17</guid>
<description></description>
<content:encoded><![CDATA[<p>I'm a big fan of web standards, but not to the point that I believe that XHTML/CSS and ActionScript are mutually exclusive. JavaScript had fallen out of favour for a while, but it reincarnated itself as AJAX and Unobtrusive JavaScript. Adobe has set a new standard for an open source object oriented scripting language, ActionScript with the release of the Flex 3 SDK. I'm interested to see how Flex can be integrated with CSS. The <a href="http://www.loscavio.com/downloads/blog/flex3_css_list/flex3_css_list.htm">Flex 3 CSS Properties List</a> may be a good place to start.</p>

<p>Using <a href="http://symphony21.com/">Symphony</a> as a platform for XML and XSLT based applications, I'd like to experiment with importing XML data with ActionScript to create galleries, to chart data and to develop other applications that can enhance the user experience beyond the confines of the W3C recommendations. I like organizations that help us push the boundaries of what is possible by developing open standards. A good dose of healthy competition in the area of standards may be what is necessary to overcome a lack of direction and movement in further developing existing standards. As a designer, I depend on Adobe PostScript, OpenType Collection and Creative Suite. I welcome Adobe's entrance into the arena of open source software development.</p>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>17</wp:post_id>
<wp:post_date>2008-07-13 07:32:20</wp:post_date>
<wp:post_date_gmt>2008-07-13 14:32:20</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>flex-3-css-properties-list</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1215962633</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>8</wp:comment_id>
<wp:comment_author><![CDATA[Flex 3 CSS Properties List &laquo; Rich Internet Applications]]></wp:comment_author>
<wp:comment_author_email></wp:comment_author_email>
<wp:comment_author_url>http://flexria.wordpress.com/2008/07/14/flex-3-css-properties-list/</wp:comment_author_url>
<wp:comment_author_IP>72.232.101.88</wp:comment_author_IP>
<wp:comment_date>2008-07-14 04:16:33</wp:comment_date>
<wp:comment_date_gmt>2008-07-14 11:16:33</wp:comment_date_gmt>
<wp:comment_content><![CDATA[[...] Source [...] ]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type>pingback</wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>PureMVC Framework</title>
<link>http://bauhouse.wordpress.com/2008/07/13/puremvc-framework/</link>
<pubDate>Sun, 13 Jul 2008 16:17:00 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

		<category domain="tag"><![CDATA[ActionScript]]></category>

		<category domain="tag" nicename="actionscript"><![CDATA[ActionScript]]></category>

		<category domain="tag"><![CDATA[PureMVC]]></category>

		<category domain="tag" nicename="puremvc"><![CDATA[PureMVC]]></category>

		<category domain="tag"><![CDATA[Framework]]></category>

		<category domain="tag" nicename="framework"><![CDATA[Framework]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=18</guid>
<description></description>
<content:encoded><![CDATA[<p>I had been looking around for more information about frameworks and design patterns, specifically the Model-View-Controller design pattern, as popularized by the Ruby on Rails project. <a href="http://joelhooks.com/2008/03/15/5-reasons-puremvc-kicks-ass/">Joel Hooks</a> has been extolling the virtues of the <a href="http://puremvc.org/">PureMVC framework</a>. Realizing that the framework has being ported to several other languages, with Perl on the list of ports yet to be developed, gives me more reason to investigate. There is currently no Perl implementation of the framework. The <a href="http://forums.puremvc.org/index.php?topic=132.0">Perl port is looking for an owner</a>. I don't think it will be me, a complete noob.</p>

<h3>VEsession Flex Photography Studio Management</h3>

<p>While still in its infancy, Joel Hooks's <a href="http://joelhooks.com/2008/06/">VEsession Photography Studio Management Application</a> looks very promising. It is an <a href="http://code.google.com/p/vesession/">open source project</a> built with Flex using the PureMVC framework.</p>

<h3><a href="http://puremvc.org/content/blogsection/9/176/">PureMVC Applications</a></h3>

<ul>
<li><a href="http://vesession.com/">VEsession</a></li>
<li><a href="http://ws-slideshow.com/">WS-Slideshow</a></li>
<li><a href="http://minitask.betriebsraum.de/">MiniTask</a></li>
<li><a href="http://muchosmedia.com/demos/brainwave/index.cfm">Brainwave</a></li>
<li><a href="http://www.t-mobile.co.uk/shop/business/mobile-phones/price-plans/shared/calculator/">T-Mobile</a></li>
<li><a href="http://actionscriptnotes.com/showcase/fguestbook/Main.html">Flex Guestbook</a></li>
<li><a href="http://actionscriptnotes.com/showcase/macmenu/Main.html">Mac-style Menu</a></li>
<li><a href="http://actionscriptnotes.com/showcase/renju/Main.html">Renju - Logic Game</a></li>
<li><a href="http://actionscriptnotes.com/showcase/slidingpuzzle/Main.html">Sliding Puzzle Game</a></li>
<li><a href="http://www.panfu.de/">Panfu multiuser learning and gaming community for children</a></li>
<li><a href="http://www.moonlighting.co.za/">Moonlighting Film Production Services</a></li>
</ul>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>18</wp:post_id>
<wp:post_date>2008-07-13 09:17:00</wp:post_date>
<wp:post_date_gmt>2008-07-13 16:17:00</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>puremvc-framework</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1215971472</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript 3 Drawing Basics</title>
<link>http://bauhouse.wordpress.com/2008/07/13/actionscript-3-drawing-basics/</link>
<pubDate>Sun, 13 Jul 2008 20:32:07 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=20</guid>
<description></description>
<content:encoded><![CDATA[<p>I wasn't quite sure how to go about drawing a rounded corner rectangle, but a quick search revealed a number of ways to do this. One method involves developing a movie clip method called <a href="http://e-articles.info/e/a/title/How-to-draw-a-rectangle-with-rounded-corners/">drawRectangle</a>, detailing the calculations necessary to draw the circle programatically with ActionScript. <a href="http://www.flasherdot.org/T/03_SquaresRoundedRectangles_AS3.htm">Another method</a> involves using the <code>flash.display.Shape</code> classes available with Flash CS3 and with the Flex 3 SDK. Another example can be found in the <a href="http://books.google.com/books?id=Qlia0Bq-ZmoC&amp;pg=PA188&amp;lpg=PA188&amp;dq=actionscript+3+draw+rounded+corner+rectangle&amp;source=web&amp;ots=RY516f2y4m&amp;sig=w-ZOSpdqGt1y3Ze0ZxUDsRW6-Ac&amp;hl=en&amp;sa=X&amp;oi=book_result&amp;resnum=7&amp;ct=result#PPA188,M1">ActionScript 3.0 Cookbook</a>. For more in-depth information about the classes, consult the <a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html">Adobe Flex 3 Language Reference</a></p>

<h3>Rounded Corner Rectangle</h3>

<p>So the easy part is creating the rounded corner rectangle.</p>

<pre>package {
	import flash.display.*;
	
	public class RoundedRectangle extends Sprite {
		public function RoundedRectangle () {
			var rect:Sprite = new Sprite();

			var rectX:Number = 20;
			var rectY:Number = 20;
			var rectW:Number = 360;
			var rectH:Number = 240;
			var cornerDiameter:Number = 24;
			var rectEllipseW:Number = 120;
			var rectEllipseH:Number = 240;
			var fillColor:uint = 0xFFFFFF;
			var alpha:Number = 1;
			rect.graphics.beginFill(fillColor, alpha);  
			rect.graphics.drawRoundRect(rectX, rectY, rectW, rectH, cornerDiameter);
			rect.graphics.endFill();
			
			addChild(rect);
		}
	}
}</pre>

<p>I used variables to clarify the required parameters. To simplify this code, remove the variables and use literal values for the class method parameters.</p>

<pre>package {
	import flash.display.*;
	
	public class RoundedRectangle extends Sprite {
		public function RoundedRectangle () {
			var rect:Sprite = new Sprite();

			rect.graphics.beginFill(0xFFFFFF, 1);  
			rect.graphics.drawRoundRect(20, 20, 360, 240, 24);
			rect.graphics.endFill();
			
			addChild(rect);
		}
	}
}</pre>

<h3>Gradient Fill</h3>

<p>Gradient fills are little more complex because they require some knowledge of the transformation matrix. Luka Maras offers an in-depth tutorial on <a href="http://www.lukamaras.com/tutorials/actionscript/creating-gradient-fills-with-actionscript.html">creating gradient fills</a>. However, the method used in the Adobe Flex 3 Language Reference uses the <code>matrix.createGradiantBox</code> method, which has this signature:</p>

<pre>public function createGradientBox(width:Number, height:Number, rotation:Number = 0, tx:Number = 0, ty:Number = 0):void</pre>

<p>So the code for a rounded rectangle with a gradient fill from grey to white at 90 degrees goes something like this:</p>

<pre>package {
	import flash.display.*;
	import flash.events.*;
	import flash.geom.*
	
	public class RoundRectGradFill extends Sprite {
		public function RoundRectGradFill () {
			var viewImage:Sprite = new Sprite();

			var fillType:String = GradientType.LINEAR;
			var colors:Array = [0xFFFFFF, 0x999999];
			var alphas:Array = [1, 1];
			var ratios:Array = [0, 255];
			var matrix:Matrix = new Matrix();
			var gradWidth:Number = 360;
			var gradHeight:Number = 240;
			var gradRotation:Number = 90 / 180 * Math.PI; // rotation expressed in radians
			var gradOffsetX:Number = 0;
			var gradOffsetY:Number = 0;
			
			matrix.createGradientBox(gradWidth, gradHeight, gradRotation, gradOffsetX, gradOffsetY);
			var spreadMethod:String = SpreadMethod.PAD;
			viewImage.graphics.beginGradientFill(fillType, colors, alphas, ratios, matrix, spreadMethod);  
			viewImage.graphics.drawRoundRect(0, 0, 360, 240, 36);
			viewImage.graphics.endFill();
			
			addChild(viewImage);
		}
	}
}</pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>20</wp:post_id>
<wp:post_date>2008-07-13 13:32:07</wp:post_date>
<wp:post_date_gmt>2008-07-13 20:32:07</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-3-drawing-basics</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1216048536</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>In Search of ActionScript 3 OpenType Font Embedding Techniques</title>
<link>http://bauhouse.wordpress.com/2008/07/14/in-search-of-actionscript-3-opentype-font-embedding-techniques/</link>
<pubDate>Tue, 15 Jul 2008 06:23:08 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=22</guid>
<description></description>
<content:encoded><![CDATA[<p>I'm disappointed by the lack of OpenType support available in Flex. It appears that it is necessary to jump through some hoops to embed OpenType fonts with ActionScript 3. <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_04.html">The documented method</a> requires using Flex MXML. <a href="http://chalk-it-out.com/blog/2008/06/embedding-font-in-flex-3/">Some say it is possible</a>. <a href="http://devblog.projector.se/?p=16">Others say no</a>.</p>

<p>I found some pure <a href="http://www.marcosweskamp.com/blog/archives/000113.html">ActionScript code to embed TrueType fonts</a>, but, according to the comments on <a href="http://mx.coldstorageonline.com/?bid=48">Font Embedding in AS3 : Lessons Learned</a>, it sounds as if this may not work for Macs or with OpenType. <a href="http://www.actionscript.org/forums/showthread.php3?t=165106">Embedding system fonts</a> may be the best way to avoid problems.<p>

<p>There are also some issues that can be avoided by using type embedded via SWF instead of OpenType, according to Katy Richard's <a href="http://thingsthatwork.net/index.php/2008/04/15/flex-and-fonts/">Flex and Fonts</a> post on Things that Work.</p>

<p>Well, at least the search came up with a handy little <a href="http://www.mikechambers.com/blog/2008/03/17/actionscript-3-ria-reference-guide/">ActionScript 3 RIA Reference Guide</a> from Mike Chambers, and a nice example of a music sharing site: <a href="http://grooveshark.com/">Grooveshark</a>.</p>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>22</wp:post_id>
<wp:post_date>2008-07-14 23:23:08</wp:post_date>
<wp:post_date_gmt>2008-07-15 06:23:08</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>in-search-of-actionscript-3-opentype-font-embedding-techniques</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1216136417</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Loading Images in ActionScript 3</title>
<link>http://bauhouse.wordpress.com/2008/07/15/embedding-and-loading-images/</link>
<pubDate>Tue, 15 Jul 2008 15:34:07 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=24</guid>
<description></description>
<content:encoded><![CDATA[I took forever to figure out why I was encountering this error when trying to load images and compiling with mxmlc. Consulting the log file (<code>~/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt</code>), I would have this error when trying to view the SWF with the standalone Flash Player:
<pre>SecurityError: Error #2148: SWF file
file:///Users/stephen/flex/data/interface/LoadImage.swf cannot access local resource file:///Users/stephen/flex/data/interface/assets.jpg.
Only local-with-filesystem and trusted local SWF files may access local resources.
	at flash.display::Loader/get content()
	at LoadImage/initListener()</pre>
It turns out the solution is simple if you know where to look. The configuration file needed to be changed for my Flex 3 SDK compiler. The configuration file is loaded from here in my install:
<pre>~/flex/frameworks/flex-config.xml</pre>
I needed to change the <code>use-network</code> setting to a value of false instead of true:
<pre>   &lt;!-- Enables SWFs to access the network. --&gt;
   &lt;use-network&gt;false&lt;/use-network&gt;</pre>
Then I could load my image with no problem.
<pre>package {
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;

	public class LoadImage extends Sprite {
		private var loader:Loader;

		public function LoadImage() {
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.INIT, initListener);
			loader.load(new URLRequest("asset.jpg"));
		}

		private function initListener (e:Event):void {
			addChild(loader.content);
		}
	}
}</pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>24</wp:post_id>
<wp:post_date>2008-07-15 08:34:07</wp:post_date>
<wp:post_date_gmt>2008-07-15 15:34:07</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>embedding-and-loading-images</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232380478</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript Compiler Error - Flex Ant Tasks Bug</title>
<link>http://bauhouse.wordpress.com/2008/07/16/actionscript-compiler-error-flex-ant-tasks-bug/</link>
<pubDate>Wed, 16 Jul 2008 20:28:30 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=25</guid>
<description></description>
<content:encoded><![CDATA[<p>Apparently, there is <a href="http://bugs.adobe.com/jira/browse/SDK-14519">a bug that involves the Flex 3 SDK and Ant using different versions of Xerxes</a>.</p>

<blockquote>Try Ant 1.6.5 

If I run the ant script using Ant 1.7.0, I get the error described here. If I run with Ant 1.6.5, there's no error. 

Given the error message, my guess is that the different versions of Ant bring in different versions of Xerces. Either Xerces broke some backward compatability, or the mxmlc .jar files are using bits of Xerces that aren't part of the published API.</blockquote>

<p>But if that is the case, then my problem must be something else. Running this on the command line gave me the following result:</p>

<pre>ant -version
Apache Ant version 1.6.5 compiled on July 2 2006</pre>

<p>But I appear to be having similar problems when compiling on an Intel iMac at work.</p>

<pre>flex/bin/mxmlc
Loading configuration file /Users/stephen/flex/frameworks/flex-config.xml
Error: class org.apache.xerces.util.XMLAttributesMMImpl$AttributeMMImpl cannot access its superclass org.apache.xerces.util.XMLAttributesImpl$Attribute

java.lang.IllegalAccessError: class org.apache.xerces.util.XMLAttributesMMImpl$AttributeMMImpl cannot access its superclass org.apache.xerces.util.XMLAttributesImpl$Attribute
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerMMImpl.&lt;init&gt;(XMLDocumentFragmentScannerMMImpl.java:105)
        at org.apache.xerces.impl.XMLDocumentScannerMMImpl.&lt;init&gt;(XMLDocumentScannerMMImpl.java:258)
        at org.apache.xerces.impl.XMLNSDocumentScannerMMImpl.&lt;init&gt;(XMLNSDocumentScannerMMImpl.java:120)
        at org.apache.xerces.parsers.IntegratedParserConfigurationMMImpl.createDocumentScanner(IntegratedParserConfigurationMMImpl.java:282)
        at org.apache.xerces.parsers.DTDConfiguration.&lt;init&gt;(Unknown Source)
        at org.apache.xerces.parsers.StandardParserConfiguration.&lt;init&gt;(Unknown Source)
        at org.apache.xerces.parsers.IntegratedParserConfigurationMMImpl.&lt;init&gt;(IntegratedParserConfigurationMMImpl.java:193)
        at org.apache.xerces.parsers.XML11ConfigurationMMImpl.&lt;init&gt;(XML11ConfigurationMMImpl.java:182)
        at org.apache.xerces.parsers.XML11ConfigurationMMImpl.&lt;init&gt;(XML11ConfigurationMMImpl.java:139)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.xerces.parsers.ObjectFactory.newInstance(Unknown Source)
        at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
        at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
        at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.&lt;init&gt;(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.&lt;init&gt;(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.&lt;init&gt;(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.&lt;init&gt;(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
        at flex2.compiler.config.FileConfigurator.load(FileConfigurator.java:113)
        at flex2.tools.Compiler.processConfiguration(Compiler.java:512)
        at flex2.tools.Compiler.processConfiguration(Compiler.java:428)
        at flex2.tools.Compiler.mxmlc(Compiler.java:82)
        at flex2.tools.Compiler.main(Compiler.java:53)
</pre>

<p>The solution was to disable the file that was causing the error by renaming it as a backup file. By running this on the command line, I can now compile using mxmlc.</p>

<pre>mv ~/flex/lib/xercesPatch.jar ~/flex/lib/xercesPatch.jar.bak</pre> ]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>25</wp:post_id>
<wp:post_date>2008-07-16 13:28:30</wp:post_date>
<wp:post_date_gmt>2008-07-16 20:28:30</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-compiler-error-flex-ant-tasks-bug</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1216242331</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>56</wp:comment_id>
<wp:comment_author><![CDATA[Mladen Maravic]]></wp:comment_author>
<wp:comment_author_email>beb4ch@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>194.152.211.51</wp:comment_author_IP>
<wp:comment_date>2008-12-11 01:36:54</wp:comment_date>
<wp:comment_date_gmt>2008-12-11 08:36:54</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Michael, 
you will have no problems! We've had the same issues that bauhouse is talking about and we have been building Flex applications for a while now without the xercesPatch.jar files. The only issue is that when you have an error in some XML file, the mxmlc compiler is not always going to give you a correct line number of the error, but this has not been a big issue for us.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>41</wp:comment_id>
<wp:comment_author><![CDATA[Varun Bhambri]]></wp:comment_author>
<wp:comment_author_email>varunbhambri@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>67.169.0.44</wp:comment_author_IP>
<wp:comment_date>2008-10-28 15:24:46</wp:comment_date>
<wp:comment_date_gmt>2008-10-28 22:24:46</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Hi,

This tip was extremely helpful.

Thanks. :)]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>42</wp:comment_id>
<wp:comment_author><![CDATA[Bustanil]]></wp:comment_author>
<wp:comment_author_email>street.programmer@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>125.160.216.252</wp:comment_author_IP>
<wp:comment_date>2008-11-06 21:12:14</wp:comment_date>
<wp:comment_date_gmt>2008-11-07 04:12:14</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks.. finally my mxmlc task works..]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>51</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>216.232.127.58</wp:comment_author_IP>
<wp:comment_date>2008-11-25 08:51:58</wp:comment_date>
<wp:comment_date_gmt>2008-11-25 15:51:58</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Sorry, Michael. I haven't come across this warning, so I'm not sure what's causing this or whether or not this can be ignored.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>49</wp:comment_id>
<wp:comment_author><![CDATA[Michael Pelz-Sherman]]></wp:comment_author>
<wp:comment_author_email>mpelzsherman@yahoo.com</wp:comment_author_email>
<wp:comment_author_url>http://pelz-sherman.net/blog</wp:comment_author_url>
<wp:comment_author_IP>63.243.103.30</wp:comment_author_IP>
<wp:comment_date>2008-11-24 16:27:26</wp:comment_date>
<wp:comment_date_gmt>2008-11-24 23:27:26</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Yes, thank you very much!

Although now I'm getting this warning:

Warning: Line number support for XML tag attributes is not available. It is possible that compile-time MXML error reporting and component debugging may not give correct line numbers. Please make sure that xercesPatch.jar is in the classpath.

Can I just ignore this?]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>58</wp:comment_id>
<wp:comment_author><![CDATA[Fabrizio Di Bitonto]]></wp:comment_author>
<wp:comment_author_email>fabrizio_dibitonto@it.ibm.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>83.224.133.233</wp:comment_author_IP>
<wp:comment_date>2008-12-20 03:31:34</wp:comment_date>
<wp:comment_date_gmt>2008-12-20 10:31:34</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Michael, the trick does not work on Linux Redhat 5.
In fact, after renaming the file, the error is: 
java.lang.StackOverflowError

I'm running mxmlc Version 3.2.0 build 3958 and IBM SDK 1.6.
Any ideas?]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>111</wp:comment_id>
<wp:comment_author><![CDATA[David L Evans]]></wp:comment_author>
<wp:comment_author_email>dle.evans@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://www.davidevans.googlepages.com/dle</wp:comment_author_url>
<wp:comment_author_IP>141.151.19.156</wp:comment_author_IP>
<wp:comment_date>2009-03-13 06:16:23</wp:comment_date>
<wp:comment_date_gmt>2009-03-13 13:16:23</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks for the help tip, it worked for me with fedora 9/ Ant 1.7.0/ mxmlc 3.3.0]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>126</wp:comment_id>
<wp:comment_author><![CDATA[Anil]]></wp:comment_author>
<wp:comment_author_email>anil.kadimisetty@raritan.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>72.236.162.59</wp:comment_author_IP>
<wp:comment_date>2009-03-26 14:57:48</wp:comment_date>
<wp:comment_date_gmt>2009-03-26 21:57:48</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Hi,
Tahnks was very helpfull..
wasted 3 hours before coming here]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>101</wp:comment_id>
<wp:comment_author><![CDATA[Sébastien Ballesté-Antich]]></wp:comment_author>
<wp:comment_author_email>sebastien.balleste-antich@pearltrees.com</wp:comment_author_email>
<wp:comment_author_url>http://www.pearltrees.com/seb/map/1_14875/</wp:comment_author_url>
<wp:comment_author_IP>62.100.131.138</wp:comment_author_IP>
<wp:comment_date>2009-03-06 08:51:55</wp:comment_date>
<wp:comment_date_gmt>2009-03-06 15:51:55</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks, worked for me with debian lenny / Ant 1.7.0 / mxmlc  3.3.0]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>129</wp:comment_id>
<wp:comment_author><![CDATA[Bogdan Nechyporenko]]></wp:comment_author>
<wp:comment_author_email>bogdannechiporenko@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://www.weblancer.net/users/acierto/</wp:comment_author_url>
<wp:comment_author_IP>93.72.138.44</wp:comment_author_IP>
<wp:comment_date>2009-04-12 11:51:27</wp:comment_date>
<wp:comment_date_gmt>2009-04-12 18:51:27</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Ye, this method is helpful for avoid this problem.
But when I did it, the code hasn't been compiled fully.
If you want, that this code will compile and work correctly you should evidently consider xercerImpl in your Ant classpath.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>130</wp:comment_id>
<wp:comment_author><![CDATA[Barry]]></wp:comment_author>
<wp:comment_author_email>gasdl@asodij.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>195.212.29.67</wp:comment_author_IP>
<wp:comment_date>2009-04-21 05:26:50</wp:comment_date>
<wp:comment_date_gmt>2009-04-21 12:26:50</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks! Came across the same bug with different software, you saved me a lot of hassle!]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>Apply a Mask and Add a Title with ActionScript</title>
<link>http://bauhouse.wordpress.com/2008/07/22/apply-a-mask-and-add-a-title-with-actionscript/</link>
<pubDate>Tue, 22 Jul 2008 14:53:28 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=77</guid>
<description></description>
<content:encoded><![CDATA[<p>The <code>LoadImage</code> class can be modified to accept a parameter for the image URL:</p>

<pre>
package {
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	
	public class LoadImage extends Sprite {
		public var imageURL:String;
		private var loader:Loader;
		
		public function LoadImage(imageURL:String) {
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.INIT, initListener);
			loader.load(new URLRequest(imageURL));
		}
		
		private function initListener (e:Event):void {
			addChild(loader.content);
		}
	}
}</pre>

<p>An I<code>mageTitle</code> class creates a text field with a <code>title</code> parameter:</p> 

<pre>
package {
	import flash.display.*;
	import flash.text.*;
	
	public class ImageTitle extends Sprite {
		public function ImageTitle (title:String) {
			var title:String;
			var titleText:TextField = new TextField();
			var format:TextFormat = new TextFormat();
			format.font = "Arial";
			format.size = 20;
			format.color = 0xFFFFFF;

			titleText.text = title;
			titleText.setTextFormat(format);
			titleText.autoSize = TextFieldAutoSize.LEFT;
			
			addChild(titleText);
		}
	}
}</pre>

<p>The ImageView class creates a rounded corner rectangle, <code>ImageBorder</code>, that forms the border around a masked image. The image is loaded. Then, another rounded corner rectangle, <code>ImageMask</code>, is created on top of the image and the slightly larger border rectangle. This smaller rectangle is used as a mask for the image, creating the effect of an image with rounded corners. A title bar is created with a shadow, <code>titleBarShadow</code>, which is simply a black rectangle with an alpha transparency setting of 50%. The title bar, <code>titleBar</code>, is added on top of the shadow with dimensions slightly smaller than the shadow and a gradient fill oriented at 90 degrees. Finally, the title, <code>ImageTitle</code>, is added.</p>

<pre>package {
	import flash.display.*;
	import flash.events.*;
	import flash.geom.*
	
	public class ImageView extends Sprite {
		public function ImageView () {
			var imageURL:String = "assets/image.jpg";

			// Set variables for image masks
			var fillType:String = GradientType.LINEAR;
			var colors:Array = [0xFFFFFF, 0xCCCCCC];
			var alphas:Array = [1, 1];
			var ratios:Array = [0, 255];
			var matrix:Matrix = new Matrix();
			matrix.createGradientBox(320, 240, 90, 0, 0);
			var spreadMethod:String = SpreadMethod.PAD;

			// Create imageBorder
			var imageBorder:Sprite = new Sprite();
			imageBorder.graphics.beginGradientFill(fillType, colors, alphas, ratios, matrix, spreadMethod);  
			imageBorder.graphics.drawRoundRect(2, 0, 324, 244, 40);
			imageBorder.graphics.endFill();
			addChild(imageBorder);
			
			// Load the image and instantiate it as "image1"
			var image:LoadImage = new LoadImage(imageURL);
			addChild(image);
			image.x = -26;
			image.y = -100;

			// Create imageMask
			var imageMask:Sprite = new Sprite();
			imageMask.graphics.beginFill(0xFFFFFF, 1);  
			imageMask.graphics.drawRoundRect(4, 2, 320, 240, 36);
			imageMask.graphics.endFill();
			addChild(imageMask);
			
			// Apply imageMask to image
			image.mask = imageMask;
			
			// Create title bar shadow
			var titleBarShadow:Sprite = new Sprite();
			titleBarShadow.graphics.beginFill(0x000000,.5);
			titleBarShadow.graphics.drawRect(0, 150, 328, 60);
			titleBarShadow.graphics.endFill();
			titleBarShadow.alpha = .5;
			addChild(titleBarShadow);
			
			// Create the title bar
			var titleBar:Sprite = new Sprite();
			var titleBarGradMatrix:Matrix = new Matrix();
			titleBarGradMatrix.createGradientBox(324, 56, (90 / 180 * Math.PI), 2, 152);
			titleBar.graphics.beginGradientFill(fillType, [0x99CCFF, 0x336699], alphas, ratios, titleBarGradMatrix, spreadMethod);
			titleBar.graphics.drawRect(2, 152, 324, 56);
			titleBar.graphics.endFill();
			titleBar.alpha = .9;
			addChild(titleBar);
			
			// Create title text
			var title:ImageTitle = new ImageTitle("Image Title");
			addChild(title);
			title.x = 12;
			title.y = 156;
			
		}
	}
}
</pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>77</wp:post_id>
<wp:post_date>2008-07-22 07:53:28</wp:post_date>
<wp:post_date_gmt>2008-07-22 14:53:28</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>apply-a-mask-and-add-a-title-with-actionscript</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1216738466</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Creating a Site with Symphony</title>
<link>http://bauhouse.wordpress.com/2008/07/22/creating-a-site-with-symphony/</link>
<pubDate>Tue, 22 Jul 2008 14:55:58 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[Symphony]]></category>

		<category domain="category" nicename="symphony"><![CDATA[Symphony]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=32</guid>
<description></description>
<content:encoded><![CDATA[<p>I ran into a <a href="http://overture21.com/forum/comments.php?DiscussionID=1814&amp;page=1#Item_3">bug using Symphony</a>. I don't know enough about PHP and the Symphony core to be able to monkey around with it to discover what exactly is going on to produce the behaviour I am finding. I'm using Textile to format the entries for a client site I developed with Symphony 1.5. The site has since been updated to Symphony 1.7, but now when I resave data sources, the text formatter is disabled and the XML data for text area fields is being returned without formatting. Without child elements to parse, the XSL templates do not output the text when using instructions such as <code>xsl:copy-of select="body/*"</code>.</p>

<h3>Considering the Options</h3>

<p>So, how should I go about fixing the problem?</p>

<ul>
  <li>Learn PHP, figure out how Symphony works, and fix the problem</li>
  <li>Use a manual hack every time I save a data source</li>
  <li>Rebuild from scratch</li>
</ul>

<p>Considering the options, I think I could probably rebuild the site faster than I could learn how to fix the bug. The hack doesn't seem like a good long term solution. If the source of the problem is a migration from an earlier version gone wrong, I might as well take this opportunity to rebuild the site and optimize the code, based on what I've learned since I first built the site. There are some things that I would do differently now.</p>

<h3>Download Symphony</h3>

<p><a href="http://21degrees.com.au/products/symphony/">Symphony</a> is a web publishing system developed by Twentyone Degrees in Brisbane, Australia. The system is powered by XML and XSLT, standards recommended by the W3C. Symphony 1.7 is free, but not open source. Symphony 2 Beta Revision 5 is the first open source release available from Twentyone Degrees. To download either version will require registering at <a href="http://accounts.symphony21.com/">Symphony Accounts</a>. Once you have logged in, click on the Download Symphony link to download Symphony 1.7.01.</p>

<h3>Install Symphony</h3>

<p>I will be developing the site on my local development server. I am using the Apache web server that comes installed on Mac OS X. I have added support for PHP 5 and MySQL 5. PHP is configured to process XSLT. Apache is configured to allow <code>.htaccess</code> files to override the default configuration settings and use <code>mod_rewrite</code> rules.</p>

<h4>Create Virtual Hosts</h4>

<p>I have created a couple virtual hosts by modifying my <code>/etc/hosts</code> file by adding the following:</p>

<pre>127.0.0.1       sitename.dev
127.0.0.1       sitename.local</pre>

<p>Then I modify the virtual hosts configuration file for Apache. For Mac OS X versions previous to 10.5 Leopard, I would add the code to the end of the Apache configuration file found here: <code>/etc/httpd/httpd.conf</code>. Now that Leopard is using Apache 2, the location for the virtual hosts configuration file is here: <code>/etc/apache2/extra/httpd-vhosts.conf</code>. I have my virtual hosts organized in my user Sites directory. I'll set the location of these virtual hosts with something like this:</p>

<pre>
&lt;VirtualHost 127.0.0.1&gt;
    ServerName sitename.dev
    DocumentRoot /Users/Stephen/Sites/domains/sitename/dev/www
&lt;/VirtualHost&gt;

&lt;VirtualHost 127.0.0.1&gt;
    ServerName sitename.local
    DocumentRoot /Users/Stephen/Sites/domains/sitename/local/www
&lt;/VirtualHost&gt;</pre>

<p>Then, gracefully restart Apache, so the web server configuration can be updated:</p>

<pre>sudo apachectl graceful</pre>

<p>So, now I have two locations available for comparing the existing site and the development site. I have the existing site, in its backup state before things started to go awry, installed in the <code>sitename.local</code> location. The development site is in the <code>sitename.dev</code> location.</p>

<p>I'm going to start without a workspace. This allows you to start with nothing but an empty database and an empty workspace. Otherwise, the default theme will be installed with example entries. I like to start clean.</p>

<h4>Clean Install</h4>

<p>For a clean install of Symphony, all you need are the following files/directories:</p>

<ul>
  <li>index.php</li>
  <li>install.php</li>
  <li>symphony</li>
</ul>

<p>I have copied these files into the development directory, so the directory structure looks like this:</p>

<pre>/Users/Stephen/Sites/domains/sitename/dev/www/index.php
/Users/Stephen/Sites/domains/sitename/dev/www/install.php
/Users/Stephen/Sites/domains/sitename/dev/www/symphony</pre>

<h4>File Permissions</h4>

<p>Before installing, the directory and file permissions need to be set to ensure that installation is trouble free. This can be accomplished by running the following commands in Terminal. First, change directories:</p>

<pre>cd ~/Sites/domains/sitename/dev</pre>

<p>Then, change the permissions to allow the installer to write files to these directories.</p>

<pre>chmod -R 755 www
chmod 777 www
chmod 777 www/symphony</pre>

<h4>Create a MySQL Database</h4>

<p>Symphony requires a connection to a MySQL database, so I'll create this first before proceeding with the install. I use phpMyAdmin to create the database.</p>

<pre>create database sitename_dev</pre>

<h4>Installation</h4>

<p>Navigate to the install file and follow the instructions to provide the database and user details:</p>

<pre>http://sitename.dev/install.php</pre>

<h5>Environment Settings</h5>
<ul>
  <li>Root Path: /Users/Stephen/Sites/domains/sitename/dev/www</li>
</ul>

<h5>Database Connection</h5>
<ul>
  <li>Database: sitename_dev</li>
  <li>Username: root</li>
  <li>Password: ****</li>
  <li>Host: localhost</li>
  <li>Port: 3306</li>
  <li>Table Prefix: sym_</li>
</ul>

<h5>Permission Settings</h5>
<ul>
  <li>Files: 0777</li>
  <li>Directories: 0755</li>
</ul>

<h5>User Information</h5>
<ul>
  <li>Username</li>
  <li>Password</li>
</ul>

<h5>Personal Information</h5>
<ul>
  <li>First Name</li>
  <li>Last Name</li>
  <li>Email Address</li>
</ul>

<p>The install takes a single click, and I am now looking at the Symphony login window, as all has gone well. This is where I will be logging into the Symphony administration interface.</p>

<pre>http://sitename.dev/symphony</pre>

<p>I like to be able modify XSL templates and configuration files directly from the file system, using TextWrangler or Coda as my editors of choice. If I list the files in Terminal to determine the permissions, I see that the files have been created as the default Apache user, <code>_www</code>. 

<pre>
cd ~/Sites/domains/sitename/dev/www
ls -la

drwxr-xr-x  12 Stephen  Stephen    408 Jul 19 14:45 .
drwxr-xr-x   4 Stephen  Stephen    136 Jul 19 07:20 ..
-rwxr-xr-x@  1 Stephen  Stephen   6148 Jul 19 14:22 .DS_Store
-rwxrwxrwx   1 _www     Stephen   1883 Jul 19 12:50 .htaccess
-rwxr-xr-x@  1 Stephen  Stephen   1050 Apr  1  2007 README
drwxr-xr-x   2 _www     Stephen     68 Jul 19 12:50 campfire
-rwxr-xr-x@  1 Stephen  Stephen   6460 Mar 16  2007 index.php
-rw-r--r--   1 _www     Stephen   2053 Jul 19 12:50 install-log.txt
-rw-r--r--@  1 Stephen  Stephen  88956 Mar 27  2007 install.php
drwxr-xr-x   6 _www     Stephen    204 Jul 19 12:50 manifest
drwxr-xr-x@ 12 Stephen  Stephen    408 Mar 22  2007 symphony
drwxr-xr-x   9 _www     Stephen    306 Jul 19 12:50 workspace
</pre>

<p>This list clearly shows the files and directories that Symphony has created during the install process. To make sure I can still access these files from the file system without much fuss, I'm going to change the permissions on these files, recursively changing the owner and group to my username:</p>

<pre>cd ~/Sites/domains/sitename/dev
sudo chown -R Stephen:Stephen www</pre>

<p>The first thing I would want to do at this point is to delete the install.php file for security reasons, especially if I was working on a production server.</p>

<h3>Hello World</h3>

<p>Symphony is installed, so I'll start going through the process of building the home page. For anyone unfamiliar with Symphony, I have created an introduction to Building a Symphony Theme. Unfortunately, I haven't had a chance to finish the tutorial. I hope I can remedy this by completing the documentation for developing this site, assuming that everyone knows the basics as detailed in these articles:</p>

<ul>
  <li><a href="http://bauhouse.ca/journal/building-a-symphony-theme-part-1/">Building a Symphony Theme: Part 1</a></li>
  <li><a href="http://bauhouse.ca/journal/building-a-symphony-theme-part-2/">Building a Symphony Theme: Part 2</a></li>
  <li><a href="http://bauhouse.ca/journal/building-a-symphony-theme-part-3/">Building a Symphony Theme: Part 3</a></li>
  <li><a href="http://bauhouse.ca/journal/building-a-symphony-theme-part-4/">Building a Symphony Theme: Part 4</a></li>
  <li><a href="http://bauhouse.ca/journal/building-a-symphony-theme-part-5/">Building a Symphony Theme: Part 5</a></li>
</ul>

<h3>Install Campfire Services</h3>

<p>This is an important step, since the preference set for each Author determines the text formatter to be used for all entries created by that Author. Text formatters are generally added to Symphony as Campfire Services. I will be using the Textile text formatter. Check out the available <a href="http://overture21.com/campfire-service/">Campfire Services on the Overture Forum</a>.</p>

<h3>Plan the Site Structure</h3>

<p>The site requires several types of content: static content pages, news and archives, images, projects organized by country and project partner, a repository of resources, a means of registering members who are provided with access to resources by logging into a members area. Future requirements include photo and video galleries. With that in mind, the site will be built with the following sections:</p>

<h4>Sections</h4>

<ul>
  <li>Content</li>
  <li>News</li>
  <li>Resources</li>
  <li>Categories</li>
  <li>Campaigns</li>
  <li>Projects</li>
  <li>Countries</li>
  <li>Partners</li>
  <li>Members</li>
</ul>

<p>With a site structure in mind, I can develop a custom administration interface by populating each section with custom fields to manage all the types of data that will be used by each section. I have a choice of several different field types: Text Input, Text Area, Select Box, Check Box, File Attachment and Section Link (<a href="http://overture21.com/forum/comments.php?DiscussionID=453">one of my contributions to the development of Symphony</a>).</p>

<h4>Custom Fields</h4>

<ul>
  <li>Content
    <ul>
      <li>Title (Text Input)</li>
      <li>Page (Select Box)</li>
      <li>Body (Text Area)</li>
      <li>Photo (File Attachment)</li>
      <li>Photo Title (Text Input)</li>
      <li>Publish (Check Box)</li>
    </ul>
  </li>
  <li>News
    <ul>
      <li>Title (Text Input)</li>
      <li>Category (Section Link: Categories)</li>
      <li>Description (Text Area)</li>
      <li>Body (Text Area)</li>
      <li>Photo (File Attachment)</li>
      <li>Photo Title (Text Input)</li>
      <li>Publish (Check Box)</li>
    </ul>
  </li>
  <li>Resources
    <ul>
      <li>Resource (Text Input)</li>
      <li>File (File Attachment)</li>
      <li>Category (Section Link: Categories)</li>
      <li>Description (Text Area)</li>
    </ul>
  </li>
  <li>Categories
    <ul>
      <li>Title (Text Input)</li>
      <li>Description (Text Area)</li>
    </ul>
  </li>
  <li>Campaigns
    <ul>
      <li>Campaign Year (Text Input)</li>
      <li>Description (Text Area)</li>
      <li>Partners (Section Link: Multiple)</li>
      <li>Countries (Section Link: Multiple)</li>
    </ul>
  </li>
  <li>Projects
    <ul>
      <li>Project (Text Input)</li>
      <li>Project Year (Select Box)</li>
      <li>Project Country (Section Link: Countries)</li>
      <li>Project Partner (Section Link: Partners)</li>
      <li>Description (Text Area)</li>
      <li>Details (Text Area)</li>
      <li>Photo (File Attachment)</li>
      <li>Photo Title [Portrait Orientation] (Checkbox)</li>
      <li>Sort (Text Input)</li>
    </ul>
  </li>
  <li>Countries
    <ul>
      <li>Country (Text Input)</li>
      <li>Continent (Select Box)</li>
      <li>Country Code (Text Input)</li>
      <li>Description (Text Area)</li>
      <li>Government (Text Input)</li>
    </ul>
  </li>
  <li>Partners
    <ul>
      <li>Partner (Text Input)</li>
      <li>Full Name (Text Input)</li>
      <li>Type (Select Box)</li>
      <li>Description (Text Area)</li>
      <li>Website Title (Text Input)</li>
      <li>Website URL (Text Input)</li>
      <li>Logo (File Attachment)</li>
    </ul>
  </li>
  <li>Members
    <ul>
      <li>Username (Text Input)</li>
      <li>First Name (Text Input)</li>
      <li>Last Name (Text Input)</li>
      <li>Email (Text Input)</li>
      <li>Phone (Text Input)</li>
      <li>Address 1 (Text Input)</li>
      <li>Address 2 (Text Input)</li>
      <li>City (Text Input)</li>
      <li>Province / State (Text Input)</li>
      <li>Country (Text Input)</li>
      <li>Postal / Zip Code (Text Input)</li>
      <li>Role (Select Box)</li>
      <li>Role Other (Text Input)</li>
      <li>Communication Method (Select Box)</li>
      <li>Organizing Class (Text Input)</li>
      <li>Organization Name (Text Input)</li>
      <li>Organization Type (Select Box)</li>
      <li>Organization Type Other (Text Input)</li>
      <li>Organization Address 1 (Text Input)</li>
      <li>Organization Address 2 (Text Input)</li>
      <li>Organization City (Text Input)</li>
      <li>Organization Province / State (Text Input)</li>
      <li>Organization Country (Text Input)</li>
      <li>Organization Postal / Zip Code (Text Input)</li>
      <li>Organization Email (Text Input)</li>
      <li>Organization Phone (Text Input)</li>
      <li>Organization Facsimile (Text Input)</li>
    </ul>
  </li>
</ul>

<h3>Create the Master Template</h3>

<p>Create a new master template [Blueprints : Components : Create New] called "default".</p>

<p>Then create a page [Blueprints : Pages : Create New] called "Home", configuring the page type as "index", that uses the <code>default.xsl</code> master template.</p>

<p>The default template will look something like this:</p>

<pre>
  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    encoding="UTF-8"
    indent="yes" /&gt;
  
  &lt;xsl:param name="campaign-year" select="2008"/&gt;
  &lt;xsl:param name="logged-in" select="/data/events/user/@logged-in"/&gt;
  
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;&lt;xsl:value-of select="$website-name"/&gt; - &lt;xsl:value-of select="$page-title"/&gt;&lt;/title&gt;
        &lt;link rel="stylesheet" type="text/css" media="screen" href="{$root}/workspace/assets/css/hri.css"/&gt;
        &lt;link rel="alternate" type="application/rss+xml" href="/rss/" /&gt;
      &lt;/head&gt;
      &lt;body id="section-{$current-page}"&gt;
        &lt;div id="wrapper"&gt;
          &lt;ul id="global-nav"&gt;
            &lt;xsl:call-template name="global-nav"/&gt;
          &lt;/ul&gt;
          &lt;div id="header"&gt;
            &lt;h1&gt;&lt;a href="{$root}" id="hri-link"&gt;&lt;span&gt;&lt;xsl:value-of select="$website-name"/&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;
            &lt;div id="main-nav"&gt;
              &lt;ul&gt;
              &lt;xsl:call-template name="navigation"/&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="body-container"&gt;
            &lt;xsl:apply-templates /&gt;
            &lt;div class="clear"&gt;&lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="footer"&gt;
            &lt;div id="copyright"&gt;
              &lt;p&gt;Copyright 2008 Hunger Response International. All rights reserved. &lt;a href="{$root}/privacy/" title="Hunger Response International / Rice Raiser Privacy Policy"&gt;Privacy Policy&lt;/a&gt;
              | Site Design by &lt;a href="http://www.bauhouse.ca/" title="Bauhouse Visual Communications"&gt;Bauhouse&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/body&gt;
    &lt;/html&gt;   
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
</pre>

<h3>Create the Navigation Utility</h3>

<p>This template makes reference to a couple templates that do not yet exist. I can add these named templates after the match template. Or if I want this template to be accessible to all master templates, I can create a utility without attaching it to a specific data source.</p>

<pre>
  &lt;xsl:template name="global-nav"&gt;
    &lt;xsl:for-each select="/data/navigation/page[@type = 'global' or @type = 'index']"&gt;
      &lt;xsl:choose&gt;
        &lt;xsl:when test="@type = 'index'"&gt;
          &lt;li&gt;
            &lt;xsl:if test="@handle = $current-page"&gt;
              &lt;xsl:attribute name="class"&gt;current&lt;/xsl:attribute&gt;
            &lt;/xsl:if&gt;
            &lt;a href="{$root}/"&gt;&lt;xsl:value-of select="title"/&gt;&lt;/a&gt;
          &lt;/li&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:otherwise&gt;
          &lt;li&gt;
            &lt;xsl:if test="@handle = $current-page"&gt;
              &lt;xsl:attribute name="class"&gt;current&lt;/xsl:attribute&gt;
            &lt;/xsl:if&gt;
            &lt;a href="{$root}/{@handle}/"&gt;&lt;xsl:value-of select="title"/&gt;&lt;/a&gt;
          &lt;/li&gt;
        &lt;/xsl:otherwise&gt;
      &lt;/xsl:choose&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="main-nav"&gt;
    &lt;xsl:choose&gt; 
      &lt;xsl:when test="$logged-in='true'"&gt;
        &lt;xsl:for-each select="/data/navigation/page[@type='members']"&gt;
          &lt;li&gt;
            &lt;xsl:if test="@handle = $current-page"&gt;
              &lt;xsl:attribute name="class"&gt;current&lt;/xsl:attribute&gt;
            &lt;/xsl:if&gt;
            &lt;a href="{$root}/{@handle}/"&gt;&lt;xsl:value-of select="title"/&gt;&lt;/a&gt;
          &lt;/li&gt;
        &lt;/xsl:for-each&gt;
        &lt;li&gt;&lt;a&gt;Logged in as &lt;xsl:value-of select="/data/events/user/username"/&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="{$root}/symphony/?page=/logout/"&gt;Logout&lt;/a&gt;&lt;/li&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:for-each select="/data/navigation/page[@type='default' or @type='login']"&gt;
          &lt;li&gt;
            &lt;xsl:if test="@handle = $current-page"&gt;
              &lt;xsl:attribute name="class"&gt;current&lt;/xsl:attribute&gt;
            &lt;/xsl:if&gt;
            &lt;a href="{$root}/{@handle}/"&gt;&lt;xsl:value-of select="title"/&gt;&lt;/a&gt;
          &lt;/li&gt;
        &lt;/xsl:for-each&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
</pre>

<h3>Create the Page Structure</h3>

<p>With the navigation in place, now we can start building the page structure. The pages have been created with the following parameters: Title (Master, URL Schema, Page Type)</p>

<ul>
  <li>Home (default.xsl, entry, index)</li>
  <li>Partners (index.xsl, entry, global)</li>
  <li>Projects (index.xsl, year/entry, global)</li>
  <li>News (default.xsl, year/month/day/entry, global)</li>
  <li>Donate (default.xsl, entry, global)</li>
  <li>About (default.xsl, entry, global)
    <ul>
      <li>Board of Directors (default.xsl, entry, about)
      <li>Advisory Council (default.xsl, entry, about)
    </ul>
  </li>
  <li>Contact (default.xsl, entry, global)
  <li>Resources (default.xsl, category/entry, members)
  <li>Register (default.xsl, n/a, Default)
  <li>Login (default.xsl, entry, login)
  <li>Privacy (default.xsl, entry, legal)
  <li>Maintenance (default.xsl, n/a, Maintenance)
  <li>Page Not Found (default.xsl, n/a, Page Not Found)
</ul>

<h3>Creating Templates for Common Elements</h3>

<p>I'm going to make sure that modifying the templates will be necessary only in a single place. I'll create a template for common elements such as the head element, navigation and footer. The default master template now looks like this:</p>

<pre>
  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
    &lt;xsl:output method="xml"
      doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
      encoding="UTF-8"
      indent="yes" /&gt;
    
    &lt;xsl:param name="campaign-year" select="2008"/&gt;
    &lt;xsl:param name="logged-in" select="/data/events/user/@logged-in"/&gt;
    
    &lt;xsl:template match="/"&gt;
      &lt;html&gt;
        &lt;xsl:call-template name="head"/&gt;
        &lt;body id="section-{$current-page}"&gt;
          &lt;div id="wrapper"&gt;
            &lt;xsl:call-template name="navigation"/&gt;
            &lt;div id="body-container"&gt;
              &lt;xsl:apply-templates /&gt;
              &lt;div class="clear"&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;xsl:call-template name="footer"/&gt;
          &lt;/div&gt;
        &lt;/body&gt;
      &lt;/html&gt;  
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
</pre>

<p>The common elements are being called from a utility called "Common" that contains three named templates:</p>

<pre>
  &lt;xsl:template name="head"&gt;
    &lt;head&gt;
      &lt;title&gt;&lt;xsl:value-of select="$website-name"/&gt; - &lt;xsl:value-of select="$page-title"/&gt;&lt;/title&gt;
      &lt;link rel="stylesheet" type="text/css" media="screen" href="{$root}/workspace/assets/css/hri.css"/&gt;
      &lt;link rel="alternate" type="application/rss+xml" href="/rss/" /&gt;
    &lt;/head&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="navigation"&gt;
    &lt;ul id="global-nav"&gt;
      &lt;xsl:call-template name="global-nav"/&gt;
    &lt;/ul&gt;
    &lt;div id="header"&gt;
      &lt;h1&gt;&lt;a href="{$root}" id="hri-link"&gt;&lt;span&gt;&lt;xsl:value-of select="$website-name"/&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;
      &lt;div id="main-nav"&gt;
        &lt;ul&gt;
        &lt;xsl:call-template name="main-nav"/&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="footer"&gt;
    &lt;div id="footer"&gt;
      &lt;div id="copyright"&gt;
        &lt;p&gt;Copyright 2008 Hunger Response International. All rights reserved. &lt;a href="{$root}/privacy/" title="Hunger Response International / Rice Raiser Privacy Policy"&gt;Privacy Policy&lt;/a&gt;
        | Site Design by &lt;a href="http://www.bauhouse.ca/" title="Bauhouse Visual Communications"&gt;Bauhouse&lt;/a&gt;&lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/xsl:template&gt;
</pre>

<h3>Content and Navigation Utilities</h3>

<p>I've created some templates to help automate the process of building content and section menus for pages. For page content, I have created a "Page Content" utility.</p>

<h4>Page Content</h4>

<pre>
  &lt;xsl:template name="page-body"&gt;
    &lt;xsl:param name="page-datasource" select="content/entry"/&gt;
    &lt;div id="section"&gt;
      &lt;div class="section-head"&gt;
        &lt;h2&gt;
          &lt;a href="{$root}/{$current-page}/"&gt;
            &lt;xsl:value-of select="$page-title"/&gt;
          &lt;/a&gt;
        &lt;/h2&gt;
      &lt;/div&gt;
      &lt;div class="section-menu"&gt;
        &lt;ul&gt;
          &lt;xsl:call-template name="section-menu"&gt;
            &lt;xsl:with-param name="page-datasource" select="$page-datasource"/&gt;
          &lt;/xsl:call-template&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="main-content"&gt;
      &lt;xsl:call-template name="page-content"&gt;
        &lt;xsl:with-param name="page-datasource" select="$page-datasource" /&gt;
      &lt;/xsl:call-template&gt;
    &lt;/div&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="page-content"&gt;
    &lt;xsl:param name="page-datasource" select="content/entry"/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="($entry)"&gt;
        &lt;xsl:for-each select="$page-datasource[@handle=$entry]"&gt;
          &lt;div class="content-head"&gt;
            &lt;h2&gt;&lt;a href="{$root}/{$current-page}/{@handle}/" title="Permanent link to this article"&gt;&lt;xsl:value-of select="fields/title"/&gt;&lt;/a&gt;&lt;/h2&gt;
          &lt;/div&gt;
          &lt;div class="content-body"&gt;
            &lt;xsl:if test="(fields/photo/item)"&gt;
              &lt;p class="photo"&gt;&lt;img src="{$root}/{fields/photo/item/path}" title="{fields/photo-title}"/&gt;&lt;/p&gt;
            &lt;/xsl:if&gt;
            &lt;xsl:apply-templates select="fields/body/*" mode="root-url"/&gt;
          &lt;/div&gt;
        &lt;/xsl:for-each&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:for-each select="$page-datasource[fields/page/@handle=$current-page][1]"&gt;
          &lt;div class="content-head"&gt;
            &lt;h2&gt;&lt;a href="{$root}/{$current-page}/{@handle}/" title="Permanent link to this article"&gt;&lt;xsl:value-of select="fields/title"/&gt;&lt;/a&gt;&lt;/h2&gt;
          &lt;/div&gt;
          &lt;div class="content-body"&gt;
            &lt;xsl:apply-templates select="fields/body/*" mode="root-url"/&gt;
          &lt;/div&gt;
        &lt;/xsl:for-each&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
</pre>

<h4>Page Navigation</h4>

<p>The "Page Content" utility calls templates from the "Page Navigation" utility:</p>

<pre>
  &lt;xsl:template name="section-menu"&gt;
    &lt;xsl:param name="page-datasource" select="/data/content-titles/entry"/&gt;
    &lt;xsl:param name="for-section" select="$current-page"/&gt;
    &lt;xsl:for-each select="$page-datasource[fields/page/@handle=$for-section]"&gt;
      &lt;li&gt;
        &lt;xsl:if test="(not($entry) and position() = 1 and $current-page = $for-section) or @handle = $entry"&gt;
          &lt;xsl:attribute name="class"&gt;current&lt;/xsl:attribute&gt;
        &lt;/xsl:if&gt;
        &lt;a href="{$root}/{$for-section}/{@handle}/"&gt;&lt;xsl:value-of select="fields/title"/&gt;&lt;/a&gt;
      &lt;/li&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="projects-menu"&gt;
    &lt;xsl:param name="page-datasource" select="/data/projects/entry"/&gt;
    &lt;xsl:param name="for-year" select="2007"/&gt;
    &lt;xsl:for-each select="$page-datasource[fields/project-year=$for-year]"&gt;
      &lt;xsl:sort select="fields/project-number"/&gt;
      &lt;li&gt;
        &lt;xsl:if test="($year and not($entry) and position() = 1) or @handle = $entry"&gt;
          &lt;xsl:attribute name="class"&gt;current&lt;/xsl:attribute&gt;
        &lt;/xsl:if&gt;
        &lt;a href="{$root}/projects/{$for-year}/{@handle}/"&gt;&lt;xsl:value-of select="fields/project"/&gt;&lt;/a&gt;
      &lt;/li&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="partners-menu"&gt;
    &lt;xsl:param name="global" select="'no'"/&gt;
    &lt;xsl:for-each select="partners/entry[fields/global=$global]"&gt;
      &lt;li&gt;
        &lt;xsl:if test="@handle = $entry"&gt;
          &lt;xsl:attribute name="class"&gt;current&lt;/xsl:attribute&gt;
        &lt;/xsl:if&gt;
        &lt;a href="{$root}/partners/{@handle}/"&gt;&lt;xsl:value-of select="fields/full-name"/&gt;&lt;/a&gt;
      &lt;/li&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
</pre>

<h3>Root URL Utility</h3>

<p>The <code>xsl:apply-templates</code> instruction used by the <code>page-content</code> template is referring a set of templates that I use to define a mode called <code>root-url</code>. This allows me to publish the Symphony site within a subdirectory while automatically modifying absolute href attributes that have been created as entry content to point to the href relative to the current location using Symphony's <code>$root</code> parameter.</p>

<pre>
  &lt;xsl:template match="*" mode="root-url"&gt;
    &lt;xsl:element name="{name(.)}"&gt;
      &lt;xsl:apply-templates select="@*" mode="root-url"/&gt;
      &lt;xsl:apply-templates mode="root-url"/&gt;
    &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="@*" mode="root-url"&gt;
    &lt;xsl:attribute name="{name(.)}"&gt;&lt;xsl:value-of select="."/&gt;&lt;/xsl:attribute&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="text()" mode="root-url"&gt;
    &lt;xsl:value-of select="."/&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="img[substring(@src,1,1)='/']" mode="root-url"&gt;
    &lt;img&gt;
      &lt;xsl:apply-templates select="@*" mode="root-url"/&gt;
      &lt;xsl:attribute name="src"&gt;&lt;xsl:value-of select="$root"/&gt;&lt;xsl:value-of select="@src"/&gt;&lt;/xsl:attribute&gt;
    &lt;/img&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="a[substring(@href,1,1)='/']" mode="root-url"&gt;
    &lt;a&gt;
      &lt;xsl:apply-templates select="@*" mode="root-url"/&gt;
      &lt;xsl:attribute name="href"&gt;&lt;xsl:value-of select="$root"/&gt;&lt;xsl:value-of select="@href"/&gt;&lt;/xsl:attribute&gt;
      &lt;xsl:value-of select="."/&gt;
      &lt;xsl:apply-templates select="./*" mode="root-url"/&gt;
    &lt;/a&gt;
  &lt;/xsl:template&gt;
</pre>

<h3>Utilities</h3>

<p>So far, I have the following list of utilities that are used by all pages, since they have not been attached to a specific data source:</p>

<ul>
  <li>Common (common.xsl)</li>
  <li>Navigation (navigation.xsl)</li>
  <li>Page Content (page-content.xsl)</li>
  <li>Page Navigation (page-navigation.xsl)</li>
  <li>Root URL (root-url.xsl)</li>
</ul>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>32</wp:post_id>
<wp:post_date>2008-07-22 07:55:58</wp:post_date>
<wp:post_date_gmt>2008-07-22 14:55:58</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>creating-a-site-with-symphony</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1216738564</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>20</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>70.69.162.138</wp:comment_author_IP>
<wp:comment_date>2008-07-25 07:14:49</wp:comment_date>
<wp:comment_date_gmt>2008-07-25 14:14:49</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Glad that helped. I'm hoping I can get to the next installment soon. I finished rebuilding the site, so it'll be a matter of remembering what I did. I was running out of the time I needed to document everything.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>18</wp:comment_id>
<wp:comment_author><![CDATA[Cenazoic]]></wp:comment_author>
<wp:comment_author_email>cenazoic@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>198.62.176.149</wp:comment_author_IP>
<wp:comment_date>2008-07-24 06:35:24</wp:comment_date>
<wp:comment_date_gmt>2008-07-24 13:35:24</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks for this.  It really helped clarify how a Symphony site is structured.  Looking forward to the next installment.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>92</wp:comment_id>
<wp:comment_author><![CDATA[Al]]></wp:comment_author>
<wp:comment_author_email>al@alavery.net</wp:comment_author_email>
<wp:comment_author_url>http://www.alavery.net</wp:comment_author_url>
<wp:comment_author_IP>96.252.61.193</wp:comment_author_IP>
<wp:comment_date>2009-02-19 05:28:35</wp:comment_date>
<wp:comment_date_gmt>2009-02-19 12:28:35</wp:comment_date_gmt>
<wp:comment_content><![CDATA[This is a great resource and I'm looking forward to digging in deeper. I wonder if you would be able to help out with what I think is a simply newbie question - I have php5 and mySQL5 installed (after two nights of research and setup); I setup a database for Symphony (using Sequel Pro). I have also verified that the Db exists via "mysql&gt; show databases;" in Terminal. But the install screen returns the error: "Symphony was unable to connect to the specified database. You may need to modify host or port settings." It doesn't seem that you needed to be more explicit in directing Symphony where to look for your Db, but I wonder if that's my issue...? Thanks for any help you can provide.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>96</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>174.1.64.181</wp:comment_author_IP>
<wp:comment_date>2009-02-25 09:03:39</wp:comment_date>
<wp:comment_date_gmt>2009-02-25 16:03:39</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Al, you'll want to make sure that the database you created is accessible by the user you specify for your database connection. It may be possible that you have created a database, but one that is not accessible by the specified user.

Log in to mysql in Terminal:

<code>mysql</code>

Then list the databases:

<code>show databases;</code>

This will be a different list than if you specify a user:

<code>mysql -u root -p</code>

Hopefully, the solution is as simple as this.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>92</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>Loading XML in ActionScript 3.0</title>
<link>http://bauhouse.wordpress.com/2008/07/23/loading-xml-in-actionscript-30/</link>
<pubDate>Thu, 24 Jul 2008 01:19:20 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=84</guid>
<description></description>
<content:encoded><![CDATA[<p>My first thought was to see whether I could make use of <a href="http://osflash.org/xpath4as2">XPath4AS2</a>, but adapt it for use in ActionScript 3.0. I have no idea how much work that might involve. If all it means is wrapping the classes in a package code block, that seems easy enough, I suppose. Anything beyond that, and I think I'll wait until a future release. However, I was unsure about how to add a classpath to Flash, since I thought I'd like to try using Flash instead of the mxmlc compiler that I have been using with the Flex 3 SDK.</p>

<p>It took a bit of trial and error, since I didn't understand what the path was meant to define. I thought at first it was the full path to the class(es) that I wanted to use. Then it dawned on me that it was the path to the directory in which the classes are stored. None of the documentation I came across really spelled this out clearly. I decided to place all my classes here:</p>

<pre>~/flex/classes</pre>

<p>I discovered that the class path needs to be either relative to the directory in which the Flash document is stored, or absolute. The UNIX convention of using the tilde character to denote the user directory does not work when defining the classpath. I ended up setting the global classpath in Flash by going to Flash : Preferences : Category : ActionScript : ActionScript 3.0 Settings : Classpath.</p>

<pre>Stephen232GB:Users:stephen:flex:classes</pre>

<p>Then, I can import classes relative to this path for any FLA files I create. So, the classes I wanted to import are stored here:</p>

<pre>~/flex/classes/com/xfactorstudio/xml/xpath</pre>

<p>Now it makes total sense when I import classes using the following code in ActionScript:</p>

<pre>import com.xfactorstudio.xml.xpath.XPath;</pre>

<p>At any rate, that is all a side note to what I wanted to accomplish, which was to be able to load an external XML file and parse the contents. It took a bit of fiddling around with the code examples I had on hand to figure out how to use the XML once I had loaded it into an object. I wanted to find out whether I could load the file and output the contents to a text box. Here's how I did it:</p>

<pre>
package {
	import flash.display.*;
	import flash.events.*; 
	import flash.net.*;
	import flash.text.*;

	public class XMLData extends Sprite {
		public var xmlString:String;
		public var xmlURL:String = "Products.xml";
		public var xmlData:XML;
		private var urlLoader:URLLoader;
		
		// constructor
		public function XMLData () {
			var urlRequest:URLRequest = new URLRequest(xmlURL);
			urlLoader = new URLLoader();
			urlLoader.addEventListener(Event.COMPLETE, completeListener);
			urlLoader.load(urlRequest);
		}

		// event listener
		private function completeListener(e:Event):void {
			xmlData = new XML(urlLoader.data);
			xmlString = xmlData.toXMLString();
			// display XML in a text box on the stage
			addTextBox(xmlString);
		}
		
		// create text box to display XML on stage
		public function addTextBox(string:String):void {
			var string:String;
			var textBox:TextField = new TextField();
			var format:TextFormat = new TextFormat();
			format.font = "Arial";
			format.size = 15;
			format.color = 0x000000;

			textBox.text = string;
			textBox.setTextFormat(format);
			textBox.autoSize = TextFieldAutoSize.LEFT;
			
			addChild(textBox);
		}
	}
}</pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>84</wp:post_id>
<wp:post_date>2008-07-23 18:19:20</wp:post_date>
<wp:post_date_gmt>2008-07-24 01:19:20</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>loading-xml-in-actionscript-30</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1218295413</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Configure Debug Version of the Flash Player </title>
<link>http://bauhouse.wordpress.com/2009/01/16/configure-debug-version-of-the-flash-player/</link>
<pubDate>Fri, 16 Jan 2009 16:25:00 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=119</guid>
<description></description>
<content:encoded><![CDATA[As I don't always have access to the Adobe Flash IDE, I wanted to be able to view debug output for applications developed as pure ActionScript. Using the Flex 3 SDK, I can compile SWF files on the command line. Using the Debug version of the Flash Player, I can view trace output, as long as the Flash Player has been configured for debugging.

<a href="http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=logging_3.html">Configuring the Debug version of the Flash Player</a> requires adding a file in the right location for each operating system.

On the Mac:
<pre><code>/Library/Application Support/macromedia/mm.cfg</code></pre>
On Windows XP:
<pre><code>C:\Documents and Settings\user_name\mm.cfg</code></pre>
Adobe provides the following content for a sample mm.cfg file:
<pre><code>ErrorReportingEnable=1
TraceOutputFileEnable=1</code></pre>
On the Mac, I've found that the Console provides real-time feedback from the Flash Player when reading the flashlog.txt file. The file is located here:
<pre><code>/Users/user_name/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt</code></pre>
Or I can use Terminal with the following command to view real-time feedback:
<pre><code>cd ~/Library/Preferences/Macromedia/Flash\ Player/Logs
tail -f flashlog.txt</code></pre>
On Windows, I've found that I can accomplish the same thing when reading the flashlog.txt file by using Git Bash, which can be installed with <a href="http://code.google.com/p/msysgit/">Git on MSys</a> installer. The file is located here:
<pre><code>C:\Documents and Settings\user_name\Application Data\Macromedia\Flash Player\Logs\flashlog.txt</code></pre>
In Git Bash, I can run the following commands to get real-time trace output from the Flash Player.
<pre><code>cd ~/Application\ Data/Macromedia/Flash\ Player/Logs
tail -f flashlog.txt</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>119</wp:post_id>
<wp:post_date>2009-01-16 09:25:00</wp:post_date>
<wp:post_date_gmt>2009-01-16 16:25:00</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>configure-debug-version-of-the-flash-player</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232380452</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript 3 and the Model-View-Controller Design Pattern</title>
<link>http://bauhouse.wordpress.com/2009/01/16/actionscript-3-and-the-model-view-controller-design-pattern/</link>
<pubDate>Fri, 16 Jan 2009 16:42:42 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=125</guid>
<description></description>
<content:encoded><![CDATA[There are a number of print and online resources for Object-Oriented Programming with ActionScript using the Model-View-Controller (MVC) design pattern. A book has been written on the topic of <a href="http://www.oreilly.com/catalog/9780596528461/">ActionScript 3.0 Design Patterns</a> with an accompanying <a href="http://www.adobe.com/devnet/actionscript/articles/ora_as3_design_patterns.html">article on the Adobe Developer Connection</a> site. Two chapters are available as free downloads from the Adobe article:
<ul>
	<li><a class="icon pdf-file" href="http://www.adobe.com/devnet/actionscript/articles/ora_as3_design_patterns/ora_as3_design_patterns_ch02.pdf" target="_blank">Chapter 2: Factory method pattern</a> (PDF)</li>
	<li><a class="icon pdf-file" href="http://www.adobe.com/devnet/actionscript/articles/ora_as3_design_patterns/ora_as3_design_patterns_ch12.pdf" target="_blank">Chapter 12: Model-View-Controller pattern</a> (PDF)</li>
</ul>
The O'Reilly site offers <a href="http://examples.oreilly.com/9780596528461/">code examples</a> from the book for download.

Also of interest are a number of MVC frameworks available for implementing ActionScript applications:
<ul>
	<li><a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm">Cairngorm</a> microarchitecture for Flex and AIR</li>
	<li><a href="http://www.jadbox.com/flashmvc/">flashMVC</a></li>
	<li><a href="http://www.osflash.org/projects/jumpship">JumpShip Framework</a> for ActionScript, Flex, and Flash</li>
	<li><a href="http://mate.asfusion.com/">Mate</a></li>
	<li><a href="http://www.pranaframework.org/">Prana Framework</a></li>
	<li><a href="http://trac.puremvc.org/PureMVC_AS3">PureMVC ActionScript 3 Implementation</a></li>
	<li><a href="http://www.soundstep.com/blog/downloads/somaui/">Soma (AS3 MVC ActionScript Framework)</a></li>
	<li><span><a href="http://swizframework.googlecode.com/">Swiz</a>
</span></li>
</ul>
Colin Moock has written a chapter explaining the MVC concept in his book, <a href="http://www.oreilly.com/catalog/0596006527/" target="mm_window">Essential ActionScript 2.0</a>, and offers a free download of the chapter.
<ul>
	<li><a href="http://www.adobe.com/devnet/flash/articles/mv_controller/as2ess_ch18.pdf" target="mm_window">Chapter 18, Essential ActionScript 2.0</a> (PDF)</li>
</ul>
InsideRIA has a series that compares the differences between the most popular frameworks:
<ul>
	<li><a href="http://www.insideria.com/2008/12/frameworkquest-2008-introducti.html">FrameworkQuest 2008: Introduction</a></li>
	<li><a href="http://www.insideria.com/2008/12/frameworkquest-2008-part-2-get.html">FrameworkQuest 2008  Part 2: Get Control with Cairngorm</a></li>
	<li><a href="http://www.insideria.com/2008/12/frameworkquest-2008-part-3-fra.html">FrameworkQuest 2008 Part 3: Framework Agnostic Views with PureMVC</a></li>
	<li><a href="http://www.insideria.com/2008/12/frameworkquest-2008-part-4-ioc.html">FrameworkQuest 2008 Part 4: IoC With Swiz</a></li>
	<li><a href="http://www.insideria.com/2008/12/frameworkquest-2008-part-5-mat.html">FrameworkQuest 2008 Part 5: Mate, the Pure MXML Framework</a></li>
	<li><a href="http://www.insideria.com/2009/01/frameworkquest-2008-part-6-the.html">FrameworkQuest 2008 Part 6: The Exciting Conclusion</a></li>
</ul>
Other articles written on the subject:
<ul>
	<li><a href="http://www.as3dp.com/2007/12/27/minimalist-mvc-example-using-the-puremvc-framework/">Minimalist MVC example using the PureMVC Framework</a></li>
</ul>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>125</wp:post_id>
<wp:post_date>2009-01-16 09:42:42</wp:post_date>
<wp:post_date_gmt>2009-01-16 16:42:42</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-3-and-the-model-view-controller-design-pattern</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232259630</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>61</wp:comment_id>
<wp:comment_author><![CDATA[Jonathan]]></wp:comment_author>
<wp:comment_author_email>jadit2@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://www.jadbox.com</wp:comment_author_url>
<wp:comment_author_IP>99.51.239.192</wp:comment_author_IP>
<wp:comment_date>2009-01-17 08:28:57</wp:comment_date>
<wp:comment_date_gmt>2009-01-17 15:28:57</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Thanks for referencing flashMVC.

flashMVC is a Flash and Flex framework that is inspired by PureMVC but with fewer lines of code needed to build your application.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>ActionScript 3 SWF metadata tag</title>
<link>http://bauhouse.wordpress.com/2009/01/16/135/</link>
<pubDate>Fri, 16 Jan 2009 20:28:52 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=135</guid>
<description></description>
<content:encoded><![CDATA[Using MXMLC (the MXML and ActionScript 3 stand alone, command line compiler provided with the free <a href="http://www.adobe.com/products/flex/sdk/" target="_blank">Flex 3 SDK</a>) to compile your ActionScript 3 SWFs, you can use the SWF metadata tag to set common properties in the main document class for the application. The SWF metadata tag supports 4 properties
<ul>
	<li>width</li>
	<li>height</li>
	<li>frameRate</li>
	<li>backgroundColor</li>
</ul>

<pre><code>package {
    [SWF(width="800", height="600", frameRate="60", backgroundColor="#FFFFFF")]
    public class Main extends Sprite {

    }
}</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>135</wp:post_id>
<wp:post_date>2009-01-16 13:28:52</wp:post_date>
<wp:post_date_gmt>2009-01-16 20:28:52</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>135</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232148223</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>Configure Flex 3 SDK classpath</title>
<link>http://bauhouse.wordpress.com/2009/01/16/configure-flex-3-sdk-classpath/</link>
<pubDate>Sat, 17 Jan 2009 06:36:21 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=99</guid>
<description></description>
<content:encoded><![CDATA[The Adobe Flex 3 documentation describes <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=compiledeploy_3.html">Flex SDK Configuration</a>, and more specifically how to <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_5.html#207493">configure the source path and library path</a> for the <code>mxmlc</code> Flex Ant task used to compile Flash application files. I don't have Flex Builder, but I do have Flash CS3, so I can compile SWF files within the Flash IDE. However, I wanted to be able to build open source ActionScript without the requirement of a commercial product to compile Flash files, especially since I jump between Mac OS X and Windows XP as I am learning more. (Agus Santoso has blogged about <a href="http://asantoso.wordpress.com/2008/05/18/flex-3-sdk-command-line-development-with-example-on-linux/">Flex 3 sdk command line development with example on Linux</a>.)

I have the Flex 3 SDK installed at the root of my user directory in Mac OS X:
<pre><code>~/flex</code></pre>
The structure of my documents looks like this:
<pre><code>~/flex/classes
~/flex/data</code></pre>
If I try to compile an ActionScript file that imports classes that I have in the classes directory, I will receive the following error, indicating that the classes are not being found.
<pre><code>Error: A file found in a source-path 'AS3DModTutorial' must have the same name as the class definition inside the file 'AS3DmodTutorial'.</code></pre>
The configuration file for the mxmlc Flex Ant task is stored here:
<pre><code>~/flex/frameworks/flex-config.xml</code></pre>
To configure the classpath, uncomment the following text:
<pre><code>&lt;flex-config&gt;
   &lt;compiler&gt;
      ...
      &lt;!-- List of path elements that form the roots of ActionScript class hierarchies. --&gt;
      &lt;!-- not set --&gt;
      &lt;!--
      &lt;source-path&gt;
         &lt;path-element&gt;string&lt;/path-element&gt;
      &lt;/source-path&gt;
      --&gt;
      ...
   &lt;/compiler&gt;
&lt;/flex-config&gt;
</code></pre>
Change the XML to:
<pre><code>      &lt;source-path&gt;
         &lt;path-element&gt;/Users/stephen/flex/classes&lt;/path-element&gt;
      &lt;/source-path&gt;
</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>99</wp:post_id>
<wp:post_date>2009-01-16 23:36:21</wp:post_date>
<wp:post_date_gmt>2009-01-17 06:36:21</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>configure-flex-3-sdk-classpath</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232174195</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript 3D Libraries</title>
<link>http://bauhouse.wordpress.com/2009/01/16/actionscript-3d-libraries/</link>
<pubDate>Sat, 17 Jan 2009 06:42:39 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=113</guid>
<description></description>
<content:encoded><![CDATA[In researching the ability to make use of 3D ActionScript libraries with the Flex 3 SDK, I came across an <a href="http://www.everydayflash.com/blog/index.php/2009/01/06/the-as3dmod-tutorial/">AS3Dmod tutorial</a> created by   Bartek Drozdz of <a href="http://www.everydayflash.com/blog">Everyday Flash</a> that uses the <a href="http://blog.papervision3d.org/">PaperVision3D</a> library.

A list of the most popular 3D Flash engines include:
<ul>
	<li><a href="http://pv3d.org/">Papervision3D</a></li>
	<li><a href="http://www.away3d.com/">Away3d</a></li>
	<li><a href="http://www.flashsandy.org/">Sandy3d</a></li>
	<li><a href="http://alternativaplatform.com/en/alternativa3d/">Alternativa3d</a></li>
	<li><a href="http://five3d.mathieu-badimon.com/">FIVe3D</a></li>
</ul>
<strong><span style="font-weight:normal;"><a href="http://www.everydayflash.com/blog/index.php/2008/09/03/as3dmod/">AS3Dmod</a></span></strong>, a cross-engine 3d modifier library for Flash, was developed by Bartek Drozdz as a way to interact with several 3D Flash engines.

Another site that had a lot of examples of Papervision3D: <a href="http://blog.reyco1.com/eploring-a-papervision3d-class-movieassetparticlematerial/">reyco1.com</a>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>113</wp:post_id>
<wp:post_date>2009-01-16 23:42:39</wp:post_date>
<wp:post_date_gmt>2009-01-17 06:42:39</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-3d-libraries</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232259622</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript DragRotatePedal</title>
<link>http://bauhouse.wordpress.com/2009/01/21/actionscript-dragrotatepedal/</link>
<pubDate>Thu, 22 Jan 2009 00:38:32 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=145</guid>
<description></description>
<content:encoded><![CDATA[In an effort to duplicate the behaviour of <a href="http://www.senocular.com/flash/source.php?id=0.78">this Flash5 example</a> in ActionScript 3.0, I came up with the following, adapted for use with slightly different objects to simulate the rotation of a bike pedal:

<pre><code>package {

	import flash.display.*;
	import flash.events.*;
	import flash.utils.Timer;
	
	public class DragRotatePedal extends Sprite {
		
		// Main document class
		
		public var angle:Number;
		public var timer:Timer;

		public function DragRotatePedal() {
			// add event listeners
			crank.pedal.addEventListener(MouseEvent.MOUSE_DOWN, rotatePedal);
			
			// trace mouse position every second
			// debug();
		}
			
		function rotatePedal(e:MouseEvent):void {
			// trace("Mouse DOWN on pedal");
			
			stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
			stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
			
			function onMouseMove(e:MouseEvent):void {
				
				// get an angle to the mouse using atan2 (gets radians)
				angle = Math.atan2(mouseY - crank.y, mouseX - crank.x);
				
				// apply rotation to crank shaft by converting angle into degrees
				crank.rotation = angle * 180 / Math.PI;
				
				// rotate the pedal opposite to the crank shaft so it won't rotate along with it
				crank.pedal.rotation = -crank.rotation;
			}

			function onMouseUp(e:MouseEvent):void {
				//	trace("Mouse UP on pedal");
				stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
			}
		}

		function debug():void {
			timer = new Timer(1000);
			timer.addEventListener(TimerEvent.TIMER, traceOutput);
			timer.start();
		}
		
		function traceOutput(e:TimerEvent):void {
			trace("mouseX: " + mouseX);
			trace("mouseY: " + mouseY);
		}
	}
}
</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>145</wp:post_id>
<wp:post_date>2009-01-21 17:38:32</wp:post_date>
<wp:post_date_gmt>2009-01-22 00:38:32</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-dragrotatepedal</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232643067</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript Live Debug Class</title>
<link>http://bauhouse.wordpress.com/2009/01/22/actionscript-live-debug-class/</link>
<pubDate>Thu, 22 Jan 2009 07:10:35 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=148</guid>
<description></description>
<content:encoded><![CDATA[I wanted to have a way of tracking object attributes in real time within the Flash movie. As a test case, I wanted to track the position of the mouse using a dynamic text box. Here is the result:

<strong>Edit</strong>: This has been updated to include stage dimensions and to update on stage resize.

<pre><code>package {

	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
	import flash.utils.Timer;

	[SWF(width="800", height="600", backgroundColor="#ffffff", frameRate="30")]

	public class DebugData extends Sprite {

		// Instantiate stage variables
		public var sw:Number = stage.stageWidth;
		public var sh:Number = stage.stageHeight;

		// Instantiate text field variables
		public var txtFld_mouseX:TextField = new TextField();
		public var txtFld_mouseY:TextField = new TextField();
		public var txtFld_stageW:TextField = new TextField();
		public var txtFld_stageH:TextField = new TextField();

		// Instantiate text string variables
		public var txtStr_mouseX:String;
		public var txtStr_mouseY:String;
		public var txtStr_stageW:String;
		public var txtStr_stageH:String;

		public function DebugData() {
			// Turn scaling off and set alignment to top left
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			// Create text fields
			createTextField(txtFld_mouseX, "Mouse X: ");
			createTextField(txtFld_mouseY, "Mouse Y: ", 20, 50);
			createTextField(txtFld_stageW, "Stage Width: ", 20, 80);
			createTextField(txtFld_stageH, "Stage Height: ", 20, 110);

			// Add text fields to display list
			addChild(txtFld_mouseX);
			addChild(txtFld_mouseY);
			addChild(txtFld_stageW);
			addChild(txtFld_stageH);
			
			// Add an event listener to update debug text
			debug();
		}

		private function createTextField(txtFld:TextField, txtStr:String, txtFldX:int = 20, txtFldY:int = 20):void {
			var txtFmt:TextFormat = new TextFormat();

			// Format text
			txtFmt.font = "Helvetica";
			txtFmt.color = 0x333333;
			txtFmt.size = 14;
			txtFmt.leading = 6;
			txtFmt.leftMargin = txtFmt.rightMargin = 4;

			// Text field properties
			txtFld.x = txtFldX
			txtFld.y = txtFldY;
			txtFld.width = 200;
			txtFld.height = 20;
			txtFld.border = txtFld.background = true;
			txtFld.borderColor = 0xCCCCCC;
			txtFld.background = true;
			txtFld.backgroundColor = 0xEEEEEE;
			txtFld.defaultTextFormat = txtFmt;
			txtFld.text = txtStr;
		}

		private function debug():void {
			var timer:Timer = new Timer(1000/30);
			timer.addEventListener(TimerEvent.TIMER, traceOutput);
			timer.start();
		}

		private function traceOutput(e:TimerEvent):void {
			// Debug text
			txtStr_mouseX = "Mouse X: " + mouseX;
			txtStr_mouseY = "Mouse Y: " + mouseY;
			txtStr_stageW = "Stage Width: " + stage.stageWidth;
			txtStr_stageH = "Stage Height: " + stage.stageHeight;

			// Update text fields with debug text
			txtFld_mouseX.text = txtStr_mouseX;
			txtFld_mouseY.text = txtStr_mouseY;
			txtFld_stageW.text = txtStr_stageW;
			txtFld_stageH.text = txtStr_stageH;
		}
	}
}</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>148</wp:post_id>
<wp:post_date>2009-01-22 00:10:35</wp:post_date>
<wp:post_date_gmt>2009-01-22 07:10:35</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-live-debug-class</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1232652170</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript 3 Dynamic Fluid Grid</title>
<link>http://bauhouse.wordpress.com/2009/01/26/actionscript-3-dynamic-fluid-grid/</link>
<pubDate>Tue, 27 Jan 2009 00:44:29 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=152</guid>
<description></description>
<content:encoded><![CDATA[I wanted to figure out how to build a Cartesian coordinate grid system that would dynamically center and scale when the stage was resized. Here's what I came up with:

<pre><code>package {

	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
	import flash.utils.Timer;

	[SWF(width="630", height="415", backgroundColor="#000000", frameRate="30")]

	public class FluidGrid extends Sprite {

		// Instantiate stage variables
		public var sw:Number = stage.stageWidth;
		public var sh:Number = stage.stageHeight;

		// Draw grid lines
		public var grid:Sprite = new Sprite();
		public var horzLines:Sprite = new Sprite();
		public var vertLines:Sprite = new Sprite();
		public var gridLines:Array = new Array();
		public var spacing:Number = 24;
		public var lineColor:int = 0x333333;
		public var lineWeight:Number = 1;
		public var lineAlpha:Number = 0.5;
		public var lineHinting:Boolean = true;
		public var lineScale:String = "none";

		// Draw x-axis and y-axis
		public var xAxis:Sprite = new Sprite();
		public var yAxis:Sprite = new Sprite();
		public var xAxisColor:int = 0xeeeeee;
		public var yAxisColor:int = 0xeeeeee;

		public var hLine:Shape = new Shape();
		public var vLine:Shape = new Shape();

		public var numVertLines:int = Math.floor(sw/spacing);
		public var numHorzLines:int = Math.floor(sh/spacing);
		public var xOffset:Number = (Math.ceil(numHorzLines/2) * spacing) - (sw/2); 
		public var yOffset:Number = (Math.ceil(numVertLines/2) * spacing) - (sh/2); 
		
		// Reusable array index variable
		private var i:int;
		
		public function FluidGrid() {
			// Turn scaling off and set alignment to top left
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;

			// Draw grid lines
			drawGridLines();
			addChild(grid);
			grid.addChild(horzLines);
			grid.addChild(vertLines);

			// Draw x- and y-axes and add to display list
			drawAxes();

			// Add event listener to redraw grid on stage resize
			stage.addEventListener(Event.RESIZE, resizeListener);
			
			// Add debug data to display list
			var debug:DebugData = new DebugData(stage);
			debug.alpha = 0.2;
			addChild(debug);
		}

		private function resizeListener(e:Event):void {
			// Stage size at resize
			sh = stage.stageHeight;
			sw = stage.stageWidth;
			
			resizeAxes();
			redrawGridLines();
		}

		private function resizeAxes():void {
			// Scale x-axis and y-axis at stage resize
			yAxis.height = sh;
			yAxis.x = sw/2;
			xAxis.width = sw;
			xAxis.y = sh/2;
		}
		
		private function redrawGridLines():void {
			// Determine number of lines to draw
			numHorzLines = Math.floor(sh/spacing);
			numVertLines = Math.floor(sw/spacing);

			// Determine horizontal and vertical offsets
			xOffset = (sw/2) - (Math.ceil(numVertLines/2) * spacing); 
			yOffset = (sh/2) - (Math.ceil(numHorzLines/2) * spacing); 
			
			// Resize horizontal lines
			for (i = 0; i &lt; horzLines.numChildren; i++) {
				horzLines.getChildAt(i).width = sw;
				horzLines.getChildAt(i).y = i * spacing + yOffset;
			}

			// Resize vertical lines
			for (i = 0; i &lt; vertLines.numChildren; i++) {
				vertLines.getChildAt(i).height = sh;
				vertLines.getChildAt(i).x = i * spacing + xOffset;
			}

			// If number of existing lines is less than lines required to fill screen
			if (numHorzLines &gt; horzLines.numChildren) {
				// Draw additional horizontal lines
				for (i = horzLines.numChildren - 1; i &lt;= numHorzLines; i++) {
					gridLines[i] = new Shape();
					gridLines[i].name = "hLine" + i;
					drawHorzLine(gridLines[i]);
					gridLines[i].y = (i + 1) * spacing + yOffset;
				}
			}
			
			// If number of existing lines is less than lines required to fill screen
			if (numVertLines &gt; vertLines.numChildren) {
				// Draw additional vertical lines
				for (i = vertLines.numChildren - 1; i &lt;= numVertLines; i++) {
					gridLines[i] = new Shape();
					gridLines[i].name = "vLine" + i;
					drawVertLine(gridLines[i]);
					gridLines[i].x = (i + 1) * spacing + xOffset;
				}
			}
		}

		private function drawAxes():void {
			// Draw lines at center stage
			var yg:Graphics = yAxis.graphics;
			var xg:Graphics = xAxis.graphics;
			
			yg.lineStyle(lineWeight, yAxisColor, lineAlpha, lineHinting, lineScale);
			yg.moveTo(0,0);
			yg.lineTo(0,sh);
			yAxis.x = sw/2;

			xg.lineStyle(lineWeight, xAxisColor, lineAlpha, lineHinting, lineScale);
			xg.moveTo(0,0);
			xg.lineTo(sw,0);
			xAxis.y = sh/2;

			addChild(yAxis);
			addChild(xAxis);
		}

		private function drawHorzLine(horzLine:Shape):void {
			var hl:Graphics = horzLine.graphics;
			hl.lineStyle(lineWeight, lineColor, lineAlpha, lineHinting, lineScale);
			hl.moveTo(0,0);
			hl.lineTo(sw,0);
			horzLines.addChild(horzLine);
		}
		
		private function drawVertLine(vertLine:Shape):void {
			var vl:Graphics = vertLine.graphics;
			vl.lineStyle(lineWeight, lineColor, lineAlpha, lineHinting, lineScale);
			vl.moveTo(0,0);
			vl.lineTo(0,sh);
			vertLines.addChild(vertLine);
		}
		
		private function drawGridLines():void {
			// Set grid spacing and line style
			numHorzLines = Math.floor(sh/spacing);
			numVertLines = Math.floor(sw/spacing);

			xOffset = (sw/2) - (Math.ceil(numVertLines/2) * spacing); 
			yOffset = (sh/2) - (Math.ceil(numHorzLines/2) * spacing); 
			
			// Draw horizontal lines
			for (i = 0; i &lt;= numHorzLines; i++) {
				gridLines[i] = new Shape();
				gridLines[i].name = "hLine" + i;
				drawHorzLine(gridLines[i]);
				gridLines[i].y = i * spacing + yOffset;
			}
			
			// Draw vertical lines
			for (i = 0; i &lt;= numVertLines; i++) {
				gridLines[i] = new Shape();
				gridLines[i].name = "vLine" + i;
				drawVertLine(gridLines[i]);
				gridLines[i].x = i * spacing + xOffset;
			}
		}
	}
}</pre></code>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>152</wp:post_id>
<wp:post_date>2009-01-26 17:44:29</wp:post_date>
<wp:post_date_gmt>2009-01-27 00:44:29</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-3-dynamic-fluid-grid</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1233082423</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>106</wp:comment_id>
<wp:comment_author><![CDATA[Mike W]]></wp:comment_author>
<wp:comment_author_email>mwisniach@3rdcherry.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>75.92.140.106</wp:comment_author_IP>
<wp:comment_date>2009-03-09 11:36:59</wp:comment_date>
<wp:comment_date_gmt>2009-03-09 18:36:59</wp:comment_date_gmt>
<wp:comment_content><![CDATA[got a working sample of this? i get an error:

1046: Type was not found or was not a compile-time constant: DebugData.
1180: Call to a possibly undefined method DebugData.

source, line 63
var debug:DebugData = new DebugData(stage);]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>131</wp:comment_id>
<wp:comment_author><![CDATA[Shawn C]]></wp:comment_author>
<wp:comment_author_email>shawn.convey@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>80.71.144.38</wp:comment_author_IP>
<wp:comment_date>2009-04-24 08:23:15</wp:comment_date>
<wp:comment_date_gmt>2009-04-24 15:23:15</wp:comment_date_gmt>
<wp:comment_content><![CDATA[I too would love to see this in action.
when you have an example please let me know.
I think this is exactly what I am looking for.
thanks for sharing.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>132</wp:comment_id>
<wp:comment_author><![CDATA[Shawn C]]></wp:comment_author>
<wp:comment_author_email>shawn.convey@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>80.71.144.50</wp:comment_author_IP>
<wp:comment_date>2009-04-25 15:55:05</wp:comment_date>
<wp:comment_date_gmt>2009-04-25 22:55:05</wp:comment_date_gmt>
<wp:comment_content><![CDATA[I also get the errors described above.

if I comment it out it seems to work.
but as I must admit I am not so familiar the Cartesian coordinate grid system so I don't know if it is behaving correctly..
it seems pretty nice and super smooth 
just curious as to what you had in mind for a real world application for this. 
I have been trying to figure out the best way to position and scale items on my stage and have been looking at many tutorials and blogs. this looks great but I am having a hard time envisioning how to use it.
thanks again.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>ActionScript 3 Text Field Alpha</title>
<link>http://bauhouse.wordpress.com/2009/01/30/actionscript-3-text-field-alpha/</link>
<pubDate>Fri, 30 Jan 2009 20:33:37 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=158</guid>
<description></description>
<content:encoded><![CDATA[Looking through the documentation for applying alpha transparency and rotation to a text field, I realized I need to learn something about embedding fonts. Searching for a solution led me to a solution: <a href="http://www.rabidgadfly.com/index.php/2008/10/14/making-alpha-work-on-as3-dynamic-text-fields/">Making Alpha Work on AS3 Dynamic Text Fields</a>.

This doesn't work:
<pre><code>package {

	import flash.display.Sprite;
	import flash.text.TextField;

	public class TextAlpha extends Sprite {

		private var textFld:TextField = new TextField();

		public function TextAlpha() {
			textFld.text = "This is a text field";
			textFld.alpha = .2;
			addChild(textFld);
		}
	}
}</code></pre>
So, what to do? The Adobe Developer Connection resource may be the best place to start:
<ul>
	<li><a href="http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/#section6">Flash Quick Start: Embedding Fonts</a></li>
</ul>
But how can this be accomplished without Flash, using the Flex 3 SDK?
<ul>
	<li><a href="http://www.connectedpixel.com/blog/fonts/embedding">The Unbearable Strangeness of Embedding Fonts</a></li>
	<li><a href="http://polygeek.com/253_flex_fading-and-masking-with-device-fonts">Fading and masking with device fonts</a></li>
	<li><a title="Permanent Link to Making Alpha Work on AS3 Dynamic Text Fields" href="http://www.rabidgadfly.com/index.php/2008/10/14/making-alpha-work-on-as3-dynamic-text-fields/">Making Alpha Work on AS3 Dynamic Text Fields</a></li>
	<li><a href="http://bryanlangdon.com/blog/2007/03/22/loading-fonts-dynamically-in-actionscript-2-and-3/">Loading Fonts Dynamically in Actionscript 2 and 3</a></li>
	<li><a href="http://www.allflashwebsite.com/article/embedding-fonts-in-flash-cs3-the-good-way">Embedding Fonts in Flash CS3 the Good Way</a></li>
	<li><a href="http://www.communitymx.com/content/article.cfm?cid=67A61">Sharing Fonts in ActionScript 3.0 - Part 1: Creating a Font SWF</a></li>
	<li><a href="http://www.mokisystems.com/blog/flash-as3-loading-fonts/">Flash AS3 Loading Fonts</a></li>
	<li><a href="http://www.betriebsraum.de/blog/2007/06/22/runtime-font-loading-with-as3-flash-cs3-not-flex/">Runtime font loading with AS3 / Flash CS3 (not Flex!)</a></li>
</ul>
I was never able to successfully use the [Embed] metatag to compile a SWF file for embedding and loading fonts. I created a SWF with an embedded font in Flash CS3, then I created the following class to load the embedded font and display and transform the text using the loaded font. If no font is found, the error handing event displays the text in Arial with no transformation.

<pre><code>package {

	import flash.display.Sprite;
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.net.URLRequest;
	import flash.system.LoaderContext;
	import flash.text.Font;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFieldAutoSize;

	public class EnumerateFonts extends Sprite {

		private var t:TextField = new TextField();
		private var f:TextFormat = new TextFormat();
		private var font:Font;
		private var fontFile:String = "Helvetica.swf";

		public function EnumerateFonts() {

			// trace loaded fonts
			var fonts:Array = Font.enumerateFonts();

			// to list all available fonts, use the following instead:
			// var fonts:Array = Font.enumerateFonts(true);

			if (fonts.length == 0) {
				t.text="No fonts are loaded";
			} else {
				for (var x:uint=0; x&lt;fonts.length; x++) {

					font = fonts[x];
					trace(&quot;fontName : &quot; + font.fontName);
					trace(&quot;fontStyle : &quot; + font.fontStyle);
					trace(&quot;fontType : &quot; + font.fontType);
				}
			}

			//load font
			var loader:Loader = new Loader();

			loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoaded);

			loader.load(new URLRequest(fontFile));
		}

 	 	private function ioErrorHandler(event:IOErrorEvent):void {
 	 	 	trace(&quot;No fonts loaded: &quot; + event);
			fontNotLoaded();
 	 	 }

		private function onLoaded(event:Event):void {

			// trace loaded swf and fonts
			trace(&quot;SWF loaded: &quot; + fontFile);
			var fonts:Array = Font.enumerateFonts();
			for (var x:uint = 0; x &lt; fonts.length; x++) {

				font = fonts[x];
				trace(&quot;fontName : &quot; + font.fontName);
				trace(&quot;fontStyle : &quot; + font.fontStyle);
				trace(&quot;fontType : &quot; + font.fontType);

			}
			fontLoaded();
		}

		private function addTextField() {
			// default text field properties
			t.defaultTextFormat = f;
			t.x = 40;
			t.y = 40;
			t.background = true;
			t.autoSize = TextFieldAutoSize.LEFT;
			addChild(t);
		}
		
		private function fontLoaded() {
			// Text format
			f.font = font.fontName; // &quot;HelveticaNeueLT Std Lt&quot;
			f.size = 48;
			
			// Text field
			addTextField();
			t.text = &quot;The font is loaded:\n&quot;;
			t.text += font.fontName;
			t.embedFonts = true;
			t.alpha = .5;
			t.rotation = 10;
		}

		private function fontNotLoaded() {
			// Text format
			f.font = &quot;Arial&quot;;
			f.size = 24;

			// Text field
			addTextField();
 	 	 	t.text = &quot;No fonts loaded&quot; + &quot;\n&quot;;
			t.text += &quot;Default font: Arial&quot;;
		}
	}
}</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>158</wp:post_id>
<wp:post_date>2009-01-30 13:33:37</wp:post_date>
<wp:post_date_gmt>2009-01-30 20:33:37</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-3-text-field-alpha</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1233361858</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
	</item>
<item>
<title>ActionScript 3 Drag Drop Grid</title>
<link>http://bauhouse.wordpress.com/2009/02/06/actionscript-3-drag-drop-grid/</link>
<pubDate>Fri, 06 Feb 2009 19:04:26 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=168</guid>
<description></description>
<content:encoded><![CDATA[This code was an exercise in familiarizing myself with manipulating objects in the Display List. It involved taking the <a href="http://www.flashandmath.com/basic/dragdroptour/dd_tour1.html">Drag-and-Drop in Flash CS3 Tutorial</a> on dragging and dropping objects on a grid, and adding the ability to tween the movement of the objects from one grid point to another. It also provides a function to trace the default instance name, the name property, the child index and type of each display list object.   

<pre><code>package {

	/*
	Based on ActionScript 3 Tutorials by Doug Ensley and Barbara Kaskosz.
	www.flashandmath.com
	
	Adapted as an ActionScript class by Stephen Bau.
	www.domain7.com 
	*/

	import flash.display.DisplayObjectContainer;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.display.Graphics;
	import flash.display.Shape;
	import flash.geom.Point;
	import flash.events.MouseEvent;
	import flash.events.TimerEvent;
	import flash.filters.DropShadowFilter;
	import flash.text.TextField;
	import flash.utils.Timer;
	import fl.transitions.Tween;
	import fl.transitions.easing.*;
	
	[SWF(width="600", height="400", backgroundColor="0xFFFFFF", frameRate="30")]
	
	public class DragDropGrid extends Sprite {

		// Grid variables

		private var canvas:Sprite = new Sprite();
		private var canvasWidth:Number = 560;
		private var canvasHeight:Number = 360;
		private var grid:Number = 40;	 // Size of the grid and number of lattice points in each direction
		private var cols:Number = Math.ceil(canvasWidth/grid) - 1;
		private var rows:Number = Math.ceil(canvasHeight/grid) - 1;
		private var offset:Number = 20;
		
		
		// Object variables
		
		private var objects:Array = new Array();
		private var thisObject:Object;
		private var pointB:Point = new Point();

		public function DragDropGrid() {

			// Constructor

			setupGrid();
			addObjects();
			addListenersToObjects();
			traceObjects();
		}


		// Set up grid

		private function setupGrid() {

			canvas.graphics.beginFill(0xCCCCCC);
			canvas.graphics.drawRect(0,0,canvasWidth,canvasHeight);
			canvas.graphics.endFill();
			canvas.name = "canvas";
			this.addChild(canvas);
			 
			// Add a bunch of circles to represent lattice points

			canvas.graphics.beginFill(0x000000);
			for (var i:uint=1; i&lt;=rows; i++) {
				for (var j:uint=1; j&lt;=cols; j++) {
					canvas.graphics.drawCircle(j*grid,i*grid,0.5);
				}
			}
			canvas.graphics.endFill();
			canvas.x = 20;
			canvas.y = 20;
		}
		

		// Add objects to grid
		
		private function addObjects() {
			for (var row:uint = 1; row &lt;= rows; row++) {
				for (var col:uint = 1; col &lt;= cols; col++) {
					var index:uint = ((row - 1) * cols) + col;
					objects[index] = new Sprite();
					createObject(objects[index], index);
					objects[index].x = col*grid + offset;
					objects[index].y = row*grid + offset;
				}
			}
		}

		
		// Add event listeners to all variables in the objects array

		private function addListenersToObjects():void {
			stage.addEventListener(MouseEvent.MOUSE_UP, stopAll);
			for (var x:uint = 1; x &lt; objects.length; x++) {
				objects[x].addEventListener(MouseEvent.MOUSE_DOWN, startMoveObject);
			}
		}
		 
		 
		private function startMoveObject(e:MouseEvent):void {
			stage.addEventListener(MouseEvent.MOUSE_MOVE, moveObject);
			thisObject = e.target;
			e.target.parent.setChildIndex(e.target, e.target.parent.numChildren - 1);
		}
		 
		private function moveObject(e:MouseEvent):void {
			pointB.x = gridX(canvas.mouseX) + offset;
			pointB.y = gridY(canvas.mouseY) + offset;

			var objectMoveX:Tween;
			var objectMoveY:Tween;

			objectMoveX = new Tween(thisObject, "x", Strong.easeOut, thisObject.x, pointB.x, 0.5, true);
			objectMoveY = new Tween(thisObject, "y", Strong.easeOut, thisObject.y, pointB.y, 0.5, true);
		}

		private function stopAll(e:MouseEvent):void {
			stage.removeEventListener(MouseEvent.MOUSE_MOVE, moveObject);
		}

		// Create rectangle
		
		private function createObject(
				obj:Sprite,
				objIndex:uint,
				objWidth:Number = 28,
				objHeight:Number = 28,
				frameBorder:Number = 3
				):void {
			obj.graphics.beginFill(0x999999);
			obj.graphics.drawRect(-objWidth/2, -objHeight/2, objWidth, objHeight);
			obj.graphics.endFill();
			obj.name += " object-" + objIndex;
			addChild(obj);

			var frame:Sprite = new Sprite();
			var frameWidth:Number = objWidth + (2 * frameBorder);
			var frameHeight:Number = objHeight + (2 * frameBorder);
			
			frame.graphics.beginFill(0xFFFFFF);
			frame.graphics.drawRect(-frameWidth/2, -frameHeight/2, frameWidth, frameHeight);
			frame.graphics.drawRect(-objWidth/2, -objHeight/2, objWidth, objHeight);
			frame.graphics.endFill();
			frame.name += " frame-" + objIndex;
			obj.addChild(frame);

			
			var txtFld:TextField = new TextField();
			txtFld.text = String(objIndex);
			txtFld.name += " textfield-" + objIndex;
			// obj.addChild(txtFld);
		}
		
		// Trace Display List
		
		private function traceObjects():void {
			trace("Stage: Number of Children: " + stage.numChildren);
			trace("Object Description: " + stage.getChildAt(0).toString()); // DragDropShift
			traceDisplayList(stage);
		}
		
		private function traceDisplayList(container:DisplayObjectContainer, indentString:String = ""):void 
		{ 
			var child:DisplayObject;
			for (var i:uint=0; i &lt; container.numChildren; i++) 
			{ 
				child = container.getChildAt(i); 
				trace(indentString, child, child.name, "(depth: " + child.parent.getChildIndex(child) + ")");  
				if (container.getChildAt(i) is DisplayObjectContainer) 
				{ 
					traceDisplayList(DisplayObjectContainer(child), indentString + "    ") 
				} 
			} 
		}

		// Helper functions to stay within boundary AND snap to grid
		 
		private function gridX(inX:Number):Number {
			if (inX &gt; grid*cols) {
				return grid*cols;
			}
			 
			if (inX &lt; grid) {
				return grid;
			}
			 
			return grid*Math.round(inX/grid);
		}
			 
		private function gridY(inY:Number):Number {
			if (inY &gt; grid*rows) {
				return grid*rows;
			}
			 
			if (inY &lt; grid) {
				return grid;
			}
			 
			return grid*Math.round(inY/grid);
		}
	}		
}
</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>168</wp:post_id>
<wp:post_date>2009-02-06 12:04:26</wp:post_date>
<wp:post_date_gmt>2009-02-06 19:04:26</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-3-drag-drop-grid</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1235577782</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_searchme</wp:meta_key>
<wp:meta_value>1</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_encloseme</wp:meta_key>
<wp:meta_value>1</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_pingme</wp:meta_key>
<wp:meta_value>1</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>91</wp:comment_id>
<wp:comment_author><![CDATA[Hristo Simeonov]]></wp:comment_author>
<wp:comment_author_email>hsimeonov@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>79.100.162.132</wp:comment_author_IP>
<wp:comment_date>2009-02-18 03:03:50</wp:comment_date>
<wp:comment_date_gmt>2009-02-18 10:03:50</wp:comment_date_gmt>
<wp:comment_content><![CDATA[pointB.x = gridX(canvas.mouseX) + offset;
pointB.y = gridY(canvas.mouseY) + offset;

In the following lines you are using an undefined method or function gridX/gridY ?
Where does that come from ?]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>128</wp:comment_id>
<wp:comment_author><![CDATA[Rohan]]></wp:comment_author>
<wp:comment_author_email>viceversarohan@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://www.rohandeshpande.net</wp:comment_author_url>
<wp:comment_author_IP>124.170.116.92</wp:comment_author_IP>
<wp:comment_date>2009-04-02 16:28:04</wp:comment_date>
<wp:comment_date_gmt>2009-04-02 23:28:04</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Please can we see an example or demo of this code??]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>95</wp:comment_id>
<wp:comment_author><![CDATA[bauhouse]]></wp:comment_author>
<wp:comment_author_email>bauhouse@gmail.com</wp:comment_author_email>
<wp:comment_author_url>http://bauhouse.wordpress.com/</wp:comment_author_url>
<wp:comment_author_IP>174.1.64.181</wp:comment_author_IP>
<wp:comment_date>2009-02-25 08:46:11</wp:comment_date>
<wp:comment_date_gmt>2009-02-25 15:46:11</wp:comment_date_gmt>
<wp:comment_content><![CDATA[Hristo, you were right that something was missing from the posted code. WordPress was having some problems displaying the full code. It has been updated with the missing functions.]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>283474</wp:comment_user_id>
</wp:comment>
	</item>
<item>
<title>ActionScript 3 Dynamic Positioning</title>
<link>http://bauhouse.wordpress.com/2009/02/11/actionscript-3-dynamic-positioning/</link>
<pubDate>Wed, 11 Feb 2009 20:19:52 +0000</pubDate>
<dc:creator><![CDATA[bauhouse]]></dc:creator>

		<category><![CDATA[ActionScript]]></category>

		<category domain="category" nicename="actionscript"><![CDATA[ActionScript]]></category>

<guid isPermaLink="false">http://bauhouse.wordpress.com/?p=172</guid>
<description></description>
<content:encoded><![CDATA[I came across this wonderful resource of amazing ActionScript examples from Justin Windle at Soulwire. He had an example of <a href="http://blog.soulwire.co.uk/flash/actionscript-2/dynamic-positioning-part-one/">dynamic positioning</a> to achieve a full screen Flash layout. Unfortunately, it was ActionScript 2.0 and I am busy learning ActionScript 3.0. So, I've been practicing my skills by migrating Justin's code to AS3. Here's what I came up with:

<pre><code>package {

	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;

	public class AS3DynamicPositioning extends Sprite {

		private static const MARGIN:Number = 10;
		private static const BOX_SIZE:Number = 100;

		public function AS3DynamicPositioning() {

			// Setup the Stage properties
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;

			// Create some dummy boxes
			// This is only for the demonstration

			var boxes:Array = [
			["top", "0x9933cc"],
			["right", "0x00ff00"],
			["bottom", "0xff0000"],
			["left", "0x0099ff"],
			["center", "0xff3399"]];

			for (var i:uint = 0; i &lt; boxes.length; i++) {
				var newBox:Sprite;
				var boxColor:Number = boxes[i][1];

				var nameBadge:TextField = new TextField();
				var txtFmt:TextFormat = new TextFormat();
				var boxName:String = boxes[i][0];
				
				// newBox.createTextField ("test_txt", 1, 0, (boxSize / 2) - 10, boxSize, 10);

				txtFmt.align = TextFormatAlign.LEFT;
				txtFmt.color = 0xffffff;
				txtFmt.size = 16;
				txtFmt.font = "Arial";
				
				nameBadge.autoSize = TextFieldAutoSize.CENTER;
				nameBadge.width = BOX_SIZE;
				nameBadge.height = 24;
				nameBadge.x = BOX_SIZE / 2;
				nameBadge.y = BOX_SIZE / 2 - 12;
				nameBadge.defaultTextFormat = txtFmt;
				nameBadge.text = boxName;
				
				newBox = drawBox(BOX_SIZE, BOX_SIZE, boxColor);
				newBox.name = boxName;

				addChild(newBox);
				newBox.addChild(nameBadge);
				
			}
			
			setStage();
			traceObjects();

			function drawBox(width:Number, height:Number, color:Number):Sprite {
				// Call our function to set it all up right!
				var box:Sprite = new Sprite();
				box.graphics.beginFill(color);
				box.graphics.drawRect(0, 0, width, height);
				box.graphics.endFill();
				
				return box;
			}
			
			// Add an event listener
			stage.addEventListener(Event.RESIZE, stageListener);

			// When the Stage dimensions change...
			function stageListener(e:Event):void {
				// Call our function to reset stage positions
				setStage();
			}

			function setStage():void {
				var sw:Number = stage.stageWidth;
				var sh:Number = stage.stageHeight;
				
				var top:Sprite = Sprite(getChildByName("top"));
				var right:Sprite = Sprite(getChildByName("right"));
				var bottom:Sprite = Sprite(getChildByName("bottom"));
				var left:Sprite = Sprite(getChildByName("left"));
				var center:Sprite = Sprite(getChildByName("center"));

				// Rule for Top / Center alignment
				top.x = sw / 2 - top.width / 2;
				top.y = MARGIN;

				// Rule for Right / Middle alignment
				right.x = sw - (right.width + MARGIN);
				right.y = sh / 2 - right.height / 2;

				// Rule for Bottom / Center alignment
				bottom.x = sw / 2 - bottom.width / 2;
				bottom.y = sh - (bottom.height + MARGIN);

				// Rule for Left / Middle alignment
				left.x = MARGIN;
				left.y = sh / 2 - left.height / 2;

				// Rule for Center / Middle alignment
				center.x = sw / 2 - center.width / 2;
				center.y = sh / 2 - center.height / 2;
			}
		}

		private function traceObjects():void {
			trace("Stage: Number of Children: " + stage.numChildren);
			trace("Object Description: " + stage.getChildAt(0).toString());
			traceDisplayList(stage);
		}
		
		private function traceDisplayList(container:DisplayObjectContainer, indentString:String = ""):void 
		{ 
			var child:DisplayObject; 
			for (var i:uint=0; i &lt; container.numChildren; i++) 
			{ 
				child = container.getChildAt(i); 
				trace(indentString, child, child.name, "(depth: " + child.parent.getChildIndex(child) + ")");  
				if (container.getChildAt(i) is DisplayObjectContainer) 
				{ 
					traceDisplayList(DisplayObjectContainer(child), indentString + "    ") 
				} 
			} 
		}
	}
}</code></pre>
It also includes a couple extra functions to trace display objects. I was trying to figure out why I couldn't access children of the stage by name. I was getting this error:

<pre><code>Implicit coercion of a value with static type flash.display:DisplayObject to a possibly unrelated type flash.display:Sprite.</code></pre>]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>172</wp:post_id>
<wp:post_date>2009-02-11 13:19:52</wp:post_date>
<wp:post_date_gmt>2009-02-11 20:19:52</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>actionscript-3-dynamic-positioning</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>283474</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1234906960</wp:meta_value>
</wp:postmeta>
<wp:comment>
<wp:comment_id>117</wp:comment_id>
<wp:comment_author><![CDATA[Nireve]]></wp:comment_author>
<wp:comment_author_email>contact@ifirme.ro</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>81.12.136.154</wp:comment_author_IP>
<wp:comment_date>2009-03-17 02:58:56</wp:comment_date>
<wp:comment_date_gmt>2009-03-17 09:58:56</wp:comment_date_gmt>
<wp:comment_content><![CDATA[you need to includ all this action script in a main.as not in action-frame.

if you whant to use action-frame this is my way:

        import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;

function resizeHandler (e:Event):void
{

//and for top center

header.x = (stage.stageWidth /1)-(header.width /2);
header.y =0

//for buttom-center

buttom.x = (buttom.stage.stageWidth /2 ) - ( buttom.width /2 );
buttom.y= (buttom.stage.stageHeight ) - (buttom.Height );

//etc...

}

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener ( Event.Resize, resizeHandler);
stage.dispatchEvent (new Event (Event.RESIZE));

//end]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
<wp:comment>
<wp:comment_id>98</wp:comment_id>
<wp:comment_author><![CDATA[Bostjan]]></wp:comment_author>
<wp:comment_author_email>designandinvent@gmail.com</wp:comment_author_email>
<wp:comment_author_url></wp:comment_author_url>
<wp:comment_author_IP>93.103.158.53</wp:comment_author_IP>
<wp:comment_date>2009-03-01 15:45:48</wp:comment_date>
<wp:comment_date_gmt>2009-03-01 22:45:48</wp:comment_date_gmt>
<wp:comment_content><![CDATA[nice! but why do i get error: 1037:Packages cannot be nested.  package{]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type></wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id>0</wp:comment_user_id>
</wp:comment>
	</item>
</channel>
</rss>

