Jump to content

<button onmousedown= problem


vmars316

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>

<br>

<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>

</div>


//

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 ;

drawThrower();

}

//


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...