Today I’ve been enjoying some of the free stuff the Internet “gives”.

Google Reader
I started my day reading on TechMeme about the updates that Google Reader has gone through. Just stunning as Richard MacManus puts it. I’m considering reading my RSS feeds exclusively in Google Reader, up to now I used Thunderbird for that, but there isn’t any thing keeping me from fully switching anymore. I already imported my Thunderbird OPML list into Google Reader. I love the import function, you can reach it by clicking “manage subscriptions”. But be advised, there might be no way back. 🙂 Time will tell whether I get stuck to Google Reader as my RSS aggregator… I remember sceptically importing my University class schedule into Google calendar, believing that I would only give it a try, I haven’t used any other calendar since….

BTW I liked seeing that Google points to wikipedia for further information on OPML, gives me some reassurance that I’m not the only-one putting trust in wikipedia. If the wikipedia defines things wrong, at least where all using the same definition. 🙂

OPML import in Google Reader

Today I was working on a Windows OS and needed a PHP editor. Normally I use Quanta Plus for KDE. But since Quanta Plus only works in Linux, I had to find a Windows compatible alternative for this job. Editors enough, but I was looking for a minimum set of functionality; syntax highlighting and the option to directly work on FTP files. Luckily I found tsWebEditor. tsWebEditor comes with excellent:

  • syntax highlighting
  • code completion
  • function hints
  • a code browser
  • … and much more directory listing
Today I found this directory listing script. Makes listing the contents of a folder a piece of cake, works real sweet. Here’s an example. Installing the script is just a matter of copying it into the directory where you want to use it. struck me with a real simple, maybe even cliche, quote “Giving is more important than taking …”. They’re explaining that they do an effort to share scripts with the community of web-developers as a return of the favor the community does so often for them. (Evoluted is using free scripts in their websites too.)

Giving is more important than taking…
I’ve been thinking about how to contribute something back to “the community” as well. I figured I could do my little share of sharing by writing a post on my blog giving credits to those websites and webservices that benefited me today. Is this generous of me? Well…., I’m a generous guy, I won’t deny that, but all this sharing and giving credits might have a ego-centric component as well, giving might be the new taking, chartreuse (BETA) does a good job at explaining with an example involving Paris Hilton why outward linking, linking, linking and linking could be of great benefit to all of us, and how it can create real value.

uncleunvoid asked me to help him construct a loop that generates TextFields that make use of an embedded font. I thought this should be easy (easy in a relative sense, building things in Flash is never easy) but I did not succeed on my first try. I’ve become accustomed to the fact that the obvious solutions often do not work and that questioning that is a useless waste of time. Finding solutions to your Flash problems is a process of non-rational trial en error testing. Today, through luck, my second attempt succeeded and here is the code that I put in the first frame of a empty .fla file;


var textFormat = new TextFormat();
textFormat.font = “MyEmbeddedFont”;

for(var i:Number = 0 ; i < 10 ; i++)

for(var j:Number = 0; j < 10; j++)

var textFieldName:String = “test “+i+”_”+j;
_root.createTextField(textFieldName, _root.getNextHighestDepth(), i*50, j*30, 50, 30);
_root[textFieldName].text = textFieldName;
_root[textFieldName].embedFonts = true;



Now, the crucial thing to make this work is to have an embedded font that is “exported for actionscript” with the identifier “MyEmbeddedFont”.

If you embedded and exported your font the right way, your result should look similar to this. (I used a “Georgia” font).


Hope this helps! If not let me know.

Yesterday I did some experiments with trying to control the appearance of a pop-up window “created in Flash”. Well I started out knowing that it’s impossible to directly control the appearance of browser windows created from Flash, but I had some hope that calling javascript from Flash would do the trick. I soon found out that there’s the fscommand function to enable the programmer to call javascript functions defined in the page that embeds the Flash movie and I managed to implement what I wished for. Here’s my implementation using fscommand, I think it’s interesting enough to share with you because being able to call javascript from inside a Flash movie must have some powerfull applications. But do not copy this code if you want to use it for opening pop-up windows, read on, because I’ve got better tips for doing that particular thing.

Here is the JavaScript code that you put into your HTML <head>

<script type=”text/javascript”>
var isInternetExplorer = navigator.appName.indexOf(“Microsoft”) != -1;
// Handle all the FSCommand messages in a Flash movie.
function StudioRoosegaarde_DoFSCommand(command, args) {
if(command == “openURL”),”_blank”,”toolbar=0, location=0, directories=0, status=0, scrollbars=0, menubar=0″);
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf(“Microsoft”) != -1 && navigator.userAgent.indexOf(“Windows”) != -1 && navigator.userAgent.indexOf(“Windows 3.1”) == -1) {
document.write(‘<script language=\”VBScript\”\>\n’);
document.write(‘On Error Resume Next\n’);
document.write(‘Sub StudioRoosegaarde_FSCommand(ByVal command, ByVal args)\n’);
document.write(‘ Call StudioRoosegaarde_DoFSCommand(command, args)\n’);
document.write(‘End Sub\n’);

But you should replace the occurrences of StudioRoosegaarde with your Movie id/name. And if you want to play save, choose “Flash with FSCommand” in the HTML settings of the Flash publish settings dialog, and the right code will be generated for you.


Your ActionScript code should look similar to this.

** openURL
function openURL(earl:String)

So this worked for me and was way cooler then having popups open in windows surrounded by toolbars, but I wasn’t completely happy yet. After some testing in different browser (Really important in web-development!) I discovered some oddities with versions of FireFox. With FireFox 2.0b2 the movie calling the JavaScript would stall. Unacceptable!

Today I discovered a Technote on Adobe’s website that summarizes three ways to “create” a pop-up windows from Flash. Two of them I had considered before, but the middle one “geturljs” was new for me. The article states that this solution is “simple and consistent”. This technote put me on the right track to finding what I think is the best possible solution. This article on that I found using Google goes into the details of the solution. They even provide you with a link to an application that can generate the required actionscript and javascript code for you based on your particular parameters!

Here’s the code that works for me!

** openURL
function openURL(earl:String,width:Number,height:Number)
getURL (“‘”+earl+”‘, ‘newWin’, ‘width=”+width+”px, height=”+height+”px left=0, top=0, toolbar=No, location=No, scrollbars=No, status=No, r
esizable=No, fullscreen=No’); NewWindow.focus(); void(0);”);

If you’ve used Flash MovieClips events onRollOver, onRollOut, onRelease, onReleaseOutside or onPress you’ve probably encountered the annoying little Flash shortcoming, that you can’t define mouse event-handlers on MovieClips contained inside MovieClips that have a mouse event defined.

Suppose you have something like this:

this.onRelease = doSomething;
var childMC:MovieClip = this[“childMC”];
//Add some code to put something inside childMC
childMC.onRollOver = doSomethingElse;

The code in the function doSomethingElse will never be reached, because all mouse events are “caught” by childMC’s parent MovieClip.

A workaround that I use is to check in the parent functions whether the events apply to children.

Here’s an example for the onRelease event:

this.onRelease = function()

