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?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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

#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
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

#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
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:
1
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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

#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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