AndyWatson's Recent Forum Activity

  • Same thing happened to me.

  • Thanks for this. The reason for doing it is phonegap to android. When the app goes to backround the music keeps playing. I've tried loads of ways to add a phonegap event listener in the index that mutes music in the javascript when backgrounding. I can't seem to switch it so am resorting to running music from the index that plays and mutes depending on the value of a variable fired from the c2 javascript file. All other sounds will stay within c2.

  • Thanks for this, much appreciated - you got further than i did. Now you've given me that pointer i'll see whether i can get it to do what i need.

    Cheers!!!

  • Thanks for this, I'll check it out in detail, though am hoping to do it without any additional plugins.

  • Hi All,

    A bit difficult to explain this one...

    I want to include a script within the index.html file that looks at a variable that C2 has saved to my localStorage and then plays a music file if the variable=1. Does anyone know how to do this?

    I need to play the music file separate from the game and the runtime javascript. I hope someone can help...

    The audio file absolutely needs to play outside the c2runtime.js file.

    If the variable is called MyVar, I guess it's going to be something like:

    <script>

    if localStorage.MyVar=1

    then play musicfile.ogg

    </script>

    ...but evidently my expertise does not stretch this far - can anyone with programming skills help???

    Thanks in advance!!

  • Hi All,

    Now that the audio is working in the PhoneGap export (yay!), I'm trying to get my looping background music to pause when the Android app is minimised/backgrounded. Anyone know how to do this?

    I think it's something I need to put in the following code in the index.html to mute or pause the music file.

    <font color=green>document.addEventListener("pause", onPause, false); </font>

    <font color=green>function onPause(){ }</font>

    As an interim measure I have used:

    <font color=green>document.addEventListener("pause", onPause, false);</font>

    <font color=green>function onPause(){ </font>

    <font color=red>navigator.app.exitApp();

    } </font>

    to completely kill the app (and hence the audio), but it isn't an elegant solution. Any help or suggestions gratefully appreciated, I've been working on this for a few days and can't find any assistance online either.

    Many, many thanks!!

    ...an alternative would be to put the entire app into a paused state (including the music) - which would actually be an even better result!

    I've asked on the PhoneGap Build forum too.

  • Hi, i don't have my pc booted at the moment, so can't check, but i used galaxy s2 dimensions and full screen settings were scale to fit. i used the manual info to maximise performance for mobile. hope this is useful!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Heh, heh, cheers guys! Really enjoyed putting it together, now gonna get on to the next game. Loving Construct 2

  • Not sure this is the right forum for this, but I've started to spread the word on my app game created with C2 and PhoneGap. Here's the first of the promo: http://www.newswiretoday.com/news/107812/

  • Yeeeeeaaaaaahhh!!!! Looks like adding "int" in front of the webstorage has got my game working again.

    I've no idea why it used to work without the 'int' and now I need to include it to make things run. My game's been working the same way perfectly for some time and I have apps on the android market running that way with no problem.

    Many, many thanks for helping me get this sorted, Kyatric, and apologies for the mess I made of my earlier capx example (not sure why I used a value of '1' as an example - all the initial values on my main game are '0', and I don't have the unwanted speech marks in the main game either).

    Really appreciate you getting to the bottom of this <img src="smileys/smiley20.gif" border="0" align="middle" />

  • Thanks Kyatric, I made a few errors in my example that aren't in my main game - it's been at least a month since I've written anything for web storage, so I'm a bit rusty.

    I don't have the 'int' in my game, so I'll add and see if that sorts it.

    It's been working the same way for at least the last three or four releases.

AndyWatson's avatar

AndyWatson

Member since 9 Jan, 2012

None one is following AndyWatson yet!

Connect with AndyWatson

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies