[Papervision3D] Basic View MOUSE_DOWN event
Kayomarz
kayo.online at gmail.com
Mon Dec 8 12:21:33 PST 2008
Adding the listener to the stage works - thanks!
Kayo.
Owen Bennett wrote:
> This is normal behaviour. If you want to capture all mouse events in
> your application, add the listener to the stage, rather than to your
> view.
>
> Owen
>
> On 8 Dec 2008, at 19:06, Kayomarz wrote:
>
>> 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;
>> }
>>
>> }
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D at osflash.org
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
More information about the Papervision3D
mailing list