Jump to content

<button onmousedown= problem


Recommended Posts

Hello & Thanks ;

Javascrtip and html are all one file :

Prob: all buttons work fine, except for <button onmousedown="touchRightArrow" .

the onmouseup="touchEndRight()" works fine .

But I havent been able to figure out why <button onmousedown="touchRightArrow" isn't working .

I need a new set of eyes to help me .

I am happy to Post all code if necessary , but its 557 lines .

<div id="canvasDiv" align="center" >

<canvas id="canvas" width="800" height="550" style="background-color:#992D2D"></canvas>


<button onclick="myGameArea.pause()" ontouchstart="myGameArea.pause()" >Pause</button>

<button onclick="myGameArea.play()" ontouchstart="myGameArea.play()" >Play</button>


<button onmousedown="touchLeftArrow()" onmouseup="touchEndLeft()" ontouchstart="touchLeftArrow()" ontouchend="touchEndLeft()">MoveLeft</button>


<button onclick="touchUpArrow()" ontouchstart="touchUpArrow()">Throw</button>


<button onmousedown="touchRightArrow" onmouseup="touchEndRight()" ontouchstart="touchRightArrow" ontouchend="touchEndRight()">MoveRight</button>


<button onclick="clearIt()" ontouchstart="clearIt()">Clear</button>

<button onclick="quitIt()" ontouchstart="quitIt()">Quit</button>



function touchRightArrow() {

alert("function touchRightArrow() {");

thrower.directionX = 1;

thrower.moveMe = true ;

if (thrower.x > canvas.width -40) { thrower.moveMe = false ; }



function touchEndRight() {

//alert("function touchEndRight() {");

rightPressed = false ;

thrower.moveMe = false ;




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...