[Papervision3D] Basic View MOUSE_DOWN event
Kayomarz
kayo.online at gmail.com
Mon Dec 8 11:06:39 PST 2008
Hi
My application is trying to capture MOUSE_DOWN events using BasicView.
MOUSE_DOWN events are correctly captured as long as the mouse is _over_
objects that are added to the scene. However, MOUSE_DOWN events are not
captured if the mouse is on an area that does not contain an object.
Is this behaviour normal or is there something wrong?
Same is true for other mouse events.
How can mouse events be captured even if there were no objects are added
to the scene?
Below are some code snippets from the application.
Thanks and regards,
Kayo.
public class ControlBasicView extends BasicView
{
public function ControlBasicView(viewportWidth:Number = 640,
viewportHeight:Number = 480,
scaleToStage:Boolean = true, interactive:Boolean = false,
cameraType:String = "Target")
{
super(viewportWidth, viewportHeight, scaleToStage,
interactive, cameraType);
this.mouseEnabled = true;
this.addEventListener(MouseEvent.MOUSE_DOWN, grabMouse);
this.addEventListener(MouseEvent.MOUSE_UP, releaseMouse);
this.addEventListener(MouseEvent.MOUSE_WHEEL, wheelMouse);
.
.
.
}
public function grabMouse(event:Event): void
{
trace("Mouse Clicked on Basic View"); // Trace occurs
only if mouse down occurs when it is over an object
// Trace does not occur if mouse down occurs over empty area
this.mouseGrabbed = true;
this.mouseOld.x = this.mouseX;
this.mouseOld.y = this.mouseY;
}
}
More information about the Papervision3D
mailing list