Showing posts with label flex. Show all posts
Showing posts with label flex. Show all posts

Jun 8, 2011

Advanced advanced compiler options in FD

Ok, so I'm a nerd...
Sometimes I let the little things bug the hell out of me.

FlashDevelop is a great tool that lets you do whatever you like, or so I thought until I ran into some problems generating documentation through AsDoc. The solution involved adding namespaces as additional compiler options, something like this:



But I'm getting a bit ahead of myself. First I would like to talk about this neat-freakyness of mine: I like it when the projects are self contained, all the assets except the SDK are kept inside the project structure and as path independent as possible.

The options have to be specfied like:
-namespace http://ns.adobe.com/mxml/2009 C:\FlexSDK\frameworks\mxml-2009-manifest.xml 

It drove me totally nuts as I knew that the pre and postbuild command-builders used tokens like "$(FlexSDK)" or "$(ProjectDir)" with values for all the important stuff.



So I wrote this plugin that lets you define the paths using the tokens from the pre/posbuild-command builder in this fashion:
-namespace http://ns.adobe.com/mxml/2009 $(FlexSDK)\frameworks\mxml-2009-manifest.xml 

Download it and smack it into your /Plugins folder yesterday.

Written in C# .NET for versions of FlashDevelop > 3

May 9, 2010

Building classes with MXMLC

Since the recent post of the UTFCompressor, you might wonder what the hell it´s good for or, just how this will speed up the workprocess when exporting optimized fonts.

Ideally I would write an app that exports a flash font based on a font file directly. Bam you're done.

But then you would have no control over which glyphs are included, some Unicode fonts are extremely large (> 10 MB). This would then wreak havoc online if say you're doing an Asian website in flash, going about it coding in AS3. Every visitor has to load > 10 MB just to see the site.

You could just make shapes of all the texts on the website, but hey. Where's the fun in that?

Right now the AIR platform doesn't support execution of native processes, but that will soon change. For now you will have to make do with this short second phase of font generation.

The Flex SDK uses a binary to compile Actionscript 3. Senocular has a great tutorial on using this to compile your own swf:s.

http://www.senocular.com/flash/tutorials/as3withmxmlc/

1. Add your flexSDK/bin folder in the system path variable.

2. Make a .bat-file with contents similar to:

mxmlc %1 -output %1.swf -as3


3. In UTF Compressor there is this option

Use that to save a class and drop it onto your .bat-file. Now you should have a Flash font lying around somewhere.


If you don't have the Flex SDK, go ahead and download it here.

Go ahead and grab the UTF Compressor while you're at it.

Mar 17, 2010

Key.isDown(), where did you go?

Got a bit stumped when I realized that multi-keystroke handling was totally removed from AS3. The rabid game programmer in me worked up a little steam while it scurried about the internet looking for a solution. The alternative isn't acceptable, you can't make games without multiple buttons pressed at the same time.

Found a bunch of solutions to this problem, all of them over 100 lines in length. How hard can this problem be?

package Extrude.Utils 
{
 import flash.events.KeyboardEvent; 

 public class Keyhandler
 {
  protected static var _keys:Array = new Array(126);

  public static function onKeyDown(e:KeyboardEvent):void
  { _keys[e.keyCode] = true; }

  public static function onKeyUp(e:KeyboardEvent):void
  { _keys[e.keyCode] = false; }

  public static function isDown(key:uint):Boolean
  { return (_keys[key]); }
 }
}