1 decade ago by TigerJ
So I have 4 divs:
and I have four binding calls:
and I keep getting "not found getElementById: left_ctrl every time I try to run the game in the cocoonjs launcher on android.
i have tried adding these divs through javascript in the main.js when defining my canvas and I still get the same problem:
<div id="left_ctrl"></div> <div id="right_ctrl"></div> <div id="top_ctrl"></div> <div id="down_ctrl"></div>
and I have four binding calls:
ig.input.bindTouch( '#left_ctrl', 'l' ); ig.input.bindTouch( '#right_ctrl', 'r' ); ig.input.bindTouch( '#top_ctrl', 'u' ); ig.input.bindTouch( '#down_ctrl', 'd' );
and I keep getting "not found getElementById: left_ctrl every time I try to run the game in the cocoonjs launcher on android.
i have tried adding these divs through javascript in the main.js when defining my canvas and I still get the same problem:
var leftDiv = document.createElement('div'); leftDiv.id='left_ctrl'; leftDiv.style.width="80px"; leftDiv.style.height="80px"; leftDiv.style.position='absolute'; leftDiv.style.top='200px'; leftDiv.style.backgroundImage="url('touch_left.png')"; leftDiv.style.opacity=.1; document.body.appendChild(leftDiv); var rightDiv = document.createElement('div'); rightDiv.id='right_ctrl'; rightDiv.style.width="80px"; rightDiv.style.height="80px"; rightDiv.style.position='absolute'; rightDiv.style.top='200px'; rightDiv.style.left='400px'; rightDiv.style.backgroundImage="url('touch_right.png')"; rightDiv.style.opacity=.1; document.body.appendChild(rightDiv); var topDiv = document.createElement('div'); topDiv.id='top_ctrl'; topDiv.style.width="80px"; topDiv.style.height="80px"; topDiv.style.position='absolute'; topDiv.style.left='200px'; topDiv.style.top='0px'; topDiv.style.backgroundImage="url('touch_up.png')"; topDiv.style.opacity=.1; document.body.appendChild(topDiv); var BottomDiv = document.createElement('div'); BottomDiv.id='down_ctrl'; BottomDiv.style.width="80px"; BottomDiv.style.height="80px"; BottomDiv.style.position='absolute'; BottomDiv.style.left='200px'; BottomDiv.style.top='400px'; BottomDiv.style.backgroundImage="url('touch_down.png')"; BottomDiv.style.opacity=.1; document.body.appendChild(BottomDiv);