Skip to first unread message

Roberito

unread,
Dec 5, 2015, 3:52:13 PM12/5/15
to mitappinv...@googlegroups.com
so im working on the magic 8 ball as a class assignment to get started into coding with this and im trying to figure out how to make it so that when i am shaking the phone it makes the sound continuously and then when i stop shaking it stops the sound and gives the reply and i got everything except for the shaking thing working fine please help i tried the player and i cant figure out how to make that work the way i want it to, i want the sound to toggle on and off based on if i the phone is shaking or not
Capture.JPG

Roberito

unread,
Dec 5, 2015, 4:02:36 PM12/5/15
to MIT App Inventor Forum
thats my code rn btw

Taifun

unread,
Dec 5, 2015, 4:07:08 PM12/5/15
to MIT App Inventor Forum
use the Player component instead of the Sound component, because the Player component also offers a Completed event... now just put a Player.Start method inside that event...

btw. you might be interested in how to avoid redundancy?

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Roberito

unread,
Dec 5, 2015, 4:16:30 PM12/5/15
to MIT App Inventor Forum
thanks ill try that now

Roberito

unread,
Dec 5, 2015, 4:20:37 PM12/5/15
to MIT App Inventor Forum
just a little side question while i do that is it possible to delete blocks that i put in my backpack that i dont want anymore cause my broken double clicking mouse is causing alot of problems with that

Roberito

unread,
Dec 5, 2015, 4:28:15 PM12/5/15
to MIT App Inventor Forum
ok wait i dont see how this will do what i want i want it to play the sound when i shake it then stop as soon as i stop shaking it and then give the prediction

Roberito

unread,
Dec 5, 2015, 5:15:14 PM12/5/15
to MIT App Inventor Forum
ok so that isnt doing what i want, i want to toggle the sound based on whether or not the phone is shaking

Taifun

unread,
Dec 6, 2015, 9:50:29 AM12/6/15
to MIT App Inventor Forum
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 do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn  App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.
Reply all
Reply to author
Forward
0 new messages