Results 1 to 2 of 2

Thread: setcapture in firefox?

  1. #1
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default setcapture in firefox?

    Hi

    I have to convert setcapture from IE into firefox. Here is a script similiar to the one I have to convert. How do I make this work in FireFox???

    Looking forward to your reply.

    Regards
    Chaz

    <HTML>
    <HEAD>
    <TITLE>Track Ball</TITLE>

    <STYLE>
    <!--
    #oTrackBall {
    position:absolute;
    left:170;
    top:200;
    }
    -->
    </STYLE>
    <SCRIPT>
    <!--
    var iRadius = 30;
    var iXcenter = 250;
    var iYcenter = 170;
    var capture = true;

    function fnSwitchCapture(obj) {
    if (capture) {
    capture = false;
    obj.releaseCapture();
    }
    else {
    capture = true;
    obj.setCapture();
    }
    }

    function doImgMouseMove()
    {
    var iXdistance = event.x - iXcenter;
    var iYdistance = event.y - iYcenter;
    var distance = Math.sqrt(iXdistance * iXdistance + iYdistance * iYdistance);
    oTrackBall.style.left = iXcenter + iRadius * iXdistance / distance;
    oTrackBall.style.top = iYcenter + iRadius * iYdistance / distance;
    }
    -->
    </SCRIPT>
    </HEAD>
    <BODY onload="oTrackBall.setCapture()" onclick="fnSwitchCapture(oTrackBall)"> <BR>
    <CENTER><H2>Simple Animation with setCapture() and releaseCapture()</H2></CENTER>
    <IMG ID="oTrackBall" onmousemove="doImgMouseMove()" SRC="black.gif" alt="black sphere">
    </BODY>
    </HTML>

  2. #2
    Join Date
    Aug 2007
    Location
    Somewhere in the vicinity of Betelgeuse
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    setCapture and releaseCapture are IE specific non-standard add-ons. There is a chap called Stephen Stchur who is developing a framework called Gimme which, in it's latest unreleased version (Caspian) has x-browser mouse capture functionality. I came across it a couple of days ago and I have not tested it, but I had a brief look at the code and it looks like it just may work.

Bookmarks

Posting Permissions

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