casual design – design is casual

interactive design for web, video games, and apps.

javascript and/or css is disabled.

January Quick Post

January 27th, 2009 by brooks

Type of thing: 3d flash 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.

  • mo ibz says:

    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

  • brooks says:

    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?

  • tarik says:

    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

  • JJJ says:

    Very helpful! Thank you!

  • Raimondas says:

    This worked for me. Thanks

  • Rob says:

    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!

  • Kristian says:

    Worked fine. Thanks!

  • Tom says:

    Thanks for putting this up here.

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

  • Working fantastic. Thanks a lot.

  • mozz says:

    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?

  • trash says:

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

  • Silouane says:

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

  • brian says:

    Thanks for posting this!

  • Lucious Ferona says:

    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::

  • Harald says:

    Thanks for posting, works like a charm!

  • DavidLee says:

    Thanks very much for this. Works perfectly.

  • Jari says:

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

  • William says:

    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.

  • Filthstift says:

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

  • Steffen says:

    Cheers for this!! Very usefull!

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

  • Necati says:

    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…

  • Necati says:

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

  • harv says:

    hey, thanks…

    works fine for me…

  • Lucky says:

    working perfectly, thankyou very much for doing this, much appreciated!

  • bside says:

    I’m using Flash CS4 on WindowsXP. Works great. thanks for helping a newbie

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    *

    *