Archive for general

propably my last post

hi there
i’m not maintaining this blog anymore.
you can find my recent work at finekost.com
bye, and thanks for the fish.

skate app attag.me

Our latest project is online. It’s a skate app currently for iPhone. More infos on attag.me
attag_me

Facebook App sourcecode

After beeing asked to publish my sourcecode for the ImageViewer app – here it is:

ImageViewer.zip

Notes:

  1. free to use
  2. no warranty
  3. no documentation
  4. osx zip (might cause package problems on win)

Embed Font workflow for flash as3

Martin, a good friend of mine, wrote a great blog post about font handling. He created an ant task which creates a font class / swf. What’s so cool about it? You can load fonts, and dont have to compile them every time, like [Embed ...] does.

I just had some trouble because I misspelled the font :O. Here is a loop which traces all the registered font names and solved my really stupid fault. And here is a example how you embed a registered font.

var fontLoader : Loader = new Loader();
var lInf : LoaderInfo = fontLoader.contentLoaderInfo;
lInf.addEventListener(Event.COMPLETE, onFontLoaded);
 
fontLoader.load(new URLRequest("Verdana.swf"));
 
function onFontLoaded(e : Event) : void 
{
 var tf : TextFormat = new TextFormat();
 tf.font = "FONTNAME";
 
 var tfield : TextField = new TextField();
 tfield.defaultTextFormat = tf;
 tfield.text = "Martin rocks!";
 
 var embeddedFonts : Array = Font.enumerateFonts(false);
 for(var i : Number = 0;i < embeddedFonts.length; i++)
 {
 var item : Font = embeddedFonts[i];
 trace(
 "[" + i + "] name:" + item.fontName + 
 ", style: " + item.fontStyle + 
 ", type: " + item.fontType
 );
 }
}

Handling Javascript in AS3

Handling Javascript calls via Actionscript 3 and ExternalInterface is cool. But in larger projects I’d like to have more controll over it. I spotted some things I didn’t like:

  1. Via addCallback(”func”, asFunc)  – You can register a function twice
  2. You can’t see how much js calls / callbacks you’ve registerd and how often the were called.

So I wrote a small Singleton class called JsHandler which can deal with that issues. You can register callBacks and do Javascript calls. Furthermore the class provides two methods which report about the calls. A basic Error Handling is implemnted too.

I know I did a nasty hack for the …rest params. But I think it’s a good Solution for the problem. Noone needs more than 6 params in a Javascript function ;)

Update:

Thanks to lab9 for the apply and unshift hint. Now you can push as much params as you want to. I updated the class. The trick is:

// function name (string)
args.unshift(jsFunctionName);
// ...args
ExternalInterface.call.apply(instance, args);

Here is the Democode:

JsHandler.addCallBack("sendToAs", fromJs);
// Second one causes error (same name)
JsHandler.addCallBack("sendToAs", fromJs);    
 
// returns the js return value as string
JsHandler.doCall("sendToJs2", "p1", "p2");
JsHandler.doCall("sendToJs2", "p1");
 
// returns array of all callbacks
JsHandler.allCallBacks();
 
// returns array with all methodnames
// and call amount
JsHandler.allCalls();

The class is just roughly tested and might contain errors. If you’ve any feedback or questions don’t hesitate to ask.

from now on: pagepointer

I decided to create a new category: impressive well executed sites I really really like. In short a category called “pagepointer”

I wordled myself.

In case you don’t know, checkout http://www.wordle.net/. I found it yesterday night reasearching something I can’t remember ;) So my lastfm account and blog looks like this. For lastfm wordle go here

wordle_music

wordle_blog

Huge Support for no-kids.org

Here’s a list of recent no-kids.org articles:

Thank you so much for twittering, blogging and supporting a good thing

« Older Entries