Closed Thread Icon

Topic awaiting preservation: Make object tag fire onmousedown event (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=26061" title="Pages that link to Topic awaiting preservation: Make object tag fire onmousedown event (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Make object tag fire onmousedown event <span class="small">(Page 1 of 1)</span>\

 
TwoD
Bipolar (III) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 06-18-2005 16:25

I read throuh the FAQ and tried placing a div over the object and catch the onmousedown from there, it didn't work of course...
So I tried placing an iframe between the object and the div. This caught the event, but it blocks the object from being seen (a live video stream).
So, I set allowtransparency to true and made the iframe's body tag invisible. Good, now I see the video, but I can't fire the event.

Any ideas??

Btw, neither the object, or iframe tags support onmousedown or any of the onmouse* events. Can't use onclick since I want the click to happen when the button is pressed, not when it's presed and then released.

/TwoD

(Edited by TwoD on 06-18-2005 16:48)

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-18-2005 20:24

you can simply do :

code:
<div id="myObject" onmouseout="alert('onmouseout event fired!')" >aaa</div>

<script type="text/javascript">

objectHandle = document.getElementById( "myObject" )

objectHandle.onmousedown = function()
{
	alert( "mousedown event fired" )
}


// fire the onmouseout and onmousedown events of the objectHandle
objectHandle.onmouseout()
objectHandle.onmousedown()

</script>



TwoD
Bipolar (III) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 06-18-2005 23:38

Sorry for being unclear.
I have an <object> tag which needs to use the onmousedown event.
It only supports onclick by default. onclick is fired when the user releases the mouse-button (while still over the tag).
I need to have the event fire when the user presses the button, regardless of where or when he releases the button again.

/TwoD

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-19-2005 00:34

sorry for reading your first post in diagonal.

I've tried to put a an onmousedown event on an OBJECT tag ( ok it was an image and not a video stream, but that difference should have no impact ), which is allowed by the specs of HTML 4.01 and XHTML 1.0 strict. It worked like a charm in FireFox and ... obviously did not work in IE.

Since the OBJECT tags are not treated like the common tags, a solution using a DIV is out of question.

If making the body of the IFRAME invisible does not work, I suggest you to try to put an transparent IMG in the IFRAME and put the events on it.

In the end, you may have to use SMIL or nest the video in a Flash handling the events.

Hope that helps,

TwoD
Bipolar (III) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 06-19-2005 02:15

That didn't work.
The video simply ends up on top of everything else.
I also tried setting the opacity down to 50% on the iframe but it just shows what's beind the video, even when placed on top of it.
As soon as I turn on allowtransparety the iframe jumps behind the video.

/TwoD

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-19-2005 04:38

What about nesting the video stream in a Flash movie, and handling the mousedown event in Flash ?

or why not positionning a transparent Flash ( that is another OBJECT tag ) over te OBJECT tag of the video stream that will handle the mousedown event ( and eventually return the x,y coordinates of the mouse to a JavaScript function ) ?

TwoD
Bipolar (III) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 06-19-2005 04:42

That might (and should be) possible, but it's not my videostream.
I'm trying to help someone else with this problem...

I'll suggest the Flash idea to him but I'm not sure he want's to invlolve more plugins, he already thinks the Active X control is too much lol.

/TwoD

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-19-2005 04:50

Nesting the video in a Flash should help him get rid of the ActiveX control, and btw make the whole thing cross browser/platform.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-20-2005 21:04

Can you still detect X, Y and keypress events when over an embedded object?



.:[ Never resist a perfect moment ]:.

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-20-2005 22:47

bitdamaged: good idea. Alas it does not seem work. I've tried to catch the X and Y coordinates via the onmousemove event of the BODY. It works everywhere but when hovering a Flash object. I guess it'll behave like that with a video stream.

« BackwardsOnwards »

Show Forum Drop Down Menu