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

2013/3/24

adding sound to my object

1
2
geekykid2013 geekykid2013

2013/3/24

#
i am adding sound to my object but when i compile and run greenfoot i get a runtime error. the sound file is working fine and in .wav format. how can i amend this problem?
public class Ball extends Actor
{
    private int deltaX;
    private int deltaY;
   
    /**
     * Create a ball with random movement
     */
    {
        
        deltaX = Greenfoot.getRandomNumber(11) - 5;
        deltaY = Greenfoot.getRandomNumber(11) - 5;
    }
    


     /**
     * Act, Move and Produce Smoke
     * 
     */
    public void act() 
    {
       makeSmoke(); // use this code to declare make smoke
       move(); // use this code to declare your object to move
       
    }    
    
    /**
     *  Move the ball. Then check whether we've hit a wall
     */
    public void move()
    {
        setLocation (getX() + deltaX, getY() + deltaY);
        checkWalls(); // use this code to check that the object has hit a wall
         Greenfoot.playSound("breathe.wav");
        
    }
    
    /**
     * Produce a puff of smoke
     */
    public void  makeSmoke()
    {
        getWorld().addObject ( new Smoke(), getX(), getY());
        
        
    }
    /**
     * Check whether we've hit one of the walls. Reverse direction if necessary
     */
    private void checkWalls()
    {
        if (getX() == 0 || getX() == getWorld().getWidth()-1) {
            deltaX = - deltaX;
        }
        if (getY() == 0 || getY() == getWorld().getHeight()-1) {
            deltaY = - deltaY;
            
        }
    }
   
}
danpost danpost

2013/3/24

#
Please copy/paste the complete error message in this discussion.
geekykid2013 geekykid2013

2013/3/24

