The current version of swftools in macports is 0.8.1 and for many cases it’s not good enough. In particular, for pdf2swf to generate swf files that are recognized as ASVM3 (i.e. Flash version 7+ I think, but do correct me if I’m wrong) you need swftools 0.9.0 or greater. Loading an external swf movie from within another is considerably more cumbersome if the virtual machine used in the two files versions differ.
You know you ran into the above VM mismatch error if your Flash logs are telling you something like this:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::AVM1Movie@1e3d9e01 to flash.display.MovieClip.
at com.elctech::PdfViewer/doneLoading()
The above error will show only if — only if — you have a debugger enabled flashplayer and logging enabled.
But as we said, the current macports version isn’t recent enough, so what to do? One option is to install everything from source, which for a package such as swftools entails a lot of dependencies. Another option is to install the current macports version anyway to get all the dependencies installed and then compile just the swftools package from source (http://www.swftools.org/download.html). Not ideal perhaps, but IMHO better.
If you get complaints about missing libraries towards the end of the ./configure phase, like this:
***************************************************
* The following headers/libraries are missing: jpeglib ungif jpeglib.h gif_lib.h
* Disabling pdf2swf tool...
* Disabling jpeg2swf tool...
* Disabling gif2swf tool...
***************************************************
… try this:
LDFLAGS="-L/opt/local/lib" CPPFLAGS="-I/opt/local/include -I/opt/local/include/lame" ./configure
…to make sure your macports installed libs/headers are picked up.
If/when make fail with something like:
ld: in ../libgfxswf.a, archive has no table of contents
collect2: ld returned 1 exit status
make[1]: *** [pdf2swf] Error 1
make: *** [all] Error 2
…run:
ranlib lib/*.a
make
…and the compile will continue. ’sudo make install’ to finish.
I’d love to write a more thorough explanation for the ranlib magic here, but I honestly don’t have a clue. It’s key not to run ‘make clean’ or ‘./configure’ again here, just the ranlib stuff and it will pick up where it got confused. Somehow. If anyone knows of a good resource for ranlib I’d love to dig further into this.

One Comment
Hi there, are you able to send me the binary of swftools 0.9? I’m having a lot of troubles compiling in Leopard.
Cheers.