Fork me on Github !

Embedding sound files in Flash avatars

fishCase: Little Polka Fish .Fla

The Polka Fish is a little fish that plays polka on command. It was made using Macromedia Flash.

In this case I have created two layers, one for the image and another for the sound. I drew the fish and imported mp3 file to Library.

1st frame:

  1. image and
  2. mp3 file with settings: sync: stop, repeat 0
    To the sound layer add actionscript: stop();

2nd frame:

  1. image and
  2. mp3 file with settings: sync: start, loop

(As an alternative to loop, one could use repeat [n] to have the sound file play as many times as one would like to.)

Flash settings

Settings for the 2nd frame. (Action scripts can be edited by clicking the little arrow icon on the right).

Then just publish the file on Flash and upload on Upstage.

Player control on UpStage: type /a 2 to start the sound and it’ll loop until you type /a 1 to stop it.

Note: apparently, to get audio to play in Flash for UpStage, it will not work if it is in the first frame; it has to be in the second.

2 COMMENTS

    here’s what ben says he did to embed sound in a flash avatar:

    I embedded the audio in a “movie Clip” and started it on Frame 2 – for some reason, starting it on frame 1 didn’t work. To get it to not loop, you need to use ActionScript. Just add the command “stop();” to the final frame of the movie clip (not the one where the music starts), and it will play once and stop (to do this – right click on the frame and select “Actions”, then simply type in what you need).

    ben also says:

    That’s the reason you need to put the sound in a movie clip rather than putting it in the main document. The way it works in the new version is like this (it should be roughly the same in the old one too).

    1. Add a new symbol (type = “movie clip): this gives you a usable element which has its own keyframes – I think of it like a small flash file within the big flash file. Give it a name that makes sense and is easy to remember.
    2. Add the like you did in the main file, making sure that the sound starts in frame 2 of the clip (I don’t know why).
    3. Add the stop() code to the last frame of the movie clip (not to the flash file itself)
    4. Add the movie clip to the keyframe where you want it to start in the flash file.

    If you do that, it should avoid looping the sound and not stop the animation. Incidentally, the animation should probably be in a separate movie clip.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.