hello all,
i have built an "if else" that need to check if a file exist and if it is, to play it, other wise to play a different file.
i use this in a bigger "if else", and i get a weird results, if the "if" statement is correct, no sound will play (other blocks will work) , but if the "else" statement is correct then only the default sound will play (circled in yellow in the picture) , and the other file will not, even when he exist.
Check you file paths here
This sets the path to /ASD/ASD/file so will probably always return false, if the file exists in /ASD/file
i do not understand why it will be /asd/asd/file ?
if i use it with the file without the "exist" procedure (like in the picture)
it work.
and even if it true then why the default sound (in the "else" statement) do not work?
How did you set the default file scope in the properties of the screen?
What @TIMAI2 is trying to say is that you have to remove the getASD method from the File.Exists method and use only the file name good.3gp because the file scope is App, which is the ASD
Taifun
do you mean for this?
like this ?
but then why without the "exist" procedure (like in the picture) it work ?
Yes, this should work.
It should also work with it.
it work with the "else" statement but the "if" do not work (circled in yellow) while the other blocks in this "if" (circled in blue) work.
it work in the companion, when i press "do it" on the "player1.start" but it still do not give any sound when i press the image.
when i disconnected the choose_number procedure, it worked
there is something wrong with "call" after "call"?
It looks like you have problems to play a sound, which is stored in the assets of your app? Is this correct?
What about creating some simple example blocks as simple as possible as test? Then if you get theae running add more complexity...
Taifun
the sound work if i disconnect the "choose_number" procedure
like in the picture, it only do not work when "call player1.start" is connected to "call choose_number".
What is chooseNumber doing? Show the content of that procedure.....
i suspect that i need to wait until the player finish then run this, maybe a delay, or to know if it finish playing?
You forgot to provide a screenshot of that procedure...
Taifun
this one ?
well, as you can see yourself, inside that procedure you are setting again the source of Player1 and call Player1.Start again... does this make sense? what do you think?
please show us the Do it results
use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
yes, but i want to put 2 different sounds, one after the other.
so i need to wait for the player1 to finish? if so how to know it finished ?
use the Player.Completed event
Taifun
but then it will call "choose_number" every time?
i need it only part of the time, sometimes i do not want it to run this procedure.