TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ray
NA
14
27.4k
Calling a method that plays sound, mega troubles, please help!
Nov 27 2010 11:13 AM
Hey guys, I have a million questions but the main one I need ahelp with is that I have a method in a class that plays sound and I am trying to call that method in the mainscreen class. So I create a new instance of the class that contains the makenoise method but when I create a new instance and use the method it does not work.
Also if I leave the programme to run for a bit it tells me an out of memory error, I spent hours last night trying to solve these errors but I'm at a dead end, can anyone here make any suggestions please?
Here is some code that I am using I dont want to paste it all just the parts I have written that are supposed to function:
class Alien: Enemy
{
public SoundPlayer aliensound = new SoundPlayer(Properties.Resources.scream2);
public override void MakeNoise()
{
aliensound.Play();
}
public partial class MainScreen : Form
{
Alien alien;
alien = new Alien(pictureBox1, GamePanel);
alien.MakeNoise();//this code is used in the paintevent method after an alien is removed this sound should play for it dyiing
Many thanks to anyone who takes the time to help me out, I appreciate it!!!
Ray
Reply
Answers (
1
)
Load report failed
Using Timer with event