Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2004
    Location
    San Mateo, CA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting mouse events from DOM objects

    I've got an interesting problem to solve and I can't seem to find much about how to do what I would think would be a common thing...

    I want to "grab" the coordinates in number of pixels from an object when the user clicks on it. It's easy to do this for simple things like DIVs or IMGs, but what I want to do is grab these coords from a video player -- QuickTime or Windows Media Player or Real or whatever. I tried the simple-minded approach first, with an object tag placing an instance of Windows Media Player in my HTML body, and tried this in a JavaScript block:

    document.getElementById("WinMedia").captureEvents(Event.CLICK);

    where "WinMedia" is the ID attribute of the object, and I stuck an onClick event handler in the object tag. That didn't work; mouseclicks continue to be treated as they are before I did anything -- Media Player detects them itslef and starts or stops the video. Next, I tried to get clever. I wrapped the Media Player object in a DIV tag and set captureEvents on the DIV and stuck an event handler in the DIV tag. Still no dice. If I put some padding on the DIV I get the events from the area around the media player instance... but when I mouseover the video itself, no dice. It's like the browser is just opening a hole in itself for the Media Player object and Media Player is obviously handling mouse events on its own.

    I finally tried making another div absolutely positioned "over" the video and set the event handler on that, but the browser real estate where the player is just not being looked at by the browser any more.

    Any ideas, anyone? I did some googling on this and cannot find any clear info from the various video player plugs about how you can handle mouse events and pass info to the browser...

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The player object model has to provide the events, and as far as I know, IE is the only browser capable of binding to those from script.
    Check out the MSDN documentation about the object element, and research the SDK's for each media player (or dig through their type libs for info...).
    *this message will self destruct in n-seconds*

  • #3
    New to the CF scene
    Join Date
    Sep 2004
    Location
    San Mateo, CA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's what I was afraid of. Thanks! I'll have to put my controls off to the side or above or below the video window, then... and/or capture keystrokes...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •