One thing I forgot to note:

Notice the RectangleClipping added to both views. For the view that is
not added to the parent display object, it is necessary to specify a
Clipping, because the view Sprite does not have access to stage
properties.

On Nov 11, 12:49 am, Mango <[EMAIL PROTECTED]> wrote:
> Rob and Peter both have the right idea. Unfortunately, when you add
> the view sprite to the parent, it inherits the parent's dimensions.
> Solution? Create two identical scenes, but only add one to the parent
> display object.
>
> Example:http://www.mediafire.com/?sharekey=c8a7966316f99e07d2db6fb9a8902bda
> (Sorry about the hosting link. My site is not up currently, so I
> cannot host it properly. Also, the file upload on this site doesn't
> appear to load swfs. Feel free to rehost.)
>
> AS3:
> public class BoundTest extends Sprite {
>   private var view:View3D;
>   private var view2:View3D;
>   private var cube:Cube;
>   private var cube2:Cube;
>   private var rect:Rectangle;
>
>   public function BoundTest() {
>     init();
>   }
>
>   private function init():void {
>     view = new View3D({x:200, y:200, clip:new RectangleClipping(-190,
> -150, 190, 150)});
>     view2 = new View3D({x:200, y:200, clip:new RectangleClipping(-190,
> -150, 190, 150)});
>     cube = new Cube();
>     cube2 = new Cube();
>     view.scene.addChild(cube);
>     view2.scene.addChild(cube2);
>
>     addChild(view);
>     addEventListener(Event.ENTER_FRAME, onEnterFrame);
>   }
>
>   private function onEnterFrame(event:Event):void {
>     cube.rotationX += 5;
>     cube.rotationY += 5;
>     cube.rotationZ += 5;
>     cube2.rotationX += 5;
>     cube2.rotationY += 5;
>     cube2.rotationZ += 5;
>
>     view2.render();
>     rect = view2.getBounds(this);
>     view.render();
>
>     trace(rect.width + ", " + rect.height);
>   }
>
> }// of class
>
> On Nov 10, 6:46 pm, bakedbeing <[EMAIL PROTECTED]> wrote:
>
> > Hey thanks for the tip Rob. I've tried using getBounds on the view,
> > but it's giving me a bounding rectangle the size of the whole canvas.
> > Do you know what containers I could look at inside the object to get
> > something that matches the outline of our object?
>
> > On Nov 8, 12:02 am, "Rob Bateman" <[EMAIL PROTECTED]> wrote:
>
> > > Hey bakedbeing
>
> > > have you tried using the bounding radius property yet? you can access the
> > > containing radius of any object through the property boundingRadius. This
> > > doesn't give you a screen bounding box, but you could use a perspective
> > > calulation on the radius to get a view value and work from there.
>
> > > another quick hack that may be simpler to execute is just taking the
> > > rectangle returned from getBounds() on the view! this will give you a
> > > Rectangle instance that you can extract all relevant data relating to the
> > > bounds of the object inside.
>
> > > atb
>
> > > Rob
>
> > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <[EMAIL PROTECTED]>wrote:
>
> > > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > > the actionscript API for google maps includes streetview yet, for that
> > > > you need to be using  a browser and javascript as far as I can tell :(
>
> > > > On Nov 7, 3:21 pm, Mango <[EMAIL PROTECTED]> wrote:
> > > > > Sorry, here's the link:
> > > >http://code.google.com/apis/maps/documentation/flash/
>
> > > > > On Nov 6, 10:15 pm, Mango <[EMAIL PROTECTED]> wrote:
>
> > > > > > I'm not sure if this is easier or more useful, but you can use the
> > > > > > Google Maps API for Flash, add the object to a sprite, and set the
> > > > > > sprite to the background of the view:
>
> > > > > > var view:View3D = new View3D(...);
> > > > > > var streetView:Sprite = //google street view API
> > > > > > view.background = streetView;
>
> > > > > > In this way, transparent space will not interfere with mouse clicks 
> > > > > > as
> > > > > > long as you're not using something that fills the entire view (fog
> > > > > > filter, etc).
>
> > > > > > Quote:
> > > > > > "The Google Maps API now provides a Street View service for 
> > > > > > obtaining
> > > > > > and manipulating the imagery used in Google Maps Street View!"
>
> > > > > > I have no experience with street view or google maps, so this info 
> > > > > > may
> > > > > > be completely irrevalant or useless. :P
>
> > > > > > On Nov 6, 9:24 pm, bakedbeing <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Heya Mango, thanks for the response. Yeah I was thinking there's 
> > > > > > > ways
> > > > > > > to do it using Matrix math and all the values in the render scene,
> > > > but
> > > > > > > it's well beyond me to do, and I was hoping that the data would be
> > > > > > > somewhere in the 3D pipeline and just need to be fished out.
>
> > > > > > > I'm overlaying a 3D object on Google Street View, and it's moving
> > > > > > > pretty well with the maps, but if you completely cover the 
> > > > > > > streetview
> > > > > > > with another div with flash on it, you can't click and drag on the
> > > > > > > streetview below. So I need to calculate my bottle's position, 
> > > > > > > render
> > > > > > > it, then move my view and move/crop my swf so it's only the size 
> > > > > > > of
> > > > > > > the drawn 3D object :)
>
> > > > > > > On Nov 7, 2:07 pm, Mango <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Hello!
>
> > > > > > > > The data in these containers doesn't live long enough to 
> > > > > > > > access. I
> > > > > > > > don't think you can retrieve the properties of the objects 
> > > > > > > > without
> > > > > > > > inserting code into the Away3D classes (and the height and width
> > > > > > > > default to swf height and width anyway).
>
> > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > > properties, and from these you can calculate with the projection
> > > > the
> > > > > > > > width and height of the drawn graphic. Unfortunately, I do not 
> > > > > > > > have
> > > > > > > > the time (or knowledge, probably) to show you how to do this.
>
> > > > > > > > I'm curious as to why you need these values, though. To what end
> > > > does
> > > > > > > > resizing the swf serve? :)
>
> > > > > > > > On Nov 6, 5:44 pm, bakedbeing <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > Is there a way to access the graphics container in the view3D 
> > > > > > > > > or
> > > > in
> > > > > > > > > the session object? Something that will give me access to the
> > > > sprite
> > > > > > > > > created for each object?
>
> > > > > > > > > On Nov 7, 10:16 am, bakedbeing <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > > > > > > Heya again lads!
>
> > > > > > > > > > Is there a direct way to find a 2D bounding box for an 
> > > > > > > > > > object
> > > > as
> > > > > > > > > > finally drawn to the view?
>
> > > > > > > > > > I want to find the top left and bottom right of the object, 
> > > > > > > > > > so
> > > > I can
> > > > > > > > > > crop my swf to just the edges of the object (move the view
> > > > object,
> > > > > > > > > > resize the swf).
>
> > > > > > > > > > I couldn't find anything in the object3D properties or in
> > > > view3D.
>
> > > > > > > > > > I was thinking a long way would be to draw the whole view 
> > > > > > > > > > to a
> > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that 
> > > > > > > > > > for
> > > > pixel
> > > > > > > > > > data, but I'm hoping there's something easier? A sprite 
> > > > > > > > > > object
> > > > inside
> > > > > > > > > > Projector who's x,y, height and width (in 2D) I can grab??
>
> > > > > > > > > > Thanks!
>
> > > --
> > > Rob Bateman
> > > Flash Development & Consultancy
>
> > > [EMAIL PROTECTED]

Reply via email to