if (childMC.hitTest(_root._xmouse, _root._ymouse, true)) {




The MovieClip function hitTest is used to test whether the mouse is hovering above the childMC when released. hitTest takes as arguments the x and y coordinates of the mouse relative to the _root MovieClip and a boolean that specifies whether to do the hitTest using the actual MovieClip shape (true) or just it’s bounding box (false).


Sometimes you may want to base the logic in a mouse handling event on data that’s stored in another MovieClip, of course you can expose the decisions variables by making them public variables and accessing them through some relative path like _parent.var1 or this.childMC.var1 but a cleaner solution might be using Flash delegate creator available in Flash 8 professional. I learned how to use it through this Delegate tutorial. With delegates you can define mouse event handlers that execute in a object scope other then the MovieClip object scope on which they are defined! This how I used it for example. I had a ‘parent’ MovieClip showing a JPG image. In the MovieClip was ‘child’ MovieClip called zoomer, that when pressed should open a new browser window containing a high-res version of the JPG. I sensed that it would be better program design to have the knowledge about the image low-res and high-res version in the ‘parent’ MovieClip. Without use of a Delegate I should have either copied the knowledge of the high-res JPG to the child MovieClip or exposed that knowledge through the parents public interface. In my humble opinion the delegate approach is the cleanest, really leaving all the data and logic concerning JPG’s in the parent MovieClip.

Here’s how I used the delegate functionality:

import mx.utils.Delegate;
zoomer.onRelease = zoomer.onReleaseOutside = Delegate.create(this, handleOnRelease);

It’s a magical world

September 13, 2006

Sylvia and me made some changes to our interior, to give our books a better and more prominent place in the house. We used to have two big bookcases packed to gather in a little cabinet of our living room. This looked like this:

Old Interior

That arrangement was allright, but we could do better. Check this out! Using the space in the living room to place our bookcases next to each other really makes a much more powerfull impression. I had to put some pressure on Sylvia to get this done, but I really think it’s much better.

New Interior

And at the same time we bettered the cabinet to. Monday Daan Roosegaarde came and delivered us a custom made variant, or a ‘drunken bookcase‘ as one of my friends calls it. 🙂 I love the variant. [Disclosure: I work for Daan and might say nice thing to flatter him, but really I love this variant.] I spend the entire first day staring agape with wonder at it every half hour. You do not yet see it on this picture, but we now filled the variant with the kind of books that you can easily read when you have a little time. Some comics and some short story books. All this cabinet now needs is a Fat Boy to relax in it, a better lamp and something on the walls.

New Interior

Okay about that something on the wall. I was thinking about this; I want to paint a giant copy of this Calvin and Hobbes cover;

It's a magical world

And this is really ambitious because I never really painted anything. But I like this picture so much. In my giant replica of it (2m x 1m) I would make the most of the picture plain white, I would place a few small bare trees in upper left and Calvin and Hobbes happily moving through the snow in lower right. (I might put in the words “It’s a magical world” as well, but I’m not sure yet.) A magical image if you ask me.

So where do I start? What materials should I use? I will start by asking Sylvia, she’s the creative type, she has experiences with this sort of stuff, but at least she knows who to ask. I will keep you update on this project. Share your thoughts with me, if you have suggestions on how to tackle this.

Today I accidentally found a website I wished I would have known before: This reference look-up service brings most web-related programming API’s in one place. Awesome! It works really great. It has a tree view on all the API’s I could wish for. The API’s include:

  • HTML
  • Cascading Style Sheets (CSS)
  • JavaScript / HTML DOM
  • XML
  • C / C++ / Standard Template Library
  • PHP
  • Ruby / Rails
  • Perl
  • MySQL
  • PostgreSQL
  • ActionScript
  • Coldfusion
  • Java
  • Apache Ant
  • DITA
  • … and the website promises there’s even more to come.

All API’s are up to date because they are not stored on but instead the site is constructed out of references to the original API sources. For example w3 for the HTML reference and Adobe for the ActionScript reference.

Damn this is great. If only someone had told me of it’s existence. Beats having multiple browser windows and PDF’s open. I really feel like I’ve been missing out on something really important. This will surely increase my productivity in webdevelopment!

Here is again a post in a series of posts documenting Flash and ActionScript behaviours I wish I had known about before finding it out the hard way, that is finding it out after a long time of trials and errors. Today I was trying to adjust the alignment of htmlText insinde a Flash TextField. Since the TextField has no align property by itself, I figured that using a TextFormat object and setting it’s align property would do the trick. I was wrong.

This was how I tried to align the htmlText in my TextField;

var myTextFormat:TextFormat = new TextFormat();
myTextFormat.align = “right”;

But for reasons that are unclear to me, this does not work. After long research I found a way that does work. It’s by using the TextField.autoSize property. “autoSize” is a name that in my humble opinion doesn’t convey much of it’s purpose. But here is what Adobe says it does. In a nutshell, the autoSize property helps you set alignment and resizing behaviour in one statement. To say autoSize=”right” is equal to instructing the TextField to align it’s text to the right and re-size the TextField to the left if needed. So here is how I used it;

myTextField.autoSize = “right”;

🙂 Piece of cake once you know it.