Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

java

  • 11-03-2003 04:21PM
    #1
    Closed Accounts Posts: 5,093 ✭✭✭


    hi im only a first yr in software development but i developed this applet but it wont work. its meant to have a picture of thomas the tank engine and when you press the button it makes the sound of a train but the pic wont appear. can anyone help?


Comments

  • Closed Accounts Posts: 5,093 ✭✭✭woosaysdan


    this is the pic i cant post the audio file


  • Registered Users, Registered Users 2 Posts: 6,240 ✭✭✭hussey


    well firstly you have :

    image = getImage(getDocumentBase(),getParameter("file"));
    audio = getAudioClip(getDocumentBase(),getParameter("file"));

    so they are looking for the same paramater


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    and

    Image image;
    AudioClip audio;

    these have to be given a specific name, so if you audio file is TANK.WAV, or TANK.JPG, they have to be assigned as such.

    forums.java.sun.com is an excellent resource for all things java


  • Registered Users, Registered Users 2 Posts: 6,240 ✭✭✭hussey


    Dunno bout that gone Shooting

    just another thing I noticed
    you have :
    <param name = "file" value = "thomas4.jpg>
    you are missing a "................................... ^^here

    This code worked ok for me
    <html>
    <applet code = "train.class" width= 300 height= 300>
    <param name = "file" value = "thomas4.jpg">
    </applet>
    </html>
    
    public class train extends Applet
    {
    	Image image;
    	//AudioClip audio;
    	public void init()
    	{
    	image = getImage(getDocumentBase(),getParameter("file"));
    	}
    	public void paint(Graphics g)
    	{
    		g.drawImage(image,10,10,this);
    		
    	}
    }
    

    I've edited it a bit but not much


  • Closed Accounts Posts: 5,093 ✭✭✭woosaysdan


    cheers i'll try that thanks.


  • Advertisement
Advertisement