Computer Science Canada Help with Music and Buttons |
Author: | xXKennyXx [ Wed May 04, 2011 6:24 pm ] |
Post subject: | Help with Music and Buttons |
What is it you are trying to achieve? a program that plays a song and is able to stop the song whenever. What is the problem you are having? When the song starts i can't push any buttons to stop it Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) import GUI var canvas : int := GUI.CreateCanvas (10,150, maxx+140 , maxy ) var choice1 : boolean := false var choice2 : boolean := false var choice3 : boolean := false var Song1,Song2,Song3:int setscreen("graphics:800;600") procedure MusicA if choice1 = false then Music.PlayFile ("hedley - perfect.mp3") end if end MusicA procedure MusicB if choice2 then Music.PlayFile ("Never too late.mp3") end if end MusicB procedure MusicC if choice3 then Music.PlayFile ("music.mp3") end if end MusicC procedure S loop Music.PlayFileStop exit when GUI.ProcessEvent end loop end S var quitBtn : int := GUI.CreateButton (200, 10, 0, "Quit", GUI.Quit) Song1:= GUI.CreateButton (0, 120,0 , "Song1", MusicA) Song2:= GUI.CreateButton (0, 80,0 , "Song2", MusicB) Song3:= GUI.CreateButton (0, 40, 0, "Song3", MusicC) var Stop:int:=GUI.CreateButton(100,55,0,"Stop",S) loop exit when GUI.ProcessEvent end loop [/syntax] Please specify what version of Turing you are using <Answer Here> |
Author: | Tony [ Wed May 04, 2011 6:27 pm ] |
Post subject: | RE:Help with Music and Buttons |
compare the documentation between Music.PlayFile and Music.PlayFileReturn |
Author: | xXKennyXx [ Wed May 04, 2011 9:34 pm ] |
Post subject: | Re: Help with Music and Buttons |
Thanks! Now is there anyway to play the song again if i stop it? |
Author: | Tony [ Wed May 04, 2011 10:54 pm ] |
Post subject: | RE:Help with Music and Buttons |
You'd have to handle those parts yourself. |
Author: | xXKennyXx [ Thu May 05, 2011 9:16 pm ] |
Post subject: | Re: Help with Music and Buttons |
The thing is that i just started to use GUI and i have no idea what to do, can you lead me into the direction of where i need to go? |