#
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.makeSmoke(Ball.java:50)
	at Ball.act(Ball.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.makeSmoke(Ball.java:50)
	at Ball.act(Ball.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Smoke.<init>(Smoke.java:21)
	at Ball.makeSmoke(Ball.java:49)
	at Ball.act(Ball.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 8 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Smoke.act(Smoke.java:30)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Smoke.shrink(Smoke.java:47)
	at Smoke.act(Smoke.java:29)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.act(Ball.java:33)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.move(Ball.java:43)
	at Ball.act(Ball.java:32)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.makeSmoke(Ball.java:52)
	at Ball.act(Ball.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.checkWalls(Ball.java:65)
	at Ball.move(Ball.java:42)
	at Ball.act(Ball.java:32)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 8 more
java.lang.IllegalArgumentException: Could not open sound file: Wind-SoundBible.com-716160210.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.makeSmoke(Ball.java:52)
	at Ball.act(Ball.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind-SoundBible.com-716160210.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind-SoundBible.com-716160210.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.move(Ball.java:43)
	at Ball.act(Ball.java:32)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind-SoundBible.com-716160210.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: breathe.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.move(Ball.java:43)
	at Ball.act(Ball.java:32)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: breathe.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: breathe.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.move(Ball.java:43)
	at Ball.act(Ball.java:32)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: breathe.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
geekykid2013 geekykid2013

2013/3/24

#
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at smoke.act(smoke.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at smoke.act(smoke.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at smoke.act(smoke.java:31)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at smoke.<init>(smoke.java:21)
	at basket.makeSmoke(basket.java:47)
	at basket.act(basket.java:38)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 8 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.makeSmoke(basket.java:48)
	at basket.act(basket.java:38)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.makeSmoke(basket.java:48)
	at basket.act(basket.java:38)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:34)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:34)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 6 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: Wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: Wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.move(basket.java:28)
	at basket.act(basket.java:42)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.makeSmoke(basket.java:52)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.makeSmoke(basket.java:52)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at basket.makeSmoke(basket.java:52)
	at basket.act(basket.java:41)
	at greenfoot.core.Simulation.actActor(Simulation.java:565)
	at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
	at greenfoot.core.Simulation.runContent(Simulation.java:213)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 7 more
danpost danpost

2013/3/24

#
(1) Did you place the sound file ("breathe.wav") in the 'sounds' folder of your scenario folder; (2) Will the sound file play when you double-click on the file within the directory listing; (3) Are you sure your sound file is called "breathe.wav", exactly (case matters here). Aside from these, you are asking Greenfoot to play that sound file every act method, which may or may not be causing problems. That is, the 'act' method is calling 'move' each time and the 'move' is requesting that the sound file be played each time. Insert the following at line 9 in your posted code:
public Ball()
then, remove line 35 and insert it back at line 13.
danpost danpost

2013/3/24

#
The error message you gave shows that the file "Wind.wav" (or "wind.wav" at another point in the error listing) is trying to be accessed. The code you gave above does not reference that sound file.
geekykid2013 geekykid2013

2013/3/24

#
(1) I have created a new sound file in the greenfoot scenarios folder and placed my sound file there. (2) the sound file does play when double clicked from with the directory. (3) the sound file is named wind.wav (not breathe.wav as earlier posted). (4) I have inserted line 1 (public Ball() into line 9) (5) I have removed line 35 and inserted into line 13. But I still get a run-time error public class Ball extends Actor { private int deltaX; private int deltaY; /** * Create a ball with random movement */ public Ball() { deltaX = Greenfoot.getRandomNumber(11) - 5; deltaY = Greenfoot.getRandomNumber(11) - 5; Greenfoot.playSound("wind.wav"); } /** * Act, Move and Produce Smoke * */ public void act() { makeSmoke(); // use this code to declare make smoke move(); // use this code to declare your object to move } /** * Move the ball. Then check whether we've hit a wall */ public void move() { setLocation (getX() + deltaX, getY() + deltaY); checkWalls(); // use this code to check that the object has hit a wall } /** * Produce a puff of smoke */ public void makeSmoke() { getWorld().addObject ( new Smoke(), getX(), getY()); } /** * Check whether we've hit one of the walls. Reverse direction if necessary */ private void checkWalls() { if (getX() == 0 || getX() == getWorld().getWidth()-1) { deltaX = - deltaX; } if (getY() == 0 || getY() == getWorld().getHeight()-1) { deltaY = - deltaY; } } } Run-time error java.lang.IllegalArgumentException: Could not open sound file: wind.wav at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66) at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120) at greenfoot.Greenfoot.playSound(Greenfoot.java:162) at Ball.<init>(Ball.java:23) at Box.<init>(Box.java:21) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at greenfoot.core.Simulation.newInstance(Simulation.java:578) at greenfoot.platforms.ide.WorldHandlerDelegateIDE$3.run(WorldHandlerDelegateIDE.java:408) at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:465) at greenfoot.core.Simulation.maybePause(Simulation.java:279) at greenfoot.core.Simulation.runContent(Simulation.java:210) at greenfoot.core.Simulation.run(Simulation.java:203) Caused by: java.io.FileNotFoundException: Could not find file: wind.wav at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534) at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99) ... 13 more java.lang.IllegalArgumentException: Could not open sound file: wind.wav at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66) at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120) at greenfoot.Greenfoot.playSound(Greenfoot.java:162) at Ball.<init>(Ball.java:23) at Box.<init>(Box.java:21) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at greenfoot.core.Simulation.newInstance(Simulation.java:578) at greenfoot.platforms.ide.WorldHandlerDelegateIDE$3.run(WorldHandlerDelegateIDE.java:408) at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:465) at greenfoot.core.Simulation.maybePause(Simulation.java:279) at greenfoot.core.Simulation.runContent(Simulation.java:210) at greenfoot.core.Simulation.run(Simulation.java:203) Caused by: java.io.FileNotFoundException: Could not find file: wind.wav at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534) at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99) ... 13 more
geekykid2013 geekykid2013

2013/3/24

#
sorry let me resubm
public class Ball extends Actor
{
    private int deltaX;
    private int deltaY;
   
    /**
     * Create a ball with random movement
     */
        public Ball()  
    {
        
        
        deltaX = Greenfoot.getRandomNumber(11) - 5;
        deltaY = Greenfoot.getRandomNumber(11) - 5;
        Greenfoot.playSound("wind.wav");
    }
    


     /**
     * Act, Move and Produce Smoke
     * 
     */
    public void act() 
    {
       makeSmoke(); // use this code to declare make smoke
       move(); // use this code to declare your object to move
       
    }    
    
    /**
     *  Move the ball. Then check whether we've hit a wall
     */
    public void move()
    {
        setLocation (getX() + deltaX, getY() + deltaY);
        checkWalls(); // use this code to check that the object has hit a wall
         
        
    }
    
    /**
     * Produce a puff of smoke
     */
    public void  makeSmoke()
    {
        getWorld().addObject ( new Smoke(), getX(), getY());
        
        
    }
    /**
     * Check whether we've hit one of the walls. Reverse direction if necessary
     */
    private void checkWalls()
    {
        if (getX() == 0 || getX() == getWorld().getWidth()-1) {
            deltaX = - deltaX;
        }
        if (getY() == 0 || getY() == getWorld().getHeight()-1) {
            deltaY = - deltaY;
            
        }
    }
   
}
it my code and run time error in the correct format
geekykid2013 geekykid2013

2013/3/24

#
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.<init>(Ball.java:23)
	at Box.<init>(Box.java:21)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at greenfoot.core.Simulation.newInstance(Simulation.java:578)
	at greenfoot.platforms.ide.WorldHandlerDelegateIDE$3.run(WorldHandlerDelegateIDE.java:408)
	at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:465)
	at greenfoot.core.Simulation.maybePause(Simulation.java:279)
	at greenfoot.core.Simulation.runContent(Simulation.java:210)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 13 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.<init>(Ball.java:23)
	at Box.<init>(Box.java:21)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at greenfoot.core.Simulation.newInstance(Simulation.java:578)
	at greenfoot.platforms.ide.WorldHandlerDelegateIDE$3.run(WorldHandlerDelegateIDE.java:408)
	at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:465)
	at greenfoot.core.Simulation.maybePause(Simulation.java:279)
	at greenfoot.core.Simulation.runContent(Simulation.java:210)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 13 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.<init>(Ball.java:23)
	at Box.<init>(Box.java:21)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at greenfoot.core.Simulation.newInstance(Simulation.java:578)
	at greenfoot.platforms.ide.WorldHandlerDelegateIDE$3.run(WorldHandlerDelegateIDE.java:408)
	at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:465)
	at greenfoot.core.Simulation.maybePause(Simulation.java:279)
	at greenfoot.core.Simulation.runContent(Simulation.java:210)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 13 more
java.lang.IllegalArgumentException: Could not open sound file: wind.wav
	at greenfoot.sound.SoundExceptionHandler.handleIOException(SoundExceptionHandler.java:66)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:120)
	at greenfoot.Greenfoot.playSound(Greenfoot.java:162)
	at Ball.<init>(Ball.java:23)
	at Box.<init>(Box.java:21)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at greenfoot.core.Simulation.newInstance(Simulation.java:578)
	at greenfoot.platforms.ide.WorldHandlerDelegateIDE$3.run(WorldHandlerDelegateIDE.java:408)
	at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:465)
	at greenfoot.core.Simulation.maybePause(Simulation.java:279)
	at greenfoot.core.Simulation.runContent(Simulation.java:210)
	at greenfoot.core.Simulation.run(Simulation.java:203)
Caused by: java.io.FileNotFoundException: Could not find file: wind.wav
	at greenfoot.util.GreenfootUtil.getURL(GreenfootUtil.java:534)
	at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:99)
	... 13 more
danpost danpost

2013/3/24

#
Maybe you misunderstood. There is a 'sounds' folder within your scenario folder. The sound file must be in that 'sounds' folder (not just in the scenario folder).
geekykid2013 geekykid2013

2013/3/24

#
no their was no sound folder at all in the scenarios folder so I ad to create one in order to store sound file wind.wav. but I still receive the run-time error once I compile and run the program
danpost danpost

2013/3/24

#
The folder must be named "sounds" precisely.
geekykid2013 geekykid2013

2013/3/24

#
well I have now changed the sound folder to "sounds" in my Greenfoot folder from my program files folder (x86). Again I have compiled and run the program but now I do not get a white screen (Greenfoot world) and nothing is shown on the screen and I get the same run-time error.
danpost danpost

2013/3/24

#
Again, you are not paying attention to what I am saying. Your 'Greenfoot' folder has a 'scenarios' folder. The 'scenarios' folder has folder for each of your scenario. Each of these scenario folders should have (1) an 'images' folder and a 'sounds' folder. The 'sounds' folder within the scenario folder, which is the project you are working on, is where you need to put that sound file.
geekykid2013 geekykid2013

2013/3/25

#
public class basket extends Actor { int speed = 10; /** * Act - do whatever the basket wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void move() { //System.out.println("move funtion called"); /*if (Greenfoot.isKeyDown("up")){ setLocation(getX(), getY()-1); } if (Greenfoot.isKeyDown("down")){ setLocation(getX(), getY()+1); }*/ if (Greenfoot.isKeyDown("left")&& getX()>10+getImage().getWidth()/2){ setLocation(getX() - speed, getY()); Greenfoot.playSound("wind.wav"); } if (Greenfoot.isKeyDown("right")&& getX() <getWorld().getWidth()-getImage().getWidth()/2-10){ setLocation(getX()+ speed, getY()); } } public void act() { makeSmoke(); // use this code to declare make smoke move(); } /** * Produce a puff of smoke */ public void makeSmoke() { getWorld().addObject ( new smoke(), getX(), getY()); } //public boolean atWorldEdge() // How to make the new object appear automatically onto the stage //if (getX() < 10 || getX() > getWorld().getWidth() - 10) { // return true; // } //if (getY() < 10 || getY() > getWorld().getHeight() - 10) { // return true; //} //return false; //} }
There are more replies on the next page.
1
2