Hey Corin

if you want to halt rendering every frame but still be able to receive mouse
events, you won't be able to use MouseEvent3D objects because these are only
triggered from a view.render() method

however, you can use regular MouseEvent events to get round the problem, if
you set ownCanvas = true on the 3d objects you wish to have mouse
interaction with

ownCanvas = true tells a 3d object to render it's containing geometry inside
it's own sprite. you can access the sprite being used to render any 3d
object in a scene like so:

myObject3D.session.getContainer(myView);

if ownCanvas is set to true on the object you perform this on, the sprite
returned will be unique to that object and can therefore have listeners
attached to it.

so doing:

var mySprite:Sprite = myObject3D.session.getContainer(myView) as Sprite;
mySprite.addEventListener(MouseEvent.CLICK, myHandler);

will set a handler method that will be triggered from a mouse click on the
object, regardless of whether view.render() has been called in a frame


hth


Rob

On Thu, Apr 23, 2009 at 11:23 AM, corin_w <[email protected]>wrote:

>
> Hi all,
>
> I've had a look at the view3d class and can see that fireMouseEvents
> is called during the render function. does this mean that if i'm not
> continually rendering i wont recieve MouseEvent3ds from the view? I
> hope to intergrate wii mote control into this project soon which makes
> this problem elementary. any ideas on how massive a task this will be
> or whether it has been done before? I would be hoping to get mouse
> event type information based on point and click type actions.
>
> cheers, Corin
>
>
>
> On Apr 22, 6:00 pm, richardolsson <[email protected]> wrote:
> > Your assumption is correct! The event is fired during the render()
> > traversal.
> >
> > Are you aware that Away3D does caching for you? This means that the
> > render() call will do basically nothing if the scene hasn't changed
> > from the camera point of view since the last time render() was called.
> > It still does something though (i.e. some traversal, check what's in
> > cache et c), so it might make sense for you to do what you're trying
> > to do.
> >
> > A common way of handling this type of thing is to flag the
> > representation/view as "invalid", triggering a render on the next
> > ENTER_FRAME event, like so:
> >
> > function _handleClick_invalidate(ev:MouseEvent3D) : void
> > {
> >   _invalid = true;
> >
> > }
> >
> > function _handleEnterFrame_render(ev:Event) : void
> > {
> >   // only render if flagged as invalid
> >   if (_invalid)
> >     _view.render();
> >
> > }
> >
> > Hope this helps!
> >
> > Cheers
> > /R
> >
> > On Apr 22, 5:16 pm, corin_w <[email protected]> wrote:
> >
> > > Hi,
> >
> > > I am rendering on demand.
> > > I have literally just changed the listener from an enterframe to a
> > > mousedown
> > > totally at a loss as to whats happenening. are mouse events generated
> > > by the renderer?
> >
> > > cheers, Corin
> >
> > > On Apr 22, 3:54 pm, Fabrice <[email protected]> wrote:
> >
> > > > Hi Corin,
> > > > What about not adding a listener at all, and render on demand?
> > > > But if the Flash player hangs, then you probably have something in
> > > > your code, causing endless loop or something...
> >
> > > > Fabrice
> >
> > > > On Apr 22, 2009, at 2:35 PM, corin_w wrote:
> >
> > > > > hi all,
> >
> > > > > I want to restrict when render() gets called and so have only been
> > > > > calling it when something has changed. simple enough. however if i
> > > > > call render from a  mouse event listener flash player hangs. is
> there
> > > > > a way around this other than adding an ENTER_FRAME listener to
> render
> > > > > it next frame and then removing it again?
> >
> > > > > cheers, Corin
>



-- 
Rob Bateman
Flash Development & Consultancy

[email protected]
www.infiniteturtles.co.uk
www.away3d.com

Reply via email to