Hello, I'm doing a find a partner project. Clicking on the cards makes a sound. I want to turn it on and off with a button from the main menu, but I could not do it. I couldn't find a similar application, I would be glad if you help me.
Welcome Ferhat.
What you need to do depends on
- whether you use the Sound or Player component
Player
- what you already coded. Sorry, we don't know how you coded unless you provide an image of your Blocks
- 'button from the main menu' ... is this Button on a different Screen?
thanks, i will try
yes it works but I want to do this in the settings section, enter the settings like this, turn the sound on or off, then when the game starts, I want to set it according to the setting made in the settings section at the beginning
more precisely, I want to make an initial setting valid when the page changes.
Show your code for the settings section please and read http://www.appinventor.org/content/howDoYou/screens/share . You need code in your Screen2 or whatever Screen2.Initialize Block and code to show the state you want to set the Sound component to start with Stop or Play . Why? Your additional Screen Sound component cannot be controlled from a different Screen without some help. This can be done using the TinyDB or screen blocks that pass variables between screens and a bit of code. What code? Depends on your existing code.
I guess I didn't explain
this is game mode
I want to move this to the settings section, the sound will be on and off in the settings section, but a change made in the settings section will not be valid when the page changes, this is the situation I was trying to explain.
Sorry, you still did not explain. Where is the Settings 'section'; on the same Screen or on a different Screen?
on a different screen
In short, can I affect the whole program with a change I made in the settings section? For example I turned off the sound in the settings and can I turn off the sound in the whole program
yes you can turn off the sound in the settings and can I turn off the sound in the whole program
If I'm not mistaken, screen 1 is my game screen
There are ways developers can turn off the sound in the settings and can I turn off the sound in the whole program:
- the simple way: use virtual screens for the entire app.
- an awkward way using the open another screen with start value Block.
- an awkward way using a TinyDB as Anke alludes to.
- there might be other ways.
For the second and third ways, you might need a Sound component on each of the Screens you use.
You don't know for sure? Then perhaps the following information may help you.
Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .
Also look here App inventor español. Offline. Tutorial. Ejemplos. Instalación. Códigos. Juegos. Curso gratis de App inventor. and here Tutorial Index | imagnity for more tutorials.
Learn about components Component Reference
and visit the Library The MIT App Inventor Library: Documentation & Support Help>Library on the MENU
I think the solution that Anke said will be enough. If not, I will try what you said.
Thank you very much it worked