This site requires JavaScript, please enable it in your browser!
Greenfoot back
Denzien
Denzien wrote ...

2012/5/24

Music Problems

1
2
Denzien Denzien

2012/5/28

#
How exactly? I know it's got something to do with "return" but apart from that...
danpost danpost

2012/5/28

#
If 'backgroundmusic' is the name of a public field that holds the GreenfootSound object that is playing, and it is located in your world class, and you want to stop it from an actor class; then, as long as the actor is still in the world, you can use:
((<NameOfWorld>) getWorld()).backgroundmusic.stop();
You do not even have to ask if the sound is playing for this to work. If the music is not playing, no action is taken, and no errors will ensue.
Denzien Denzien

2012/5/29

#
Yes it works!!!! Finally... thanks a lot, both of you ^^
You need to login to post a reply.
1
2