Steering Behaviors For Autonomous Characters by Craig Reynolds
To get inspiration – no source!
Steering Behaviors For Autonomous Characters by Craig Reynolds
To get inspiration – no source!
I stumbled across Fredrick Bäcker’ UnicodeHexCreator AIR app while I was trying to localise an existing micro site. The trouble was embedding special characters in text fields. The solution is to compile an AS3 project with Flex SDK and embed the fonts within it.
package { import flash.display.Sprite; import flash.text.Font; public class FontList extends Sprite { // Embed system font with special characters --> Unicode ranges come from flash-unicode-table.xml (FLEXSDK/framworks) and UnicodeHexCreator [Embed(systemFont='Arial', fontName='_Arial', mimeType='application/x-font', unicodeRange="U+0061-U+0061,U+00BF-U+00BF,U+00C1-U+00C2,U+00C4-U+00C4,U+00C9-U+00C9,U+00CD-U+00CE,U+00D1-U+00D1,U+00D3-U+00D3,U+00D5-U+00D6,U+00DA-U+00DA,U+00DC-U+00DD,U+00E1-U+00E2,U+00E4-U+00E4,U+00E9-U+00E9,U+00ED-U+00EE,U+00F1-U+00F1,U+00F3-U+00F3,U+00F5-U+00F6,U+00FA-U+00FA,U+00FC-U+00FD,U+0102-U+0107,U+010C-U+010F,U+0118-U+011B,U+0141-U+0144,U+0147-U+0148,U+0158-U+015B,U+015E-U+0161,U+0163-U+0165,U+016E-U+016F,U+0179-U+017E,U+0410-U+042A,U+042C-U+042C,U+042E-U+044A,U+044C-U+044C,U+044E-U+044F,U+2260-U+2260,U+0020,U+0041-U+005A, U+0020,U+0061-U+007A, U+0030-U+0039,U+002E, U+0020-U+002F,U+003A-U+0040,U+005B-U+0060,U+007B-U+007E, U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E, U+0020,U+00A1-U+00FF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183, U+0100-U+01FF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183, U+0180-U+024F,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183, U+1E00-U+1EFF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183, U+0400-U+04CE,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183")] public static var _Arial:Class; public function FontList() { try { Font.registerFont(_Arial); } catch(e:Error) { trace("Font could not be loaded: _Arial"); } } } }
Load the created swf into the flash application and refer to the font through a new TextFormat
var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.Complete, fontsLoaded); function fontsLoaded(e:Event):void { var textField = new TextField(); textField.defaultTextFormat = new TextFormat("_Arial"); }
I was working on a xml parser today and encountered an issue with AS3 e4x attribute access and the switch structure. When I used item.@name within switch() there were no traces…
switch(item.@name) { case "share" : trace(item.@name); break; case "requestBrochure" : trace(item.@name); break; case "gallery" : trace(item.@name); break; }
…but when I assigned item.@name to a string it worked
var n:String = item.@name; switch(n) { case "share" : trace(item.@name); break; case "requestBrochure" : trace(item.@name); break; case "gallery" : trace(item.@name); break; }
item.@name is of type Object. It needs to be cast to a string.
String(item.@name) would do as well.
I have been playing with the Alternativa3D flash engine and spent quite some time figuring out how to handle interactivity. Here my solution:
Make sure view.interactive is set to true and add MouseEvent3D listeners to your 3d objects

I was recenlty working on a Flex project where I had an issue with StageAlign and StageScaleMode. I was not working properly until I found out that SDK 3.3 does have a stage align bug. Always use flex SDK 3.4 to work around.
Recently I worked on a project where I had to get the current timestamp from the server via php. I used the URLLoader Class to load the php script and catch the reponse in a handler.
A few hours later I found out that URLLoaderDataFormat.VARIABLES constant equals “variables” instead of “VARIABLES”.