app is crashes when I use a loop in procedure

156 views
Skip to first unread message

yoni...@gmail.com

unread,
Jun 16, 2014, 12:24:57 PM6/16/14
to mitappinv...@googlegroups.com
when I press on imageSprite1 then app is get stuck and not responding
I have 2 values in soundVar list and the while loop should compare between the chosen random sound to the list until he get the right one and save the counter number in the count var
same story when I press on imageSprite2
appStuck.JPG

yoni...@gmail.com

unread,
Jun 16, 2014, 1:56:49 PM6/16/14
to mitappinv...@googlegroups.com
ok i thing it worked out I replace the while with if condition
I hope its the right solution

yoni...@gmail.com

unread,
Jun 16, 2014, 2:15:41 PM6/16/14
to mitappinv...@googlegroups.com
ITS NOT WORKING PLEASE HELP
I need to find some way to stop each item loop

Taifun

unread,
Jun 16, 2014, 3:19:54 PM6/16/14
to mitappinv...@googlegroups.com




if Sound1.Source = "dog.mp3"
then call Sound3.Play
else call Sound4.Play

Taifun

yoni...@gmail.com

unread,
Jun 16, 2014, 4:46:50 PM6/16/14
to mitappinv...@googlegroups.com
but if I have a lot of values in the list I need to do this to each of them
here in the example I have 2 in the list just for test to see if its working
there is no way to do it more efficient when dog.mp3 is coming as variable?

Taifun

unread,
Jun 16, 2014, 5:06:46 PM6/16/14
to mitappinv...@googlegroups.com
so how does your app work?
you pick a random sound then you click onto an image sprite and then another sound is played depending on which condition?

I would create another list with your sounds, use only one sound component and pick the corresponding sound from the sound list to play
Taifun

yoni...@gmail.com

unread,
Jun 16, 2014, 5:22:02 PM6/16/14
to mitappinv...@googlegroups.com
I want to connect between the sound to image sprite
for example if I press global button and hear a bark (its randomize I can hear some other animal sound) so I will need choose the picture of the dog, if I choose wrong picture it should tell me 'try again' or something until I will make the right selection (image sprite)

Taifun

unread,
Jun 16, 2014, 7:07:42 PM6/16/14
to
let's assume, image sprite 1 is the dog and you created another list with the images, let's call it listImage: dog.png, cat.png, etc.
then you can check, if the correct image is clicked: the index of both lists must be the same:

if index in list sound1.source = index in list imageSprite1.picture
                    soundVar                             listImage
then <correct>
else <try again>

you can reduce the number of blocks if you use the advanced blocks...

Taifun

index in list

Returns the position of the thing in the list. If not in the list, returns 0.


Reply all
Reply to author
Forward
0 new messages