Groups | Blog | Home
all groups > flash (macromedia) > april 2004 >

flash (macromedia) : sound,independant to timeline



JIMMYD
4/23/2004 5:55:12 PM
okay, the first thing u have to do is right click on the sound in your
library. Then select linkage from the context menu that pops up. When the
linkage screen pops up make sure to check export for actionscript. This will
allow u to give your sound an identifier name. I'll call it music to
demonstrate.

on the timeline u would write this:
this.createEmptyMovieClip("soundHolder", 20);
(the 20 is the depth of the movieclip in relation to the timeline above it.
It doesnt have to be 20 but ill use this number for this example. If u have
the newest version of flash u could replace the 20 with
this.getNextHighestDepth())
var audio:Sound = new Sound(soundHolder);
audio.attachSound("music"); >>"music" is the identifier name u gave the
sound u want to attach.
audio.start();

there u go, the sound will play independent of the timeline. If you want the
sound to stop playing at the end of the scene then u would add an action to
the very last frame in the scene that looks like this:

stopAllSounds();

Hope this helps!!!

[quoted text, click to view]

bowden_i
4/23/2004 8:50:19 PM
Hi there

I've searched the net long and hard ;) for a tutorial of how to have sound in
a flash file, but independant to the timeline. I've found a few but they seem
to contradict eachother.

The issue is that I want a sound to play through a scene, but at frame 5, it
has go to and play back to 4. So in effect it jus goes frame 5-4-5-4-5. There
is no other way around this I'm afraid. When I put a sound onto a layer, it
keeps starting and starting etc. Its actually a little more complex then that,
but thats suffice.

I've tried event, stream and had no luck. If anyone could post me a link to a
resource for this, or provide me with instructions this would be immensely
appreciated.

Many thanks

Ian
Carl Fink
4/23/2004 8:57:48 PM
Rather than some programmatic solution, the first thing that
occurs to me is to put the sound in a different movie, which
you then attach or load from disk with loadMovie(). Then you
have two independent timelines, so moving around in the root
movie wouldn't affect sound played in the child.
2k_rammerizkool
4/23/2004 9:12:29 PM
AddThis Social Bookmark Button