Sorry for putting this up so late. This code is only used to arrange the items on the stage. Much work and re-working will need to be done to even start to achieve the effect of the ecodazoo website. Anyways, perhaps this will get someones brain moving in the right direction and help lead us in the path to re-creating this effect fully. As soon as I get some free time I will post a version that is a true popup book in papervision.
If anyone gets a chance sooner to do some cool things with the code please shoot me an email or a blog post and I would love to share it, with myself and with everyone else. ![]()
Don't forget the other code you will need to compile:
2) Tweener
-
package {
-
import caurina.transitions.Tweener;
-
import org.papervision3d.cameras.FreeCamera3D;
-
import org.papervision3d.core.data.qTree.QuadTree;
-
import org.papervision3d.objects.DisplayObject3D;
-
import com.foomonger.utils.Later;
-
import flash.display.*;
-
import flash.events.Event;
-
import flash.events.MouseEvent;
-
import org.papervision3d.cameras.Camera3D;
-
import org.papervision3d.materials.ColorMaterial;
-
import org.papervision3d.materials.MovieMaterial;
-
import org.papervision3d.objects.primitives.Cube;
-
import org.papervision3d.objects.primitives.Plane;
-
import org.papervision3d.render.BasicRenderEngine;
-
import org.papervision3d.scenes.Scene3D;
-
import org.papervision3d.view.Viewport3D;
-
public class Main extends Sprite
-
{
-
private var __camera :FreeCamera3D;
-
private var __scene :Scene3D;
-
private var __viewport :Viewport3D;
-
private var __renderer :BasicRenderEngine;
-
private var __width :Number;
-
private var __height :Number;
-
private var __background :Shape;
-
protected var __wallLeft
isplayObject; -
protected var __wallRight
isplayObject; -
protected var __wallBack
isplayObject; -
protected var __floor :DisplayObject;
-
protected var __tree
isplayObject; -
protected var __monster :DisplayObject;
-
protected var __moveMatWallLeft :MovieMaterial;
-
protected var __moveMatRightWall :MovieMaterial;
-
protected var __moveMatWallBack :MovieMaterial;
-
protected var __moveMatFloor :MovieMaterial;
-
protected var __moveMatTree :MovieMaterial;
-
protected var __moveMatMonster :MovieMaterial;
-
protected var __plane_wallLeft
lane; -
protected var __plane_rightWall
lane; -
protected var __plane_wallBack
lane; -
protected var __floorPlane :Plane;
-
protected var __treePlane
lane; -
protected var __monsterPlane
lane; -
protected var __rotation :Number;
-
public function Main():void
-
{
-
init();
-
}
-
protected function init():void
-
{
-
__rotation = 0;
-
setDefaultWidthHeight();
-
createChildren();
-
initPapervision();
-
initMaterials();
-
initObjects();
-
initEvents();
-
}
-
protected function setDefaultWidthHeight():void
-
{
-
__width = 1000;
-
__height = 600;
-
}
-
protected function initPapervision():void
-
{
-
__scene = new Scene3D();
-
__camera = new FreeCamera3D();
-
__camera.zoom = 11;
-
__camera.z = -2000;
-
__camera.y = 20;
-
__viewport = new Viewport3D(__width,__height,false,true,true);
-
__renderer = new BasicRenderEngine();
-
addChild(__viewport);
-
}
-
protected function initMaterials():void
-
{
-
__moveMatRightWall = new MovieMaterial(__wallRight, true)
-
__moveMatWallLeft = new MovieMaterial(__wallLeft, true);
-
__moveMatWallBack = new MovieMaterial(__wallBack)
-
__moveMatFloor = new MovieMaterial(__floor);
-
__moveMatTree = new MovieMaterial(__tree, true );
-
__moveMatMonster = new MovieMaterial(__monster, true);
-
__moveMatRightWall.doubleSided = true;
-
__moveMatWallLeft.doubleSided = true;
-
__moveMatWallBack.doubleSided = true;
-
__moveMatTree.doubleSided = true;
-
__moveMatFloor.doubleSided = true;
-
__moveMatTree.doubleSided = true;
-
__moveMatMonster.doubleSided = true;
-
}
-
protected function initObjects():void
-
{
-
__monsterPlane = new Plane(__moveMatMonster, 184, 237, 4, 4);
-
__plane_rightWall = new Plane(__moveMatRightWall, 386, 239, 4,4)
-
__plane_wallBack = new Plane(__moveMatWallBack, 734, 240, 4,4);
-
__plane_wallLeft = new Plane(__moveMatWallLeft,386,239,4,4)
-
__floorPlane = new Plane(__moveMatFloor, 800, 800, 14,14);
-
__treePlane = new Plane(__moveMatTree, 79, 112, 4, 4);
-
__scene.addChild(__floorPlane);
-
__scene.addChild(__plane_wallBack);
-
__scene.addChild(__treePlane);
-
__scene.addChild(__plane_wallLeft);
-
__scene.addChild(__plane_rightWall);
-
__scene.addChild(__monsterPlane);
-
__floorPlane.y = -120;
-
__treePlane.y = -69;
-
__floorPlane.pitch(90);
-
__monsterPlane.z = -300;
-
__monsterPlane.x = 150;
-
__monsterPlane.y = -10;
-
__plane_wallBack.z += 340
-
__treePlane.z = 300;
-
__treePlane.x = -220;
-
__plane_wallLeft.x = -155;
-
__plane_rightWall.x = 155;
-
__plane_wallLeft.rotationY = -35;
-
__plane_rightWall.rotationY = 35
-
}
-
protected function initEvents():void
-
{
-
this.addEventListener(Event.ENTER_FRAME,render);
-
}
-
protected function render(e:Event):void
-
{
-
__renderer.renderScene(__scene, __camera, __viewport, true);
-
var moveXAmount:Number = (mouseX - 1000 / 2) * 4
-
var moveYAmount:Number = (mouseY - 600 / 2) * 2
-
if (moveYAmount <0)
-
{
-
moveYAmount = 0;
-
}
-
__camera.x = moveXAmount;
-
__camera.y = moveYAmount;
-
__camera.lookAt(__floorPlane)
-
}
-
protected function createChildren():void
-
{
-
//Movieclips with Export for AS in Library
-
__wallBack = new Wall_back();
-
__wallLeft = new Wall_left();
-
__wallRight = new Wall_right();
-
__floor = new Floor();
-
__tree = new Tree();
-
__monster = new Monster();
-
}
-
}
-
}

