Css in Flex


I had some issues today to change the background color of a button in Flex. The up-skin was set for the Button selector which meant setting the fill-colors property for the Button.special selector had no effect. Setting the up-skin to null was the only solution. This was easy to do in code with setStyle, but I wanted to do it in css. Writing null wasn’t quite enough. Apearently you need to use ClassReference(null). Hope this helps someone out.

Button {
  up-skin: Embed(source='img/example.png');
  up-skin: ClassReference(null);
  fill-alphas: 1.0, 1.0;
  fill-colors: #00FF00, #00FF00;

2M08 Silverlight


A hands-on workshop about Silverlight 2.0.

The many MacBooks that are available are probably set up for the Air session this afternoon. Our speaker informs us "We wont be using those", quickly followed by "Silverlight is a cross platform …".

Blend has loads of panels and properties. Nesting controls is possible. You can have a video inside a button.

Changes in Blend are detected in Visual studio. It helps to do a rebuild in Blend to make shure Visual studio isn’t working on an old version. Design view isn’t fully supported there yet. Double clicking on a button doesn’t get you a onClick handler yet.

Silverlight uses layout managers like Flex. Buttons have a content property which enables design and programming to be done separately. You can create some kind of color palette of Brush Resources in Blend which translates to SolidColorBrush elements in XAML. Visual studio has intellisence for XAML which makes it easier to type in there than in Blend. Fullscreen is supported but must be initiated by the user. Controls have a background and a border while other elements have a fill and a stroke. Blend has some glitches when setting properties on multiple controls. Switching to XAML code is the normal reaction to that. Not shure how designers will react to that. Hope these things are fixed when it goes out of beta.

The presentation was quite good, but I’m not sure weather I’m going to dump flash for this.

on Air Brussels


A long overdue overview of the on Air event in Brussels.

Read the rest of this entry »

Parsing plist files in asp with Microsoft.XMLDOM


Plist files are more and more ubiquitous. Apple uses them for its configuration files and we use them to describe exercise content. They aren’t very pleasant to read for humans, but that doesn’t mean computers dislike reading them. So I wrote a little javascript to parse a plist file to an object. Hope you like it.

Read the rest of this entry »

Silver Explorer


As most of my friends know, I’m partially colorblind. Most webdevelopers have no idea what their site looks like for someone like me. Thanks to the power of Adobe Air I’m now capable of letting you experience it firsthand.

Silver Explorer is a browser that lets you surf the net in grayscale.

Flash version 9.0.115 required

full-screen mode in Actionscript 2


How to use full-screen mode in Actionscript 2:

_root.btn_mc.onRelease = function(){
    if(Stage["displayState"] == "normal"){
        Stage["displayState"] = "fullScreen";
        Stage["displayState"] = "normal";

var listener:Object = {};
listener.onFullScreen = function(isFullscreen:Boolean){
        trace("entered full-screen mode");
        trace("exited full-screen mode");

Also see Exploring full-screen mode in Flash Player 9.



Rotating and scaling pictures in flash is easy. Just use _rotation, _xscale and _yscale. Except when you publish an swf for Flash Player 8 or newer. Every image you rotate or scale will become jagged. Very anoying. To remedy this you can either publish for Flash 7 or use a complicated loadBitmapSmoothed function that uses BitmapData.

When Flash Player 8.5 came out it introduced the forceSmoothing property. This property is also available in as2. Now all we need to do is set it to true when we load images. Don’t forget that this will have no effect in Flash players older than version 8.5!

It works quite well. In the example below you can clearly see the left picture is more jagged than the right one.

Read the rest of this entry »

pong0.5k, a game in 510bytes


Mr.doob created a 1k pong game in as3. Which made my fingers itch to do better. So here it is, in as2, less than half the filesize and the same functionality.

Read the rest of this entry »

AIR afterhours


I’ve been to a great afterhours session about AIR with Peter Elst. He’s writing a book on the subject so obviously there was lots he had to teach. He covered the windowing, file, dragdrop, sqlite and upgrade apis. This was a bring-your-own-laptop session so all the people present were experimenting with the code. We found a few oddities that you usually learn the hard way.

FileFilter behaves differently on mac and windows. On windows the extension parameter must start with an asterisk "*.html", on mac both "*.html" and ".html" seem to work.

Creating and manipulating NativeWindows works great, but adding flex components to the stage of a new NativeWindow doesn’t seem to work. Daniel Dura had a workaround for this, but that doesn’t seem to work anymore.

He gifted a few books at the end. ActionScript 3.0 Design Patterns is now mine. Thanks Peter!

Update: Peter has remembered how to use mx.core.Window as a a native window.

Vista speedup part 2


My previous post about vista speedup has been quite popular. But it doesn’t mention defragmenting your harddrive. This is such an obvious thing to do I forgot to mention it.

A fragmented drive is a slow drive. As a daily defragmenting tool I use JkDefrag. It is fast, efficient and does the job better than the default tool. Plus it is free and open source.

An even better tool is PerfectDisk 8. It isn’t free, but it can defragments your MFT. That is worth quite a lot.