Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-14-2011, 05:33 PM   PM User | #1
pineappelle
New Coder

 
Join Date: Jun 2011
Posts: 34
Thanks: 1
Thanked 0 Times in 0 Posts
pineappelle is an unknown quantity at this point
Getting sound to work with jcreator

i have this code and i want to make the sound work. right now the sound isnt working. the sound file is in the right folders and the picture is working

Code:
/**
 * @(#)chapter11random.java
 *
 * chapter11random Applet application
 *
 * @author 
 * @version 1.00 2011/12/12
 */
 
import java.awt.*;
import java.applet.*;

public class chapter11random extends Applet {
	
	Graphics screen;
	Image mypicture;
	AudioClip mysound;
	int x, xmove, running;
	
	public void init() {
		
		mypicture=getImage(getCodeBase(),"pineapple.jpg");
		mysound=getAudioClip(getCodeBase(),"newemail.wav");
		x=40;
		xmove=1;
		running=1;
		
	}
	
	public void makesound() {
		
		mysound.play();
		
	}
	
	public void paint(Graphics screen) {
		
		while (running<300) {
			screen.drawImage(mypicture,x,30,100,100,this);
			for (int i=1;i<30000000;i++) {
			}
			screen.setColor(Color.white);
			screen.fillRect(x,30,100,100);
			if(x<0||x>400) {
				xmove=xmove*-1;
				mysound.play();
			}
			x=x+xmove;
		}
		
	}
}
pineappelle is offline   Reply With Quote
Old 12-27-2011, 11:57 AM   PM User | #2
Zviko
New to the CF scene

 
Join Date: Dec 2011
Location: USA
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Zviko is an unknown quantity at this point
Funny enough i had the same problem, my friend fixed it for me. I will see if i can get results from him
Zviko is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:06 PM.


Advertisement
Log in to turn off these ads.