I am trying to export the html5 game I made in construct2 to my android using intel xdk. This work on my phone, but when I am trying the game in my phone ,the phone shows the game twice-one above another. I of course want to see the game only once.
Asked
Active
Viewed 418 times
1 Answers
0
The device ready event is firing twice. Once when intel.xdk javascript bridge is ready and a second time when the document is ready. Try placing all your game initialization code in a script, like the following code, at the beginning of the index.html file to avoid this problem.
<script type="text/javascript" charset="utf-8" src="intelxdk.js"></script>
<script type="text/javascript" language="javascript">
var isIntel=window.intel&&window.intel.xdk
// This event handler is fired once the intel libraries are ready
function onDeviceReady() {
jQuery(window).resize(function() {
cr_sizeCanvas(jQuery(window).width(), jQuery(window).height());
});
//hide splash screen now that our app is ready to run
intel.xdk.device.hideSplashScreen();
// Create new runtime using the c2canvas
cr_createRuntime("c2canvas");
document.addEventListener("pause", function() {
cr_setSuspended(true);
}, false);
document.addEventListener("resume", function() {
cr_setSuspended(false);
}, false);
}
//initial event handler to detect when intel is ready to roll
document.addEventListener("intel.xdk.device.ready", onDeviceReady, false);</script>

Brandon
- 33
- 7
-
its works perfect when i run it from C2 but only when I export it from SDK to android its show the game twice – Yagel Aug 18 '14 at 14:33
-
thank you for your help, but I dont know how to put it on the code. can you write the whole code?? thxxxxxx for all!! – Yagel Aug 20 '14 at 13:20
-
Remove the lines 80 to 102 and insert the code I shared, given you are building it with Cordova. This should only launch the game one time. – Brandon Aug 20 '14 at 14:00