Dr. Dobb's Portal

Section 3: Silverlight Game

Table of Contents


3.1.5Playing sound effects

Playing sound effects is very simple. First we need to find the media element through its name and we stop it to ensure it is at the beginning state. Then we invoke the play method. The following code shows this approach:

		var sfx = 
		    control.content.findName("ball_hits_brick_destroys_mp3");
		sfx.stop();
		sfx.play();
									




NAVIGATION

Flipbook Advertisement