SWF viewer
What does it take to build a simple SWF (Flash) based vector map viewer? (As opposed to plain html+javascript or java.)
Depends on what you mean by a "SWF-based map viewer".
There are two ways to think about using SWF with a mapserver. The first obvious way (to me) is that the imagemap portion of the page is generated as a SWF file, meaning that the map itself can be animated. For example, you can support very nice zoom and pan operations.
The second way is to use mapserver to generate static image files in png or jpeg format, and to use SWF in the user interface. That way you can support things like fancy rollover buttons.
An aside: there is actually a scripting language embedded in Flash called actionscript. Actionscript is just a subset of javascript (or both are subsets of ecmascript if you prefer). Therefore, if you are a happy javascript programmer you can quickly adapt your skills to actionscript.
To create the user interface you can build the page with Dreamweaver; or you could use the PHP SWF extension or the external Ming library for PHP, and write PHP code to generate the SWF page. Or you can combine them.
Since I don't have Dreamweaver access at the moment I am working with ming.
Ming build notes
I built ming as a loadable extension for PHP (which is easier than building a new version of php.) Current ming is 0.3beta1 and php is 4.4.0.
On my TSL 2.2 Linux system, I had to add the bison and libungif-devel rpm packages to get ming to compile. I had to install libungif on the target server.
Once I had the php module installed correctly I created this simple SWF example as a test. More test samples are on the PHP/SWF tests page.
"make install" does not correctly install the library. I did this by hand...
cp libming.so /usr/lib/libming.so.0.3beta1.0 cd /usr/lib ln -fs libming.so.0.3beta1.0 libming.so.0 ln -fs libming.so.0 libming.so.0
Then I copied the library to neptune from the build machine so that mapserver will be able to find it.
Mapserver build notes
Mapserver can generate SWF files directly, if you have compiled it with support for the ming library. So next I rebuilt mapserver with the added command line option to 'configure': --with-ming
There is an error in the mapserver source code! Oh no! MING_VERSION_03 needs to be defined for UNIX (is defined for MSC). (See http://lists.dmsolutions.ca/pipermail/mapserver-users/2004-May/018580.html)
Adding -DMING_VERSION_03 to the MING definition line in Makefile allows it to compile.
I revamped my City of Corvallis simple example yet again to generate SWF output instead of png. You can try it. Pretty exciting, huh? Since it looks exactly the same as PNG output, I mean. :-)
Links
I like the simple user interface on this server: http://www.downtownbethesda.com/
Layers turn on and off at different scales, there are basically no controls; just pan and zoom. Pan by dragging, and zoom with slider or scroll wheel.