简体   繁体   English

I have some problems related to Javascript and HTML5 Canvas element and PHP CURL within my game

[英]I have some problems related to Javascript and HTML5 Canvas element and PHP CURL within my game

I have made a game using HTML5 Canvas Element, Javascript for facebook.我已经使用 HTML5 Canvas 元素,Javascript 为 Z26CAE7718C32180A407A0F8E19D 制作了一个游戏There are two problems I am facing.我面临两个问题。

PROBLEM 1问题 1

1.My game is inside an iframe in the facebook app so when I use the onkeydown even of Javascript and press down arrow key, the game works normally but the scrollbars go up and down. 1.My game is inside an iframe in the facebook app so when I use the onkeydown even of Javascript and press down arrow key, the game works normally but the scrollbars go up and down. I have uploaded the game and set it up already.我已经上传了游戏并进行了设置。 It can be found at: snake .它可以在以下位置找到:

PROBLEM 2问题 2

2.I totally can't understand how to use the graph API, since I have no knowledge of cURL, for posting the score earned on the wall without asking the player since if I ask them just like "facebook wants me to" the player can change it. 2.我完全不明白如何使用图表API,因为我不知道cURL,因为如果我问他们就像“facebook想要我”玩家一样在墙上发布得分而不问玩家可以改变它。

1. You must use some method to stop event from bubbling or captured by parent: 1.您必须使用某种方法来阻止事件冒泡或被父级捕获:

for IE对于 IE

window.event.cancelBubble = true

For Firefox, Safari, Chrome, Opera适用于 Firefox、Safari、Chrome、Opera

e.stopPropagation()
e.preventDefault()

For more info read this document: http://www.quirksmode.org/js/events_order.html有关更多信息,请阅读此文档: http://www.quirksmode.org/js/events_order.html

2. You need to use ajax to submit score from user browser, not from server, because of you will have not user's authentication's token/cookie which use to identify what's user submitting the score. 2.您需要使用ajax从用户浏览器提交分数,而不是从服务器提交分数,因为您没有用户身份验证的令牌/cookie,用于识别提交分数的用户。 If you use ajax then browser will automatically push cookie together with request then you don't care about that.如果您使用 ajax 那么浏览器会自动将 cookie 与请求一起推送,那么您不必在意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM