views:

19

answers:

1

So I'm trying to get sound on my flex application. Then tried to load an swf movie with only audio in it. But when it loads on init(), it loops non-stop. Here's a sample code:

        [Embed(source="assets/alert03.swf")]
        private var alert01Swf:Class;
        private var alert01Loader:MovieClip;

        private function init():void {
            alert01Loader = MovieClip(new alert01Swf());
            alert01Loader.stop();
            alert01Loader.gotoAndStop(0, null);
            //this.addChild(alert01Loader);
        }

It just goes beserk! And I can't stop it. I tried using OGG but it was just to slow in loading. Mp3 is no good because it just isn't free. Any suggestions on using audio in Flex would also be great!

A: 

stop() and gotoAndStop functions control the frame navigation - do you have appropriate functions defined in those frames?

Define stopAudio/playAudio functions in the alert03.swf's document class and call them from the main SWF.

Amarghosh
I did create the swf file with 5 frames in it then inserted the "alert03.wav" on it. I did the same with another swf although it was images.Anyway, i'm not really familiar with scripting in flash itself. Do you put those function in the action section?Thanks alot.
Naze Kimi
I am not familiar with just inserting a sound file - I normally use `Sound` class for loading; it has play and stop functions that can be handy in this case.
Amarghosh