First install some deps:

 sudo apt-get install libxaw6-dev python-tk python2.3-pygame

Note I believe newer versions of pyvnc2swf no longer need ming so you may want to try skipping this step!

Next get the latest sources for the ming library and build it e.g.:

 cd ~/installers
 tar xvfj ~/installers/ming-0.3beta1.tar.bz2
 cd ming-0.3beta1/
 make

Now manually copy the lib into /usr/local/lib dir and register it with your sytem (make sure /usr/local/lib is in your /etc/ld.so.conf file first):

 sudo cp libming.so /usr/local/lib/
 sudo ldconfig

Now download pynvc2swf and unpack it:

 cd ~/src
 tar xvfz ~/installers/pyvnc2swf-0.6.4.tar.gz
 cd pyvnc2swf-0.6.4/
 chmod +x vnc2swf.py
 ./vnc2swf.py

Short version:

 sudo apt-get install libxaw7-dev vnc4server
 cd ~/installers
 wget http://www.unixuser.org/~euske/vnc2swf/pyvnc2swf-0.6.4.tar.gz
 cd ~
 tar xvfz ~/installers/pyvnc2swf-0.6.4.tar.gz
 cd pyvnc2swf-0.6.4

More info

You can also check out x11vnc if you want to record the currently active session. I prefer the second user approach.

I created a separate user with a really minimal xfce based desktop for the recording desktop. Start a vncserver session once as that user:

 vncserver -depth 16 -geometry 800x600

It will now have created any neccessary ~/.vnc/ skeleton files. Now kill the vncserver session again:

 vncserver -kill :1  

Now edit the ~/.vnc/xstartup file and comment out the default win manager and replace with startkde as shown below.

 #!/bin/sh
 [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
 xsetroot -solid grey
 vncconfig -iconic &
 x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
 #x-window-manager &
 # For kde session..
 #startkde &
 # For xfce session...
 exec xfce4-session&

Good, now next time you start a vncserver, kde will be started. Start the server again (you should still be logged in as your 'special' vnc user all this time...

 vncserver -depth 16 -geometry 800x600

Now back in your normal user account....

Now to prepare the desktop, login using krdc (the kde remote desktop client) and go in there and prune out any cruf from the menus, set the desktop background to a solid color and get rid of unneeded stuff from the panel.When you are ready run pyvnc2swf in your local (non vnc session)

 python vnc2swf.py

When you are done, just press stop in the small pyvnc2swf window

Viewing the swf file

You can open the swf straight from your browser if you like (it must have flash support), but probably the quality will be really bad! SO rather create a simple web page as shown below and voila! the quality will be excellent! Latest pyvnc2swf does this for you automatically now. Note pyvnc hard codes the paths so you will want to edit it and remove the directory path probably. Here is a sample.

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
    <body>
        <embed src="demo.swf" width="800" height="600" 
        type="application/x-shockwave-flash" loop=false>
        </embed>
    </body>
 </html>

Have fun!