Skip to main content
Known Participant
September 14, 2010
Question

Adding sound to a movie with AS

  • September 14, 2010
  • 1 reply
  • 706 views

Would you help me with adding a simple sound to a movie with AS?  I'd prefer this, since I already have simple "Roll On", and "Roll Out" script in place.

I have imported the sound file. In Properties, under Label, I have named it "tire_squeal". (Also, created a layer within the movie, and dragged the file onto the stage - all done.)  Is this necessary when using Actionscript, or not?

The sound file loaded into my Library is named, "tire_screech.wav"

I want the sound to load "stopped", then play OnRollOver, and quit OnRollOut. (See previous AS code in string.)

Thx.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 14, 2010

remove your sound from everywhere but the library.  right click your library sound, click linkage, tick export for actionscript and assign a linkage id (eg, screechID) and click ok.

in your actions panel add:

var screech:Sound=new Sound(this);

screech.attachSound("screechID");

and in your rollover, add:

screech.start();

and in your rollout, add:

screech.stop();

ommvc61Author
Known Participant
September 14, 2010

Ah yes, the Linkage thing, that's what I was forgetting. I'll give it a try....

ommvc61Author
Known Participant
September 14, 2010

Thank you, this is working. Prior to trying in AS, I had a Loop added to the audio play, but lost it now in AS. What would I add to the "OnRollOver" code to make it loop?