Monday, September 22, 2008

Working with XML Namespaces in Flash

Today I was having some issues with parsing RSS/ATOM feeds in Flash. I forgot to factor in the fact that both use namespaces in the XML. Here's a simple block of code I used to handle the namespaces and parse the XML into Value Objects:

public function xmlLoaded(event:Event):void


trace("done loading");

theXML = XML(;

var ns:Namespace = theXML.namespace();

for each (var property:XML in theXML..item)


var atom:Namespace = property.namespace("atom");

var fVO:FeatureVO = new FeatureVO();

fVO.pubDate = property.pubDate;

fVO.updated = property.atom::updated;

fVO.category = property.category;

fVO.title = property.title;

fVO.summary = property.atom::summary; =;

fVO.enclosure = property.enclosure.@url;

fVO.xmlData = property;


trace("creating featureVO "+fVO.enclosure);


This is what the sample xml looked like from Blogger's RSS/ATOM feed:

<rss xmlns:atom='' xmlns:openSearch='' version='2.0'>



<lastBuildDate>Wed, 10 Sep 2008 19:07:53 +0000</lastBuildDate>




<managingEditor> (Erik Loehfelm)</managingEditor>






<guid isPermaLink='false'>,1999:blog-</guid>

<pubDate>Wed, 10 Sep 2008 19:07:00 +0000</pubDate>


<category domain=''>feature</category>

<title>People Singing</title>

<atom:summary>This is going to be a feature for the portal.v/atom:summary>


<enclosure type='image/jpeg' url='' length='0'/>

<author> (Erik Loehfelm)</author>




You can see the syntax to be used on the 2 lines highlighted in bold above. The first defines the namespace (atom) and the second shows how you access elements in the xml that have the atom namespace applied to them.

Tuesday, September 09, 2008

Photoshop Tip: Creating a dotted line

Here's another handy tip for Photoshop CS3. To create a dotted line in Photoshop:

  1. Select the Pencil or Brush tool from the tool menu
  2. Open the Brushes Palette from the Window menu
  3. Click on the 'Brush Tip Shape' item in the list on the left
  4. Adjust the 'Spacing' slider on the bottom of the right list
Photoshop_dottedLineThis will give you a dotted line while drawing with that particular pen/brush! Save it as a new brush if you'd like to use it again in the future. Adjust the 'Spacing' slider to give you the spread between the dots that you'd like. Playing with the adjustments on the other settings will allow you to create dashes, or other shapes along the same pattern. Easy peasy!

Photoshop Tip: Switching between open documents

As basic as this might seem, I always seem to forgot this little key combination to switch between open documents on the Mac.

Hold down Control:Shift and press Tab to cycle through the open documents in Photoshop.

Monday, September 08, 2008

Photoshop Tip: Color picking from anywhere

Here's a quick Photoshop CS3 tip to sample colors from applications other than Photoshop:

  1. With a Photoshop document open, click on the color swatch/color chooser in the tools pallette to open up the color picker.
  2. Mouse over the Photoshop document so that the eyedropper tool becomes visible.
  3. Left-click your mouse in the Photoshop document and continue to hold the mouse button down.
  4. You can now move your mouse outside of the Photoshop document and sample colors from anywhere on your computer screen!
  5. Release your mouse button when you have found the color you desire.
  6. The sampled color is now the selected color in your color picker! Be sure to have the "Only Web Colors" checkbox unchecked to allow a wider gamut of colors to be sampled.
Note: This will only sample colors from what is visible on your screen. It will not allow you to move windows to find colors on a 'buried' screen. Be sure to set up your workspace so that the open Photoshop document and whatever your color sample source will be are both visible.