Greeting,
I have problem stopping FLVPlaypack component when I navigate from one frame to another frame that the play which has 开发者_Python百科instance name (vi) still working in back ground. when the flash loaded I used vi.stop() to stop the play also I added same line to each function that would be called when a button clicked but when I click any button the sound still playing in the background and when I click on the button(b1) which navigate to frame 1 which has the player, the player would be stopped but the sound is still playing.
Please help me to solve this problem. all what I want is to stop the player when I navigate to another frame.
here is my code:
stop();
vi.stop();
b1.addEventListener(MouseEvent.CLICK, bt1);
b2.addEventListener(MouseEvent.CLICK, bt2);
b3.addEventListener(MouseEvent.CLICK, bt3);
function bt1(evt:MouseEvent) {
gotoAndStop(1);
vi.stop();
}
function bt2(evt:MouseEvent) {
gotoAndStop(2);
vi.stop();
}
function bt3(evt:MouseEvent) {
gotoAndStop(3);
vi.stop();
}
call "vi.stop();" before navigating to a new frame
Here's what the code should look like:
stop();
vi.stop();
b1.addEventListener(MouseEvent.CLICK, bt1);
b2.addEventListener(MouseEvent.CLICK, bt2);
b3.addEventListener(MouseEvent.CLICK, bt3);
function bt1(evt:MouseEvent) {
vi.stop();
gotoAndStop(1);
}
function bt2(evt:MouseEvent) {
vi.stop();
gotoAndStop(2);
}
function bt3(evt:MouseEvent) {
vi.stop();
gotoAndStop(3);
}
Once you navigate to a new frame you are losing the reference to the vi FLVPlayback object.
For each frame that the user navigates to just add SoundMixer.stopAll();
精彩评论