I have been trying to understand Papervision 3d for the last couple of months, but all the examples are using collada or some elaborate functionality. I just wanted to test something simple. So I made a rotating box it rotates on the y axis.
Here how it goes in Flash CS3:
- add an image into the library
- set the linkage name to test.
- make sure width = 336 / height = 335 (for this example)
- and add this script
Actionscript:
-
import org.papervision3d.objects.*;
-
import org.papervision3d.materials.*;
-
import org.papervision3d.scenes.*;
-
import org.papervision3d.cameras.*;
-
-
var container:Sprite = new Sprite();
-
container.x = stage.stageWidth * 0.5;
-
container.y = stage.stageHeight * 0.5;
-
addChild(container);
-
-
var scene:Scene3D = new Scene3D(container);
-
var camera:Camera3D = new Camera3D(p, 10);
-
-
var bam:BitmapAssetMaterial = new BitmapAssetMaterial("test")
-
bam.oneSide = false;
-
bam.smooth = true;
-
-
var p:Cube = new Cube(bam, 336, 335, 335, 5, 5, 5);
-
-
scene.addChild(p);
-
-
scene.renderCamera(camera);
-
-
addEventListener(Event.ENTER_FRAME, onFrame);
-
-
function onFrame(event:Event):void
-
{
-
p.rotationX % 360 == 0 ? p.rotationX = 1 : p.rotationX += 1;
-
trace(p.rotationX)
-
//p.rotationY = stage.mouseY - (stage.stageHeight * 0.5);
-
-
scene.renderCamera(camera);
-
}
thats it
Last 5 posts in actionscript
- Using Flash Player 10 to produce Dynamic Musical Notes - May 20th, 2008
- Flash Player 10 Dynamic Sound Generation - May 20th, 2008
- How to compile and examples for Flash Player 10 or ASTRO BETA - May 16th, 2008
- How to use Bitmap and BitmapData in ActionScript 3 - v2 - April 23rd, 2008
- How to use Bitmap and BitmapData in ActionScript 3 - v1 - April 21st, 2008
Last 5 posts in as3
- Flash Player 10 Pure Flash Keyboard using SampleDataEvent - September 3rd, 2008
- Using Flash Player 10 to produce Dynamic Musical Notes - May 20th, 2008
- Flash Player 10 Dynamic Sound Generation - May 20th, 2008
- How to load Pixel Bender in Flash Player 10 - May 19th, 2008
- How to compile and examples for Flash Player 10 or ASTRO BETA - May 16th, 2008
Last 5 posts in flash
- Flash Player 10 Pure Flash Keyboard using SampleDataEvent - September 3rd, 2008
- Using Flash Player 10 to produce Dynamic Musical Notes - May 20th, 2008
- Flash Player 10 Dynamic Sound Generation - May 20th, 2008
- How to load Pixel Bender in Flash Player 10 - May 19th, 2008
- How to compile and examples for Flash Player 10 or ASTRO BETA - May 16th, 2008
Last 5 posts in flash CS3
- How to use Bitmap and BitmapData in ActionScript 3 - v2 - April 23rd, 2008
- How to use the FileSystem in AIR to find the users directory folders - March 1st, 2008
- Yahoo Maps ActionScript 3.0 Released - February 11th, 2008
- Update: Flash/Flex Tidbit #2 How to use Alpha Mask in Flash CS3 - January 8th, 2008
- Custom ColorPicker Component - How to extend a Flash CS3 Component Class - December 13th, 2007
Last 5 posts in papervision3D
- Papervision 3D 2.0 / Great White Example - December 26th, 2007
Josh Weatherspoon, A self-proclaimed millionaire who for some reason has to work as a Flash Developer, at Travelocity in Dallas(Southlake), TX.
Sorry, no comments yet.