DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Benoit has posted 48 posts at DZone. View Full User Profile

Play Sound With JavaScript And Actionscript

02.10.2011
| 2361 views |
  • submit to reddit
        

import flash.external.ExternalInterface;

ExternalInterface.addCallback("playSound", this, playSoundByName);

function playSoundByName(p_name:String):Void {
	var v_sound:Sound = new Sound();
	v_sound.attachSound(p_name);
	v_sound.start();
}



$('#my-swf').playSound('my-sound');


<a href="http://www.agenceici.com/blog">Source: </a><a href="http://www.agenceici.com">agence ici</a>