Great work, but I can’t compile it because Papervision3D 2 and Tweener libraries are not sufficient. Error with AbstractRenderEngine. Not found IRenderEngine and other override methods errors. Any solution? Thanks.
Hey Isma,
For this project I was using the Great White branch. Go to the org.papervision folder and open the file Papervision3D.as on line 34 it should say
static public var VERSION :String = ‘Public Alpha 2.0 – Great White’;
Let me know if this helps.
Thanks,
Charlie
Okay, okay… I had a mix of 1.5 and 2 version. With Papervision3D 2 works fine. Thanks for help.
Congratulations for the blog. I will be kind to your experiments.
Please feel free to share your experiments with this project. It would be great to see it expanded upon.
This looks very cool!
I am getting 5 errors in the main.as that I am not sure why.
3 have to do with the Camera3D like this one: 1046: Type was not found or was not a compile-time constant: FreeCamera3D.
Do I need to move the AS file, or have it point somewhere else? All the paths in the main.as look to be pointing to the right place, and I am in the Great White version.
Is this file located in your papervision code directory
org\papervision3d\cameras\FreeCamera3D.as
Let me know. If it is not I will double check and upload the code with the papervision source I used and get back to you.
Yes, it is.
If it helps, I have the fla in the GreatWhite\src folder.
If anyone has had problems getting this to work in the newest version of Papervision here are few things I had to do.
Change this line:
__renderer.renderScene(__scene, __camera, __viewport, true);
change to: __renderer.renderScene(__scene, __camera, __viewport);
Change: FreeCamera3D to just Camera3D in all instance
and then you have to change your camera zoom and z:
I used:
__camera.zoom = 20;
__camera.z = -500;
Has there been any developments on this? I’d really like to participate.
If you are using papervision 2.1, quadtree location has been updated use:
import org.papervision3d.core.render.data.QuadTree;
and follow indiekid’s steps of changing the camera and rendering.
I have one error:
import com.foomonger.utils.Later;
Tested movie is blank.
There are a couple of other things that I had to do in addition to what indiekid mentioned.
Download foomonger_as_package_v2.0.0b.zip from http://code.google.com/p/foomonger/
and install the “com” folder in the same folder as the FLA folder.
I was still getting one last error, therefore, I disabled the fourth line of the code so it looks like this:
//import org.papervision3d.core.data.qTree.QuadTree;
Now, it works! THANKS
Hey all,
I don’t get this to work.
1. I created a ‘project’ folder in my documents.
2. I downloaden SVN , imported the stuff with this link (http://papervision3d.googlecode.com/svn/trunk/ ) to the ‘project’ folder with a new map called ‘papervisionstuff’.
3. Downloaden Papervision 3d 2.0 and also extracted this into the project folder with a new map called ‘papervision2.0′.
So my folder looks like this:
- Papervision 2.0
- Papervision stuff (downloaden SVN stuff)
- Caurina (Tweener)
- and the papervision-popup.fla and Main.as (maybe these should be placed somewhere else?)
Then ill open the papervision-popup.fla go to preferences > as2 and add these classes links:
D:\My Documents\papervision3dproject\Papervisionstuff\as2\trunk\src
(too imported SVN stuff)
and
D:\My Documents\papervision3dproject\caurina\transitions
(to Tweener)
But it doesn’t work. When I open the papervisin-popup.fla all I see is a blanc canvas and when I run it I get several errors.
Can someone help me out? Or send me an email about what to do?
Maybe giving a .rar file with all the documents in the right places and the links that I should add in the preference>as2>classes?
Thank you in advance,
Patrick
And I also don’t have a ‘Great White’ map in my
‘Papervisionstuff’ folder.
So branches > …..
I am having cs4, so no great white there. when il go into cs4>src I do see the com,fl and org maps.
I already tried to put the popup.fla to place there but that doesn;t work. Or well, suposingly I am doing something wrong and getting slightly frustrated
Help is very much appreciated!
Hmm I noticed I forgot to download the source of Tweener to.
But I did now.
I think my problem is that I don’t know how to add the classes in Flash preferences menu
Hello, sorry for the quick replies.
Which version of papervision 2.0 do I need to get the great white branche?
In which folder do I need to place the .fla and Main.as?
To which folders do I have to connect to connect to the classses (preferences>as2>?)
(I downloaded the Tweener en papervision with subversion)
Lost about what to do now! Somewhat more detailed information could help me further.
You may email me ofcourse.
Thank you.
Yeah!
Finally I managed to get it to work.
I found out I forgot ‘Foomonger’