nathandemick.com

Compiling Papervision3D projects using mxmlc

There's a new competition going on at TIGsource called the "Cockpit Compo," wherein the design constraint is using a cockpit (or similar HUD). I doubt that I will have time to actually make an entry, but since I'm using Actionscript/Flash as my language/platform of choice now-a-days, I'm trying to look into a 3D library for Actionscript. Papervision3D seems like a favorite, so my next step is to find some tutorials and give 'em a shot. First, though, we have to figure out how to actually compile projects with Papervision.

1. Obtain the (free) Flex SDK, and put it somewhere in your system path. I wrote a post about setting up your Actionscript development environment; check it out if you haven't done this already.
2. Download the Papervision3D compiled library (.swc) or source (.as). It doesn't really matter which one, as I will explain how to use 'em both.
3a. If you got the .swc, put it in the same directory as your project files and rename it to 'papervision3d.swc'. When you compile, add the flag -include-libraries papervision3d.swc. That's it!
3b. If you got the .as source, extract it and put the '/org' directory in the same directory as your project files. Compile as normal, you don't need to feed mxmlc any extra flags.

To test out the process, get the "Simple HelloWorld Example for Papervision3D 2.0" .zip that's on the Papervision3D downloads page. Drop in the .swc or the /org directory (depending on what you downloaded), then compile using the instructions above. I got the .swc, put it in a subdirectory called '/libs' within the /src, and compiled with mxmlc Main.as -include-libraries libs/papervision3d.swc. If everything goes the way it should, a .swf will be produced that displays a crazily-textured spinning sphere.

· 2 comments


Comments

Pierre Nel wrote on :

Wonderful! I'm actually amazed it works - I've been under the impression that I _really_ need to be in Windows/OSX to do cool flash stuff. Time to dust off the Learning Actionscript 3.0 book again :) P

Bence wrote on :

I downloaded the latest Flex SDK (4.1), put it to the path, and then compile with the given sources: I tested with your the HelloWorld, and the examples on the Papervision download page (theese with swc), and everything was fine. But when I tried to compile the Papervision 3d plugin for Swift 3D (http://www.youtube.com/watch?v=KHCPtA78TzM), but I cannot run the resulted swf. This gives me a compiled one, but I would like to modify the sources [at least modify the path of a file], what is correct. But if I compile the project without any modification, the swf result do not run. I do not even get an error message, and do not know how could I get one. I get this result for every build, but it does not seem to affect anything. ERmain.as: Warning: This compilation unit did not have a factoryClass specified in Frame meta data to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option. I tried to run with -static-link-runtime-shared-libraries, with the same result. I tried with papervicion3d.swc, but with the same result (except the swf become 2 times bigger). Any tips?