ANT Compile – Java Heap Space

Can’t compile your project in Flash Builder with ANT because of a lack of memory? Do this :

Got to Run –> External Tools –> External Tools Configurations

Select your ANT task on the left hand side, then select the JRE tab. In the VM arguments box type this


Now run it again. Should work. Thanks.

AS3 + IPAC + Swana JLF-H5 Joystick

Back in 2007 I saw a talk by Craig Swann at Flash on the Beach about using an array of different house hold electrical objects (switches, keys and even wind chimes) to interact with Flash through an I-PAC USB keyboard encoder. I remember at the time thinking, woah, that looks complicated. However I recently bought myself an I-PAC and to my pleasant surprise it’s incredibly easy. It also gives me an excuse to go around hardware shops and buy all sorts of crap to hook up to my Flash Applications.

Continue reading

Problems embedding multiple members of the same font-family in Actionscript 3.0

I came across a problem the other day which it turns out is quite common. Normally when I am dealing with fonts in Actionscript I simple create a new font in the library and call that via the SWC in FDT. However, it turns out that if I make a font called Didot_Regular and Didot_Bold and tick the appropriate ‘Bold’ and ‘Regular’ boxes my compiled SWF fails to differentiate between the two.

The solution is create your fonts in a Class and compile this as a separate SWC or SWF. Here’s how :

package fonts {
	import flash.display.Sprite;

	 * @author Dan
	public class MyFonts extends Sprite {
		[Embed(source="/../fonts/Didot.ttc", fontName="Didot", fontStyle="normal", fontWeight="bold", mimeType="application/x-font-truetype")]
		public static var DidotBold		:	Class;
		[Embed(source="/../fonts/Didot.ttc", fontName="Didot", fontStyle="normal", fontWeight="normal", mimeType="application/x-font-truetype")]
		public static var Didot			:	Class;

Now compile this as a SWF or as a SWC library and then use the fonts as normal :

			var tf : TextFormat = new TextFormat();
			tf.font = new MyFonts_DidotBold().fontName;
			tf.bold = true;
			tf.size = 18;
			tf.color = 0xFFFFFF;

Google Maps API for Flash – Encoding a polyline.

If you’ve built an application using the Google Maps Api for Flash and taken advantage of the Directions class then the next thing you’ll want to do is store that route. You could store the LatLng of the first point and the end point and then re-submit a request for the same directions; or you could save the actual Polyline as an encoded string.

Continue reading

I think it’s a Sin

Dan’s started playing with Math.Sin and what’s more, he’s starting to get it. Mr Couchman (his maths teacher back at school) would be most pleased.

This is a simple thing I did. Took the Math.Sin(mymc._x)*time and then stuck a load of devided by randomness blah blah. In other words, just made it up. Then broke it a few times and figured out what did what. Put the rotation in, also following a sin curve, and made the object off centre so they all appear to be spiralling. But they’re not really. Nobody need know that.

Here’s a link to it online…

screen2.jpg screen1.jpg

Here’s the FLA.