Forums

OverviewV-Play 1 SupportBackground music help please › Reply To: Background music help please

OverviewV-Play 1 SupportBackground music help please › Reply To: Background music help please
#7256

Alex
V-Play Team

Hi,

the code could look like this:

ImageButton {
    onClicked: {
      //the settings.musicEnabled flag enables/disables the background music, and also stores this in the database, so the music stays enabled/disabled on the next app start
      settings.musicEnabled = !settings.musicEnabled
    }
    // change the source to display different images in case the music is enabled or disabled
    source: settings.musicEnabled ? "music_on.png" : "music_off.png"
  }

Of course you will have to add the images for the button (in my example music_on.png and music_off.png) to the spritesheet.

Hope this helps.
Cheers,
Alex

  • This reply was modified 4 years, 2 months ago by  Alex.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support