Ok, I spoke too soon, but I do have the solution finally:

In my code I was creating additional objects to determine the screen
positions to add hitters outside of my scene.  I don't remember why I
did this, I think at the time either Vertex or ScreenVertex wasn't
doing what I wanted so I actually added planes to the scene and then
got their ScreenVertex.  Here's what I had:

function planeReady(evt:TweenEvent):void{
        var tw:Tween = Tween(evt.target);
        var obj:Plane = Plane(tw.obj);
        tw.removeEventListener(TweenEvent.MOTION_FINISH, planeReady);
        var ndx:Number = Number(obj.name.substr(5));
        var p:Object = __planes[ndx];
        obj.bothsides = true;
        var hitter:Sprite = new Sprite();
        hitter.name = "hitter"+ndx;
        var hs:Shape = new Shape();

        var p1:Plane = new Plane({width:20, height:20});
        p1.x = obj.x-obj.width/2;
        p1.y = obj.y+obj.height/2;
        __scene.addChild(p1);
        var p2:Plane = new Plane({width:20, height:20});
        p2.x = obj.x+obj.width/2;
        p2.y = obj.y-obj.height/2;
        __scene.addChild(p2);
        __view.render();
        var tl:ScreenVertex = __camera.screen(p1);
        var br:ScreenVertex = __camera.screen(p2);
        var w:Number = br.x - tl.x;
        var h:Number = br.y - tl.y;
        drawBox(hs, w, h, 0x00ff00, .5);
        hitter.addChild(hs);
        hitter.x = tl.x + __view.x;
        hitter.y = tl.y + __view.y;
        __scene.removeChild(p1);
        __scene.removeChild(p2);
        __view.render();
        addChild(hitter);
        p.hitter = hitter;
        hitter.mouseChildren = false;
        hitter.addEventListener(MouseEvent.MOUSE_OVER, over);
        hitter.addEventListener(MouseEvent.MOUSE_OUT, out);
        p.ready = true;
        setRender();
}

The problem occurred when in the same function I would add the planes
(p1, p2) and then remove them in the same function.  If I commented
out the __scene.removeChild(p1); and p2 the problem disappeared.  So,
I thought, it's been a while and I should look at ScreenVertex again.

So here's what I've got now:

function planeReady(evt:TweenEvent):void{
        var tw:Tween = Tween(evt.target);
        var obj:Plane = Plane(tw.obj);
        tw.removeEventListener(TweenEvent.MOTION_FINISH, planeReady);
        var ndx:Number = Number(obj.name.substr(5));
        var p:Object = __planes[ndx];
        obj.bothsides = true;
        var hitter:Sprite = new Sprite();
        hitter.name = "hitter"+ndx;
        var hs:Shape = new Shape();

        var tlx:Number = obj.x-obj.width/2;
        var tly:Number = obj.y-obj.height/2;
        var brx:Number = obj.x+obj.width/2;
        var bry:Number = obj.y+obj.height/2;

        var tlv:Vertex = new Vertex(tlx, tly, 0);
        var brv:Vertex = new Vertex(brx, bry, 0);
        var tl:ScreenVertex = __camera.screen(__scene, tlv);
        var br:ScreenVertex = __camera.screen(__scene, brv);

        hitter.x = tl.x + __view.x;
        hitter.y = tl.y + __view.y;

        var w:Number = br.x - tl.x;
        var h:Number = br.y - tl.y;
        drawBox(hs, w, h, 0x00ff00, 0);
        hitter.addChild(hs);

        addChild(hitter);
        p.hitter = hitter;
        hitter.mouseChildren = false;
        hitter.addEventListener(MouseEvent.MOUSE_OVER, over);
        hitter.addEventListener(MouseEvent.MOUSE_OUT, out);
        p.ready = true;
        setRender();
}

And now I can call render all over the place without a problem.  Just
wanted to add these notes in case they help someone.

On Oct 24, 10:11 am, Jeffrey Blyseth <[email protected]> wrote:
> Yes, no more problems.  What's even stranger is how the surfaces of
> the planes seem to interchange... Pretty funky.  Of course I can't
> really consider it a bug since you shouldn't ever render more than
> once per frame anyway.  Thanks for all your help and input.
>
> On Oct 24, 9:09 am, Peter Kapelyan <[email protected]> wrote:
>
>
>
> > So no more problems if you only render once?
>
> > I think thats the nastiest graphical glitch I've seen in Away3D so far - you
> > deserve a big trophy for that !
>
> > -Pete
>
> > On Fri, Oct 23, 2009 at 11:14 PM, Jeffrey Blyseth
> > <[email protected]>wrote:
>
> > > SOLVED! I think :)
> > > Here's a link to a simple flash example.  I believe that the problem
> > > was that I was calling render in both an Event.ENTER_FRAME event and a
> > > TweenEvent.MOTION_CHANGE event.  In the link here I left the problem
> > > in the code, but also include a link to download the source if anyone
> > > wants to see it.  You really notice it when you mouse from one plane
> > > to another.  Please let me know any thoughts.  And if I'm on the right
> > > track I hope it helps someone.
>
> > >http://axisgraphics.com/download/planes/
>
> > > On Oct 23, 12:26 pm, Jeffrey Blyseth <[email protected]> wrote:
> > > > Hi All,
> > > > More info on this issue, although I don't yet have a solution.  When
> > > > this happens I have multiple planes, at some point it appears that the
> > > > various bitmap materials switch to different planes, and this is when
> > > > I get the triangles flipping.
> > > > Any ideas?
>
> > > > On Oct 22, 3:47 pm, Jeffrey Blyseth <[email protected]> wrote:
>
> > > > > I have posted another example of this with debug:true,
> > >http://axisgraphics.com/download/flipped_triangle.jpg
> > > > > It looks as though one of the triangles gets flipped vertically, and
> > > > > the map gets messed up.  Anyone have an idea?
> > > > > Thanks,
>
> > > > > On Oct 22, 1:13 pm, Jeffrey Blyseth <[email protected]> wrote:
>
> > > > > > So far no luck in reliably reproducing the error.  Creating a new
> > > > > > bitmapMaterial with a different size bitmap and assigning it to the
> > > > > > plane as well as assigning a different size bitmap to the existing
> > > > > > bitmapMaterial work without a problem so I don't think that's it.
> > > > > > I wish I knew what is causing the triangles to render this way, for
> > > > > > example, why would it render upside down?  Or what is it that makes
> > > > > > the what causes the "top" of the bitmap to be aligned with the wrong
> > > > > > edge of the triangle?  This is the crux of the problem I believe.
> > > > > > Subsequent calls to view.render() fixes the plane.
> > > > > > Can anyone shed light on how the bitmapMaterial gets drawn to
> > > > > > triangles and therefore why it seems to align to the wrong edges of
> > > > > > triangles in some cases?
> > > > > > Thanks,
>
> > > > > > On Oct 22, 11:27 am, Jeffrey Blyseth <[email protected]>
> > > wrote:
>
> > > > > > > I think you're on the right track Peter.  I'm going to try to 
> > > > > > > break
> > > it
> > > > > > > reliably first to better understand what's happening.  I am using
> > > an
> > > > > > > EVENT.COMPLETE listener before building the plane though, maybe I
> > > > > > > should try a slight delay even then?
>
> > > > > > > On Oct 22, 10:44 am, Peter Kapelyan <[email protected]> wrote:
>
> > > > > > > > Actually I might have seen something similar once in something I
> > > was doing.
> > > > > > > > I think it had to do with the fact that it was making a material
> > > from a
> > > > > > > > bitmap that was being loaded and didn't exist yet and/or using
> > > replacing a
> > > > > > > > bitmap in a material with the wrong dimensions. I am not sure
> > > exactly what I
> > > > > > > > did to fix it, but can you try this?
>
> > > > > > > > Make a temp bitmap material first, same width and height as your
> > > loaded
> > > > > > > > images. Then replace the material.bitmap with your new bitmap. 
> > > > > > > > It
> > > has to be
> > > > > > > > the same size, or you might see something like you are seeing.
>
> > > > > > > > Crossing fingers.
> > > > > > > > -Pete
>
> > > > > > > > On Thu, Oct 22, 2009 at 1:09 PM, Jeffrey Blyseth
> > > > > > > > <[email protected]>wrote:
>
> > > > > > > > > No,
> > > > > > > > > I've already confirmed, compiling and running for FP10, 
> > > > > > > > > thanks.
>
> > > > > > > > > On Oct 22, 10:04 am, daniel <[email protected]>
> > > wrote:
> > > > > > > > > > Maybe your Code is compiled for FP10 and executed on FP9.
>
> > > > > > > > > > On Oct 22, 6:50 pm, Jeffrey Blyseth <
> > > [email protected]> wrote:
>
> > > > > > > > > > > Hi Pete,
> > > > > > > > > > > Therein lies the rub.  I haven't once been able to
> > > reproduce on my own
> > > > > > > > > > > system.  It's only happening off and on to my client.  It
> > > seems they
> > > > > > > > > > > have an internet connection that is slow so I thought it
> > > was something
> > > > > > > > > > > to do with the images not loading.  So I ran Sloppy to
> > > throttle my
> > > > > > > > > > > internet connection down to 128k and I still can't
> > > reproduce it.
> > > > > > > > > > > I believe I'm using version 2.1, at least that's the v num
> > > in
> > > > > > > > > > > Away3DAPIReference
> > > > > > > > > > > For the client it's happening on Mac/Firefox
> > > > > > > > > > > Again, a code sample is tough because I can't reproduce 
> > > > > > > > > > > the
> > > problem
> > > > > > > > > > > myself.
> > > > > > > > > > > Thanks
>
> > > > > > > > > > > > Can you tell us what Browser/Platform and version of
> > > away3d you are
> > > > > > > > > using?
> > > > > > > > > > > > Can it be reproduced on others? Also, is there an swf we
> > > can see? The
> > > > > > > > > code,
> > > > > > > > > > > > or a simple version that just shows the problem will
> > > help. Right
> > > > > > > > > offhand I
> > > > > > > > > > > > think this is the first time something like this has 
> > > > > > > > > > > > been
> > > mentioned.
>
> > > > > > > > > > > > -Pete
>
> > > > > > > > --
> > > > > > > > ___________________
>
> > > > > > > > Actionscript 3.0 Flash 3D Graphics Engine
>
> > > > > > > > HTTP://AWAY3D.COM
>
> > --
> > ___________________
>
> > Actionscript 3.0 Flash 3D Graphics Engine
>
> > HTTP://AWAY3D.COM

Reply via email to