Groups | Blog | Home
all groups > flash actionscript > july 2006 >

flash actionscript : Song loop from particular time


Andrew20
7/14/2006 7:54:44 PM
Ok,

I think this is something easy, but I dont know what to use.

I got a song that I cut at 54.4 sec and after the first complete play I want
this song to loop from 11.95 sec to the end!
Is there a way using action script or using a movie clip with the song
inside(cause I tried to put a gotoandplay to a particular frame at the end, but
it begin the song from the beginning)

thanks a lot in advance
albee
7/14/2006 8:55:02 PM
Use the Sound class. Let's say your song is named mysong.mp3. Once you import
it into your library, select the icon in the library, and choose linkage (right
click on the icon) and then click Export for ActionScript and Export in first
frame. Name it something (for this example we'll name it mysong). Click OK.

Then on your main timeline, enter the following code:

my_sound = new Sound();
my_sound.attachSound("mysong");
my_sound.onSoundComplete = function() {
// first parameter is the number of seconds the sound is offset, the
second parameter is the number of loops
my_sound.start(11.95, 99);
};

When you want to start the sound the first time, add this to your frame or
button code:
my_sound.start();

Study the other methods and properties of the Sound class. This gives you a
lot more control of sounds than placing them on the timeline does.

Good luck,

Albee

Andrew20
7/19/2006 3:53:21 PM
WOW!
it's really an helpfull complete answer!!

thanks a lot Albee!
AddThis Social Bookmark Button