세 개의 프레임이 있으며 각각 자체 애니메이션 동영상 클립이 있습니다. 다음 장면으로 이동하려면 현재 장면에서 버튼을 누르면 프레임 2로 이동합니다.
세 개의 동영상 클립 각각에 오디오가 있지만 버튼을 클릭하여 장면 2로 이동하면 장면 1의 오디오가 계속 재생됩니다.
클릭하여 프레임 2로 이동하면 프레임 1 무비 클립의 오디오가 중지되고 프레임 2 무비 클립 오디오가 시작되도록하려면 어떻게해야합니까?
Sound 객체에 SoundChannel이 연결되어 있는지 확인하십시오 .
그런 다음 단순히 soundChannel.stop()
다음 버튼 기능에 지정하십시오.
프레임 1 :
//create a sound class to hold the sound
var f1sound:Sound = new Sound();
//soundchannel to control your sound to play and pause
var sChannel:SoundChannel = new SoundChannel();
//this setup function will load and autoplay your sound file
function setUp():void {
f1sound.load(new URLRequest("frame1sound.mp3")); //load your sound file
f1sound.play();
//add the event for the Next Button, remember to change it to your actual button name
nextButton.addEventListener(MouseEvent.MOUSE_DOWN, nextBtnDown);
}
function nextBtnDown():void {
nextButton.removeEventListener(MouseEvent.MOUSE_DOWN, nextBtnDown);
sChannel.stop(); //this stop the audio
f1sound.close(); //this unloads the sound stream for cleaning purposes
gotoAndStop(2); //go to frame 2, put this as the last line of the function
}
setUp(); //this will make the program run setUp function on the first run, once.
다음 프레임은 기본적으로이 프레임과 동일합니다. 어떤 프레임으로 건너 뛰든, 앞뒤로 이동하든이 형식을 유지하는 한 작동해야합니다. 오디오가 완전히로드 된 후에 만 오디오를 재생하는 것과 같이 수행해야 할 다른 최적화가 있지만, 찾아보고 탐색 할 수 있도록 남겨 둘 것입니다. 행운을 빕니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다