Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: AUDIO problem

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default AUDIO problem

    Hello peeps,

    I have a question...

    I am making a game with java in a program called greenfoot.

    My problem is that a sound won't play when the player dies and a Game Over screen pops up..

    - I have saved the audio file in my sound map of the scenario
    - Applied the good name of the file
    - tested the sound effect and it's working

    this is my code:

    public GameOver()
    {
    setImage(new GreenfootImage("GAME OVER", 100, Color.BLACK, null));
    Greenfoot.playSound("fail-trombone-03.wav");
    Greenfoot.stop();
    }


  2. #2
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: AUDIO problem

    Quote Originally Posted by green001 View Post
    Greenfoot.playSound("fail-trombone-03.wav");
    I neved used this Greenfoot but from a quick view at the online javadoc for the playSound method:

    The file name may be an absolute path, a base name for a file located in the project directory or in the sounds directory of the project directory.
    Andrea, www.andbin.net SCJP 5 (91%) SCWCD 5 (94%)

    Useful links for Java beginners My new project Java Examples on Google Code

  3. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: AUDIO problem

    nopee still not solved

Similar Threads

  1. Problem with Audio Files
    By haiderali in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 4th, 2013, 02:34 PM
  2. Threads, Audio Application, Audio loading twice error
    By dpjmie in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 19th, 2013, 02:18 PM
  3. audio
    By lanya in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 14th, 2013, 06:41 PM
  4. audio not working HELP
    By silverpen10 in forum The Cafe
    Replies: 0
    Last Post: December 19th, 2012, 02:29 PM
  5. Audio In My Program
    By Fordy252 in forum Java Applets
    Replies: 0
    Last Post: January 29th, 2011, 02:27 PM