Keydown pressed for left does not update for Keyup
<p>I have an object on <code>canvas</code> that I would like to move with keyboard events,</p>

<p>My event function is as follows</p>

<pre><code>function onKeyDown(evt) {
if (evt.keyCode == 40) { downDown = true;}
if (evt.keyCode == 39) { rightDown = true;}
if (evt.keyCode == 38) { upDown = true;}
if (evt.keyCode == 37) { leftDown = true;}
}
</code></pre>

<p>and my <code>onKeyUp</code> function is the same except with <code>false</code> as the value</p>

<p>then I attach it as</p>

<pre><code>$(document).keydown(onKeyDown);
$(document).keyup(onKeyUp);
</code></pre>

<p>I have a draw function that is called within my init as <code>intv = setInterval(draw, 10);</code> with the following statements</p>

<pre><code>                            if (rightDown) { x += dx;}
                            if (upDown) { y -= dy;}
                            if (downDown) { y += dy;}
                            if (leftDown) {x -= dx;}
</code></pre>

<p>Everything except the -x direction (left Down) works well. Such that I can move the object up,right and down. When left is pressed the object continues moving left. Are my conditional statements setup improperly ? </p>

<p>The full demo is at <a href="http://jsfiddle.net/avSvu/" rel="nofollow">http://jsfiddle.net/avSvu/</a></p>
