Wednesday, March 18, 2009

Exploring MapQuest Flash API

I just started experimenting with the MapQuest Developer API for Flash CS3 (ActionScript 3). So far it's been an enjoyable project! I worked through some of the samples and experimented with many of the cool MapQuest features that are available in the free developer Flash extensions. I'm having fun making custom points of interest (POIs) on maps, zooming, scrolling, and icons. There are a couple of traps that I ran into when following the AS3 code in the Sample Scripts found in the MapQuest Developer Library.

All was going well until I tried to build the Geocode interface found in the samples. It took a while to realize the right login parameters, but the main bug that bit my example was the server name. The sample script points to a geocode access server, but the correct server is actually the free server! That took a while to troubleshoot.

I uploaded a working version of the Geocode Address interface.

I think I'll tinker with this API for a while and see what waves I can generate across the Pacific!

Aloha, Joe

Wednesday, March 11, 2009

Embedding Fonts in Flash

I'm working on a project that displays articles from an external XML file. I want the text to be displayed as HTML, so I'm applying an external cascading style sheet (CSS) to the text field. In the Flash .fla file, I added a new font and linked it for ActionScript. Everything seemed to be working fine, and normal text was appearing like I imaged it would with the appropriate styles.

The problem was, I couldn't seem to get bold <b> or italic <i> tags to render the text properly.

After some digging, I found that I needed to add another new font for bold, one more for italic, and yet another for bold-italic text!

To add a new font, open the Options menu in the Flash file's Library, then select New Font... Select a font from the dropdown menu, and give it a name, which you will use like a new Font class. Be sure to update the linkage for your new font so you can apply it in AS3. If you need a bold, add another new Font, but check the Bold checkbox. Likewise with italic. Then when you apply a style sheet, you'll get the text displayed the way you want!


Aloha, Joe

Saturday, March 7, 2009

Sound Spectrum Using Flash ActionScript 3.0

Working with the sound functions in Flash ActionScript 3.0, it took some work to understand the Sound, SoundMixer, SoundChannel, and SoundTransform classes. My goal was to use a sound object to animate other display objects. I found a few examples that applied sound spectrum functions, so I started by looking at Lee Brimelow's Sound Spectrum Display tutorial on his excellent Flash tutorials site, www.gotoandlearn.com.

I created a SpectrumTest class for manipulating the animation and sound object, which worked out well. Using an EnterFrame event handler, the function draws colored circles along a linear path representing frequency, and the size of the circles is derived from the values extraced from the SoundMixer's computeSpectrum function.

The first iteration displayed the animated objects in spectrum along a horizonal axis.



I decided to change the orientation of the spectrum along a vertical axis, so I modified the function. Additional controls include a play button and a volume slide bar. I also wanted to view the media load process, so I added a media progress bar along the top. You can view the Flash movie here: http://www.jazzairwaves.com/Flash/SpectrumTest/

This was a good learning experience for me, and didn't take too long to produce.

The song I used for this project is All Of Your Love by Aphek, an artist I enjoy listening to on www.acidplanet.com.


Download for this Flash project (song not included): SpectrumTest.zip


Aloha, Joe