Skip to main content
Participating Frequently
May 4, 2016
Question

Stop video embedded into swf that is displayed into loader when clicking next and previous

  • May 4, 2016
  • 2 replies
  • 575 views

I am having a problem with embedded flv

I am having a main page with Next and Previous buttons, I am loading swf into this main page using addchild(loader), this swf contains flv embedded into it

The next and previous code contains the following code to remove child before adding the new child

SoundMixer.stopAll();
if(loader != null)
{
if(stage.contains(loader))
{
removeChild(loader);
}
loader.unloadAndStop();
loader = null;
}
fnLoadNext();

The problem appears when I am quickly clicking on Next or Previous Buttons, One of the old videos still working with the new one (If I click 10 times quickly on next button, video interference occurs)

Any advice for that?

This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
May 4, 2016

use:

SoundMixer.stopAll();
if(loader != null)
{
if(stage.contains(loader))
{
removeChild(loader);
}
loader.unloadAndStop();

loader = null;

this.addEventListener(Event.ENTER_FRAME,delayF);

}

function delayF(e:Event):void{

fnLoadNext();

this.removeEventListener(Event.ENTER_FRAME,delayF);

}

Participating Frequently
May 4, 2016

Nothing happened; the same problem exists. Two different videos are still playing together when I am quickly clicking on next button, again, the problem happens only when I am clicking very fast on the Next button (10 clicks per a second) but if I am clicking in normal way, no problem occurs

Any idea?

kglad
Community Expert
Community Expert
May 4, 2016

did you add similar code every place/frame where you leave a frame with a loader?

kglad
Community Expert
Community Expert
May 4, 2016

insert a frame loop delay between your unloadAndStop and the start of the next video.

Participating Frequently
May 4, 2016

What do you mean?

Please clarify