Archive for the ‘Flex Builder 2’ Category

Racing Game: Moving into the 3rd Dimension

Friday, September 19th, 2008

So far, I’ve been working with Box2D’s debug mode, which provides a really quick way to test out your physics model to make sure it works, but doesn’t exactly look pretty. The next step was to make it look a bit better.
(more…)

Building a top down racing game Part 1

Tuesday, August 26th, 2008

Currently I’m developing a top down racing game in Flash for a client and thought I’d share the process that I’m going through. I’m not going to be posting any code, as it’s a client project, but I will try to explain how I worked various bits out so you can make your own :)
(more…)

Yahoo AS3 APIs Rock!

Wednesday, May 7th, 2008

Yeah, I know the world and his dog probably know about these already, but I just discovered them ok?!

They pretty much rock!

Get ‘em here

The one I was interested in (watch this space) was the weather API. I downloaded the package, fired up Flex Builder, stuck in a Weather Service instance, some event listeners and told it to get me some weather. Which it did! The whole process took me all of 3 minutes. That’s how it should be :)

Here’s the class I used (the code I used is for Brighton, UK, btw):

package
{
	import flash.display.Sprite;
	import com.yahoo.webapis.weather.*;
	import com.yahoo.webapis.weather.events.*;

	public class WeatherTest extends Sprite
	{
		private var _weatherService:WeatherService;

		public function WeatherTest()
		{
			super();

			_weatherService = new WeatherService();
			_weatherService.addEventListener(WeatherResultEvent.WEATHER_LOADED, onWeatherLoaded);
			_weatherService.addEventListener(WeatherErrorEvent.INVALID_LOCATION, onInvalidLocation);
			_weatherService.addEventListener(WeatherErrorEvent.XML_LOADING, onWeatherXMLError);

			//get all the weather!
			_weatherService.getWeather("UKXX0215", Units.ENGLISH_UNITS);
		}

		private function onWeatherLoaded(event:WeatherResultEvent):void
		{
			trace(event.data)
		}

		private function onInvalidLocation(event:WeatherErrorEvent):void
		{
			trace(event.data);
		}

		private function onWeatherXMLError(event:WeatherErrorEvent):void
		{
			trace(event.data);
		}
	}
}

Simple huh?

There’s also APIs for Answers, Maps, Search, Upcoming. They’re all well documented and logically laid out. Now get out there and start mashing up those feeds!

Embedding fonts in Flex Builder 2 Actionscript projects

Sunday, April 27th, 2008

After spending about 2 hours searching around the ‘net for a way to do this, all I could find were tips for embedding fonts in FB3, which is should be easy enough:

[Embed(source="/Library/Fonts/Arial", fontFamily="foo", mimeType="application/x-font")] public var bar:String;

This is because one of the things that has been added to FB3 (as far as I can tell) is a font manager system. However, I did run across a load of pages with bugs in this method (and you can only use truetype fonts) and it doesn’t help me with FB2.

Eventually I found a page that suggested that I could use fonts embedded in a swf. Embedding fonts from SWF files The relevant Embed tags for actionscript projects are about 3/4 the way down. This works in both FB2 and 3.

Essentially all you do is to drop a text field onto the stage, format it as normal and then publish. In FB put something like this (it doesn’t actually matter where – the embedded font is available throughout your app):

[Embed(source="/assets/swf/arialFontAsset.swf", fontName="Arial")]
var arialPlain:String;
[Embed(source="/assets/swf/arialFontAsset.swf", fontName="ArialBold" fontWeight="bold")]
var arialBold:String;

and Bob’s your embedded font uncle!