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

2013/10/26

static and non-static

fluttershy fluttershy

2013/10/26

#
"
GreenfootSound.setVolume (volume);
non-static method seVolume(int) cannot be referenced from a static context " What is this and how do I fix it?
danpost danpost

2013/10/26

#
That means you cannot set the volume of a class (the GreenfootSound class). You need to create an object of that class and set the volume of it.
GreenfootSound gfs = new GreenfootSound("soundfilename.wav");
gfs.setVolume(volume);
fluttershy fluttershy

2013/10/26

#
Thank you so much!
You need to login to post a reply.