Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2011
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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;
    		}
    		
    	}
    }

  • #2
    New to the CF scene
    Join Date
    Dec 2011
    Location
    USA
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Funny enough i had the same problem, my friend fixed it for me. I will see if i can get results from him


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •