Jump to content


Photo

Adding script to index.html file [Help]


  • Please log in to reply
3 replies to this topic

#1 Blastblood

Blastblood

    GMC Member

  • New Member
  • 2 posts

Posted 07 February 2012 - 09:13 PM

I tried to add a simple javascript to show a notepad thingy beside the game but it doesn't work with the game's own codes.

I added this to the index.html file of the game and yes the notepad appears when i open the page but i can't write anything down.

</script>
    <script type="text/javascript">
  document.querySelector('#content').innerHTML =
var area = document.createElement('textarea');
area.style.width = '300px';
area.style.height = '150px';
document.querySelector('#content').appendChild(area);
    </script>


When i delete the game's codes the script works on its own. But i couldn't make it to make them work at the same time.
There is one more thing... Only when i extract the "<meta charset="utf-8"/>" code from the index.html file,the script works but the game goes. But i want both of them to work please help me...
  • 0

#2 thijsmie

thijsmie

    GMC Member

  • GMC Member
  • 22 posts

Posted 09 February 2012 - 12:24 PM

I think the game catches all the keyboard events, so when you press a key, gamemaker picks that up and the rest of the page doesn't. The only way I see to get this working is integrate the notepad into your existing gamemaker html5 game...
  • 0

#3 Blastblood

Blastblood

    GMC Member

  • New Member
  • 2 posts

Posted 09 February 2012 - 04:25 PM

I think the game catches all the keyboard events, so when you press a key, gamemaker picks that up and the rest of the page doesn't. The only way I see to get this working is integrate the notepad into your existing gamemaker html5 game...


if so, is it possible to focus on the game when we click it and focus on other contents when we click them. Like flash games. Like If game loses focus, stop capturing the keys for the game...
  • 0

#4 LiquidAsh

LiquidAsh

    GMC Member

  • GMC Member
  • 37 posts
  • Version:GM:Studio

Posted 04 August 2012 - 09:16 AM

I've recently run into this problem too. If nobody's found a solution, I suppose I'll start trying to look into GameMaker's output to see if I can find a way to overcome this.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users