Archive for the ‘Flash’ Category

Silverlight vs Flash Chess


After seeing the Silverlight Chess sample I immediately started work on a flash version. It needs a lot of optimizing, not a single variable type was set, so it’s not a very fair fight. Anyway … flash is about 10x faster than the ie7 js engine on my machine. But still a lot slower than silverlight.


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.


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.


FileZilla decrypt


Every now and then I get someone asking me for an ftp password. Mine have always been stored in FileZilla. I don’t know them by heart. There is no problem with this except that FileZilla encrypts them. Thank God decrypting FileZilla 2 passwords is easy. Here is some as2 code to accomplish it:


Papervision3D Component


If you ever need to use 3D in flash you can now use the Papervision3D Component. Thank you John Grden!

And Pierre Lepers created an event model for Papervision. Excellent work!

BlogReader in AsWing


The AsWing Blogreader was almost as easy to write as the Flex 2 BlogReader it mimics.

Right-click to view source.


Trace Output on Linux with Flash Player 9


Tracing on linux is hard. The official docs are wrong and multiple blogs contradict each other.


Flash player 9 for linux


Flash Player 9 For Linux (x86) has gone gold.

SOS Flash Log Tail


At work I use SOS in conjunction with the As2lib Logging API to log messages from flash. This works very well, except for the odd legacy program that uses the trace command for logging. This is where the flash debug player comes in handy.