FORUMS: list search recent posts

Switch language (audio and lyric) seemlessly in Adobe Flash

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Keith Anthony
Switch language (audio and lyric) seemlessly in Adobe Flash
on Jun 17, 2013 at 8:42:51 am

I’m creating a multilingual flash game with multilingual narrations. Till now i’ve got one language with an audio stream and lyric to accompany it in it’s own timeline controlled by a button on the main timeline to pause and play. I would like to add 2 more languages with audio and own lyric(karaoke style) for each language in this scene. And eventually have buttons on the main timeline that would switch the language(audio and lyric) and seamlessly continue from where the last language left off. Till now i have this action from the main timeline controlling the audio and lyric. englyr being the movie clip, with audio and lyric in it.
toggleButton.addEventListener(MouseEvent.CLICK, toggleClick3);
toggleButton.buttonState = "off";

function toggleClick3(event:MouseEvent) {
if (toggleButton.buttonState == "on") {
englyr.play();
toggleButton.buttonState = "off";
} else {
toggleButton.buttonState = "on";
englyr.stop();
}
}

I’m assuming i should put the other 2 languages as well as their lyric in englyr so that i can disable/mute languages that are not needed to be heard or seen. One problem is i can’t group the lyric and the narration(2 layers) together as a movie clip in that timeline. Therefore cannot disable the 2 other languages that shouldn’t be heard or seen. Any solutions?


Return to posts index

Sam Mattern
Re: Switch language (audio and lyric) seemlessly in Adobe Flash
on Jun 18, 2013 at 1:50:58 pm

I would create an object for each audio/lyric combo. All three lyrics/audio combos behave the same way, so each should be an instance of the same type of object.

Then you need to have a function in that object that tracks how far along in the audio the currently playing audio is. When you need to switch to a different language, you load that object and specify the start time in the play command.

I updated your code to show you how to use sound channel to get the position when you pause the audio and then use it to specify the start place of the audio. You'll need to take this a few steps further to transfer that position to your new audio/lyrics object.


var soundChan:SoundChannel;
var pausePosition:int;
function toggleClick3(event:MouseEvent) {

if (toggleButton.buttonState == "on") {
soundChan = englyr.play(pausePosition);
toggleButton.buttonState = "off";
} else {
pausePosition = soundChan.position;
toggleButton.buttonState = "on";
soundChan.stop();
}
}


-Sam


Return to posts index

Keith Anthony
Re: Switch language (audio and lyric) seemlessly in Adobe Flash
on Jun 19, 2013 at 10:03:23 am

Thanks. this seems the way to go... i'll give some more time researching.. thanks again


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]