Groups | Blog | Home
all groups > flash actionscript > september 2005 >

flash actionscript : synchronising audio with flash animation


tralfaz
9/24/2005 9:11:29 AM
[quoted text, click to view]

if(timeLapsed == markers){

You need 2 equals signs or you are setting it, not checking it.
Didn't check the rest of your code.
tralfaz

tralfaz
9/24/2005 9:21:53 AM
"jasonfrncs@tiscali.co.uk" <webforumsuser@macromedia.com> wrote in
message news:dh3aeo$dif$1@forums.macromedia.com...
[quoted text, click to view]

I took a closer look at your code. Sorry, but it doesn't really make
any sense. The for loop runs in a few micro seconds which won't do
what you want. If you need to keep checking for the progress of a
sound being played you will need to use onEnterFrame or setInterval to
check on the sound progress. Anyway, the code would have to be
re-designed (where does the marker value get set?) but motionMaker's
suggestion are probably better way to go.
good luck,
tralfaz

jasonfrncs NO[at]SPAM tiscali.co.uk
9/24/2005 10:40:24 AM
I want to make a slideshow type presentation with audio, and I want different
points in that audio to trigger the main timeline to play. I worked when
exactly (in seconds) I want the timeline to play, and I put all those times
into an array. I also defined some variables for sound.position and
sound.duration. Then I initiated a for-loop which (I thought) would check the
sound.position against an element in my array, and if it was the same then it
would play the main timeline. However, its not working. Can anyone tell me
what I've done wrong? Or whether this can even be achieved at all!!!

Here is my script:

stop();
markers = new
Array(138,210,303,393,441,492,540,615,633,684,735,795,843,909,1089,1350,1464);
mySound = new Sound();
mySound.attachSound("soundID");
mySound.start();
var timeComplete = mySound.duration * 1000
for(var i=0; i<=timeComplete; i++){
var timeLapsed = mySound.position * 1000 // I did this to change the
milliseconds to seconds \\
if(timeLapsed = markers){
play();
}
}
Motion Maker
9/24/2005 11:28:13 AM
If the sound is not very long, I simply like to import the sound and place
it in a MovieClip as a stream synch setting. Then you can simply place the
items you want on other layers. As well you can slide the playback head with
the mouse as a way to hear the sound and see the timed animation.

Although this one does not have any images timed, it does show the process.

http://www.hosfordusa.com/ClickSystems/courses/flash/examples/ControllingSoundOnMovieClips/ControllingSoundOnMovieClipsEx01.php


Another approach is the same as the above, but use separate movies for each
sound file and just use the root timeline. Then you can have the dynamic
effect of loading the external swfs with LoadMovie. This is my favorite
approach.

For external sound using Sound object, you do have some ActionScript work
ahead of you. But that alternative may necessary based on size of sound
files.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
I want to make a slideshow type presentation with audio, and I want
different
points in that audio to trigger the main timeline to play. I worked when
exactly (in seconds) I want the timeline to play, and I put all those times
into an array. I also defined some variables for sound.position and
sound.duration. Then I initiated a for-loop which (I thought) would check
the
sound.position against an element in my array, and if it was the same then
it
would play the main timeline. However, its not working. Can anyone tell me
what I've done wrong? Or whether this can even be achieved at all!!!

Here is my script:

stop();
markers = new
Array(138,210,303,393,441,492,540,615,633,684,735,795,843,909,1089,1350,1464);
mySound = new Sound();
mySound.attachSound("soundID");
mySound.start();
var timeComplete = mySound.duration * 1000
for(var i=0; i<=timeComplete; i++){
var timeLapsed = mySound.position * 1000 // I did this to change the
milliseconds to seconds \\
if(timeLapsed = markers){
play();
}
}

Travise Newbury
9/24/2005 11:30:13 AM
"jasonfrncs@tiscali.co.uk" <webforumsuser@macromedia.com> said:

[quoted text, click to view]

Put the times in revers order. Then loop through the array of times,
checking to see if the time is "less than" the curent position. If
it is, then check to see if the current slide is already being
displayed. Display when appropriate, and exit the loop.

Doing it in revers order like this eliminates the need to check for a
start and a stop time.

--
AddThis Social Bookmark Button