[Papervision3D] display problem
jlm at justinfront.net
jlm at justinfront.net
Wed Nov 14 09:28:10 PST 2007
new MovieMaterial(mc, true, {oneSided: true});
Quoting ilteris kaplan <ilteriskaplan at gmail.com>:
>
> I came across a weird display problem. You can see it in action here:
> http://share.klaweht.com/pv3d/bin/PV3PlaneArray.html
>
> Basically I am creating several planes on the stage and then moving them +50
> of their current X value. I don't have any idea why it's dissapearing after
> it reaches 90 degrees. Is there anything that I am missing here?
>
> I am attaching my source code so that you can have a better idea what's
> going on. The methods createPlanes() and onPlaneClick are the ones I think
> where the error happens since those are the areas I am dealing with display
> objects.
>
> I would appreciate any feedback.
> best,
> ilteris
>
>
> Here is my source code:
>
> package {
> import caurina.transitions.Tweener;
>
> import flash.display.*;
> import flash.events.*;
>
>
>
> import org.papervision3d.cameras.*;
> import org.papervision3d.events.*;
> import org.papervision3d.materials.*;
> import org.papervision3d.objects.*;
> import org.papervision3d.scenes.*;
> import org.papervision3d.utils.*;
>
>
> [SWF(backgroundColor="0xFFFFFF", frameRate="100")]
>
>
> public class PV3PlaneArray extends Sprite {
> private var planeArr:Array;
> private var _sprite:Sprite;
> private var _scene:Scene3D;
> private var _camera:Camera3D;
>
> private var pieceWidth:Number;
> private var pieceHeight:Number;
> private var totalNumPieces:Number;
>
> private var mc:MovieClip;
> private var imageHolder:DisplayObject3D;
>
> public function PV3PlaneArray() {
> planeArr = new Array();
> init();
> }
>
> private function init():void {
> stage.scaleMode = StageScaleMode.NO_SCALE;
> stage.align = StageAlign.TOP_LEFT;
> createPlaceHolderMcs();
> init3D();
> createPlanes();
> addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
> }
>
> private function createPlaceHolderMcs():void {
> mc = new MovieClip;
> mc.name = "mc";
> mc.graphics.beginFill( 0x000000, 100 );
> mc.graphics.drawRect(0, 0, 140, 140);
> mc.graphics.endFill();
> }
>
> private function init3D():void {
> _sprite = new Sprite();
> addChild(_sprite);
> _sprite.name = "mainCont";
> _scene = new Scene3D(_sprite, true);
> _scene.container.buttonMode = true;
>
> imageHolder = _scene.addChild(new DisplayObject3D("imageHolder"));
> //imageHolder.y = -300;
> imageHolder.z = 250;
>
> _camera = new Camera3D();
> //_camera.focus = 35;
> _camera.focus = 250;
> //_camera.z = -00;
>
> }
>
> private function createPlanes():void {
> pieceWidth = 140;
> pieceHeight = 140;
> totalNumPieces = 12;
> var tempX:Number = 0;
> var tempY:Number = 0;
>
>
> var material:MovieMaterial = new MovieMaterial(mc, true);
> material.smooth = true;
> material.interactive = true;
> material.animated = true;
>
> //material.movie.addEventListener(MouseEvent.CLICK, handleBTNClick);
>
> for(var i:Number = 0; i < totalNumPieces; i++) {
> var plane:Plane = new Plane(material,mc.width,mc.height, 3 ,3 );
> planeArr.push(plane);
> //plane.container.addEventListener( MouseEvent.CLICK , onMouseClick );
> plane.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,
> onPlaneClick, false,0,true);
> //plane.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
> onPlaneRollOver, false,0,true);
> plane.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,
> onPlaneRollOut, false,0,true);
>
> plane.x = tempX ;
> plane.y = tempY ;
> plane.extra = {xPos:plane.x, yPos:plane.y, zPos:plane.z, id:i};
>
> tempY = tempY + pieceHeight + 10;
> if (tempY >= 140*4) {
> tempY = 0;
> tempX = tempX + pieceWidth + 10;
> }
>
> imageHolder.addChild(plane);
> }
>
> _sprite.x = stage.stageWidth*.5;
> _sprite.y = stage.stageHeight*.5;
>
> }
>
>
> private function onPlaneClick(is3d:InteractiveScene3DEvent):void {
> var clickedPlane:Plane = is3d.target as Plane;
> Tweener.addTween(clickedPlane, {
> z:100,
> time:1,
> transition:"easeInOutQuad"
> });
>
> Tweener.addTween(imageHolder, {
> rotationY:imageHolder.rotationY+50,
> time:0.5,
> transition:"easeInOutQuad"
> });
>
>
>
> }
>
>
> /*
> private function onMouseClick(e:MouseEvent):void {
> trace(this);
>
> }
> */
>
> private function onPlaneRollOver(is3d:InteractiveScene3DEvent):void {
> var plane:Plane = is3d.target as Plane;
> Tweener.addTween(planeArr[plane.extra.id], {
> z:-50,
> time:1,
> transition:"easeInOutQuad"
> });
>
> }
>
> private function onPlaneRollOut(is3d:InteractiveScene3DEvent):void {
> var plane:Plane = is3d.target as Plane;
> Tweener.addTween(planeArr[plane.extra.id], {
> z:50,
> time:1,
> transition:"easeInOutQuad"
> });
>
> }
>
>
> private function loop(e:Event):void {
> _scene.renderCamera(_camera);
> }
>
> }
> }
>
> --
> View this message in context:
> http://www.nabble.com/display-problem-tf4806502.html#a13751242
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
More information about the Papervision3D
mailing list