HOw to play sound from swf library in javascript

637 views Asked by At

i'm not a flash developer, so i don't know if this is possible, please clarify it if you can :)

My situaion: I have to play some sound on a webpage with javascript, and probably flash is the best choise, so i created an swf library with mi sounds wit swfmill: http://swfmill.org/

this is my code:

<?xml version="1.0" encoding="iso-8859-1" ?>    
<movie width="320" height="240" framerate="12">
  <background color="#ffffff"/>
  <frame>
        <library>
            <sound id="incoming" import="incoming.mp3" />
            <sound id="outgoing" import="outgoing.mp3" />
        </library>
    </frame>
</movie>

I converted it with swfmill and now i have my sound.swf library.

Is it possible to play a sound from this library in javascript? or i'm missing something? Can you please provide a valid alternative?

Thank you very much and sorry for my english!

1

There are 1 answers

2
Jase On

Flash has a built in system to interact with javascript using the ExternalInterface class.

not completely read through this but it might guide you in the right direction

http://www.viget.com/inspire/bi-directional-actionscript-javascript-communication/

If you've downloaded a premade flashplayer, you might want to check their api to see if they allow this

EDIT: You will need an swf player for my post. However, it still shows javascript and flash interaction to get stuff you need. You can then use a swf media player or HTML 5 to play the audio