January Quick Post

By brooks • Jan 27th, 2009 • Category: Lead Story

It is a new year and the first month is over. So far this year I have been headed into interactive space more and more. I made a little headway back into Flash and 3D, using ActionScript 3 and Papervision. I also want to take a minute to check out Loworks website. I liked reading the thinking by Haruki Higashi in the winter issue of Computer Arts Projects. It is a good year for change and continuation.

requires flash player

The animation above is from the basic example to test Papervision. The example on Google Code did not work, so here is the code I used (rocketclowns pointed me in the right direction).

package {

	import flash.display.Sprite;
	import flash.events.Event;

	import org.papervision3d.objects.primitives.Plane;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.view.BasicView;

	public class ExampleTransformationRotate extends BasicView {

		private var plane:Plane;

		public function ExampleTransformationRotate() {

			super();

			var material:ColorMaterial = new ColorMaterial();
			material.doubleSided = true;
			material.fillColor = 0xFF0000;
			material.fillAlpha = 1.0;

			plane = new Plane(material, 300, 300, 1, 1);

			scene.addChild(plane);

			stage.addEventListener(Event.ENTER_FRAME, render);

		} 

		private function render(event:Event):void {

			plane.rotationX += 4.35;
			plane.rotationY += 6.55;
			plane.rotationZ += 0.55;

			singleRender();

		}

	}

}

Let me know if this helps anybody.


Tagged as: , , ,

25 Responses »

  1. I just downloaded the papervision using SVN and tried this piece of coding because the google code one wasnt working. I have nothing coming up in my swf. It’s just a white background with no red plane. I’ve followed the google code steps of the document class using this as the coding in the .as file

    Any ideas why this is happeneing?

    Mo

  2. Mo

    1. Be sure that you are putting this code in a file called ExampleTransformationRotate.as

    2. In your fla, make sure the publish settings are set for ActionScript 3

    3. In the Properties panel where it says Document class, put in ExampleTransformationRotate

    4. Under Edit, Preferences, on the left select ActionScript, on the right select ActionScript 3.0 Settings

    This is the part that depends on where your Papervision is located -

    5. Click the + to add a new Classpath.

    6. Browse to PaperVision\as3\trunk\src and say OK

    7. Republish the fla.

    Does it work?

  3. hello there,
    thanks, that worked a treat for me, the only problem i found was i had to add the classpath to papervision under the publish settings too, FILE > PUBLISH SETTINGS>ACTIONSCRIPT3 SETTINGS, it doesn’t work for me if i just add the classpath under ‘preferences’ i’m using cs4

  4. good to know!

  5. Very helpful! Thank you!

  6. This worked for me. Thanks

  7. Hi mate,
    I am getting “1007: A super statement can be used only inside class instance constructors.”

    I am using the latest svn and cant believe how hard it is to get this pv3d s%&t going…
    Almost all examples and tutorials a tried around the web are not working for me.

    Keep it up!

  8. Worked fine. Thanks!

  9. Thanks for putting this up here.

    It’s seriously annoying that the test code supplied with the installation instructions doesn’t even work.

  10. Working fantastic. Thanks a lot.

  11. Hi, brooks!
    This works for me too.
    But how do you set the square position to be at the top left of the application window?

  12. YAY works! Thank you alot, that code at googlecode.com just confused me with its errors.

  13. Doesn’t seem to be a plane to me, but more a flying square isn’t it?

  14. Thanks for posting this!

  15. I managed to get it working with flex on ubuntu with the following code after I placed the Papervision3D_2.0.883.swc in the {flex sdk directory}/frameworks/libs folder hope it helps someone::

  16. Thanks for posting, works like a charm!

  17. Thanks very much for this. Works perfectly.

  18. Thanks for the example, worked very well. Now I have to start playing with papervision…..

  19. Thanks, this was pretty useful. Your code just popped nicely into a class and is pretty much my start for getting into Papervision. Thanks again.

  20. Thanks for this code. The papervision example indeed was not working properly. Thanks for this code. It works likea charm…

  21. Cheers for this!! Very usefull!

  22. For once I got something going right on the FIRST tutorial VM thanks!

  23. I get these errors:

    1017: The definition of base class BasicView was not found.
    5000: The class ‘ExampleTransformationRotate’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

    How come it works for some people and for some it doesn’t?

    I reverted from CS4 to CS3 for this…

  24. Okay, got it to work…
    Thanks for the code.

  25. hey, thanks…

    works fine for me…

Leave a Reply