FORUMS: list search recent posts

Stopping FLVPlaypack component

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Eyla Smith
Stopping FLVPlaypack component
on Feb 15, 2011 at 10:23:27 pm

Greeting,

I have problem stopping FLVPlaypack component when I navigate from one frame to another frame that the play which has 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();
}


Return to posts index

demetri tashie
Re: Stopping FLVPlaypack component
on Feb 15, 2011 at 11:12:08 pm

i suspect that your file is not set up properly. for instance:

is the actionscript all on the first frame, carried over all the other frames?

are the buttons likewise carried over all the fames?

is the video component only on the first frame? ( if so you will get other errors when navigating from another frame, for there will be no 'vi' to access).

however, if you reverse the order that the function is calling its methods, it will be better at any rate.
in other words, you first tell the video player to stop, and THEN you navigate away from the frame, like this for example:
function bt2(evt:MouseEvent) {
vi.stop();
gotoAndStop(2);
}


depending on your set up, you might also need some conditional statement in there to protect from generating errors. in which case this is one way to make it work
stop();
vi.source="yourVideo.flv"
vi.stop();
b1.addEventListener(MouseEvent.CLICK, bt1);
b2.addEventListener(MouseEvent.CLICK, bt2);
b3.addEventListener(MouseEvent.CLICK, bt3);

function bt1(evt:MouseEvent) {

if(currentFrame==1){
vi.stop();}
gotoAndStop(1);
}
function bt2(evt:MouseEvent) {
if(currentFrame==1){
vi.stop();}
gotoAndStop(2);
}
function bt3(evt:MouseEvent) {

if(currentFrame==1){
vi.stop();}
gotoAndStop(3);
}

hope that helps


Return to posts index

Eyla Smith
Re: Stopping FLVPlaypack component
on Feb 16, 2011 at 2:43:33 am

Thank you somuch for your clear explanation
The the video component is only on the first frame.
Now I know that navigate to a new frame, will make losing the reference to the vi FLVPlayback object.

but how can I fix this problem??

Can I user Event.Ext_FRAME and if yes how can I use it in my case??

all what I need is to stop the play when exiting the frame each time.

Regards,


Return to posts index



demetri tashie
Re: Stopping FLVPlaypack component
on Feb 16, 2011 at 3:21:50 am

the second set of code in my previous response(repeated below) should then work in that case, since it will only try to stop the video IF the current frame is frame 1, which has the video player on it. there won't be any errors.
stop();
vi.source="yourVideo.flv"

vi.stop();
b1.addEventListener(MouseEvent.CLICK, bt1);
b2.addEventListener(MouseEvent.CLICK, bt2);
b3.addEventListener(MouseEvent.CLICK, bt3);

function bt1(evt:MouseEvent) {

if(currentFrame==1){
vi.stop();}
gotoAndStop(1);
}
function bt2(evt:MouseEvent) {
if(currentFrame==1){
vi.stop();}
gotoAndStop(2);
}
function bt3(evt:MouseEvent) {

if(currentFrame==1){
vi.stop();}
gotoAndStop(3);
}


try this, it should help


Return to posts index

Eyla Smith
Re: Stopping FLVPlaypack component
on Feb 18, 2011 at 12:50:11 am

Thank you so much for your help I really I appreciate that.

Regards,


Return to posts index

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