View3d added to a Sprite doesn’t work as expected!

Software: Away3D 4.x

Avatar
Bob Klein, Newbie
Posted: 11 November 2011 10:42 PM   Total Posts: 17

My application has a View3d (viewport) that is included in a user interface with lots of other non 3d related graphical stuff.  In away3d version 3.6 I put the view3d onto a sprite that I was able to move around and make visible and invisible as needed.  However when I try to do the same thing with the version 4 View3D object the viewport is always hidden below the sprite that it was added to.  I’ve attached the following sample program that illustrates the problem.

Interestingly enough the x/y position of the View3D gets moved properly but the visible property is ignored and any background fill color in the sprite completely covers over the View3D.  This is not at all what I would expect and if this is the way it has to be - my application is screwed!

Please let me know if I am doing something stupid or is this the way the View3d object is designed because of it’s interaction with stage3d?

The code that illustrates the problem is below.  The View3D is addChild’ed to the vctr sprite object which I make visible/invisible and move around.  The compiled swf is attached.


thanks in advance,
...bob…

package
{
 import away3d
.containers.View3D;
 
import away3d.materials.ColorMaterial;
 
import away3d.primitives.Cube;
 
import away3d.primitives.Plane;
 
import away3d.primitives.Sphere;
 
import away3d.containers.ObjectContainer3D;
 
import away3d.cameras.Camera3D;
 
 
import flash.display.Sprite;
 
import flash.events.Event;
 
import flash.text.TextField;

 
[SWF (width="500"height="500")]

 
public class foobar extends Sprite
 {
  
private var _view View3D;
  
  private var 
_ctr ObjectContainer3D;

  private var 
vctr:Sprite;

  public function 
foobar()
  
{
   stage
.frameRate 30;

   
_view = new View3D();

   
_view.width 200;
   
_view.height 200;
   
_view.25;
   
_view.25;
   
_view.camera = new Camera3D();
   
   
vctr = new Sprite();
   
vctr.0;
   
vctr.0;
   
vctr.graphics.beginFill(0xffff00);
   
vctr.graphics.drawRect(0,0,500,500);
   
vctr.graphics.endFill();
   
this.addChild(vctr);

   
vctr.addChild(_view);

   var 
t:TextField = new TextField();
   
t.text "Look at this!";
   
t.50;
   
t.250;

   
vctr.addChild(t);

   
this.addEventListener(Event.ENTER_FRAME_handleEnterFrame);
   
   
_ctr = new ObjectContainer3D();
   
_view.scene.addChild(_ctr);

   var 
material ColorMaterial = new ColorMaterial(0xff0000);

   
_ctr.addChild(new Plane(material)).= -200;
   
_ctr.addChild(new Cube(material10010010011725false));
   
_ctr.addChild(new Sphere(material)).200;

         
}

  
private var tick:int 0;

  private function 
_handleEnterFrame(ev Event) : void
  {
   _ctr
.rotationY += 1;
   
_view.render();

   
tick++;

   if ((
tick0) == 0{
    vctr
.visible = !vctr.visible;
    
vctr.+= 10;
    
};
  
}
 }

 

File Attachments
foobar.swf  (File Size: 72KB - Downloads: 258)
   

Avatar
Fabrice Closier, Administrator
Posted: 11 November 2011 11:06 PM   Total Posts: 1265   [ # 1 ]

http://www.adobe.com/newsletters/inspire/january2011/articles/article1/index.html

Stage3D is always behind the display list…

   

Avatar
Bob Klein, Newbie
Posted: 12 November 2011 12:37 AM   Total Posts: 17   [ # 2 ]

Fabrice,

Thanks for the reply and pointer!

Though - not the answer I wanted to hear….confused

I’ll have to do some significant hacking to see if
I can work around this “design” feature.

thanks again,
...bob…

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X