How Stop sound of Flvplayer or close Video after Skip

Participant ,
May 29, 2013 May 29, 2013

Copy link to clipboard

Copied

hi , i have a FLvplayer to play an intro in first frame of my project

i put a skip button in first frame too for users that dont want to see intro , an when i click on this button i use simple "gotoAndPlay(2);" 

but i have problem with sound , cause the sound of my video still playing in frame 2 ( after click skip )

i try to add "SoundMixer.stopAll();" function to my skip button and this work for stop sound of flvplayback but it cause conflict to my mp3 player in frame 2 ( the script

i dont know why this happend ....

my video have instance name "intro" and i have

intro.addEventListener(Event.COMPLETE, instancecomplete);

function instancecomplete(event:Event):void {

    gotoAndStop(2)

}

to simply force to gotostop frame 2 after Intro video end ...

in other means  have two script :

1- Event.COMPLETE to say when intro video end then go to another frame (2) ...

2-simple goto script in my skip button on the same frame as intro movie is to say go to another frame (2)

the problem come when i use skip button and it seems the video still played in background and when end the Event.COMPLETE run too !!

so what script i need to use for close this video for my skip button ? this may solve my sound of flv player too

thanks

TOPICS
ActionScript

Views

1.1K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , May 29, 2013 May 29, 2013
at the beginning of your code in the first frame write:import fl.video.VideoEventthen changefunction instancecomplete(event:Event):void {    gotoAndStop(3);    }tofunction instancecomplete(event:VideoEvent):void {    gotoAndStop(3);    }

Likes

Translate

Translate
Guru ,
May 29, 2013 May 29, 2013

Copy link to clipboard

Copied

you have to explicitly call videoplayer.stop() // assuming the instance name of your flvPlaybackcomp is "videoplayer"

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 29, 2013 May 29, 2013

Copy link to clipboard

Copied

thanks so much

this works well in my project but i get some line of errors in output after test movie :

at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::httpDoStopAtEnd()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::doUpdateTime()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

this can be happend for when i click on skip button Event.Complete cant be run and i really dont need to run ,i dont feel any error in running my swf .

is this ok to ignore this errors ?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 29, 2013 May 29, 2013

Copy link to clipboard

Copied

Make sure you use the right type of complete event.

you wrote:

(Event.COMPLETE, instancecomplete);

where it should say

(VideoEvent.COMPLETE, instancecomplete);

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/FLVPlayback.html#event:c...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 29, 2013 May 29, 2013

Copy link to clipboard

Copied

thanks again ; but i get error when i use

Scene 1, Layer 'preloader1', Frame 2, Line 11120: Access of undefined property VideoEvent.

here my script ( video instance name is "intro" and my skip button instance name is "skipbt" :

intro.addEventListener (VideoEvent.COMPLETE, instancecomplete);

function instancecomplete(event:Event):void {

    gotoAndStop(3);

   

}

skipbt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);

function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void

{

    gotoAndPlay(3);

    intro.stop();

   

    }

where is wrong ?  why sound not stop and intro.stop(); not work in skipbt ?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 29, 2013 May 29, 2013

Copy link to clipboard

Copied

at the beginning of your code in the first frame write:

import fl.video.VideoEvent

then change

function instancecomplete(event:Event):void {

    gotoAndStop(3);

   

}

to

function instancecomplete(event:VideoEvent):void {

    gotoAndStop(3);

   

}


Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 29, 2013 May 29, 2013

Copy link to clipboard

Copied

thank you so much moccamaximum

my problem is solved ...

i must mentioned that sound of flv playback not mute after click on skipbt button ...

but when i just replace this two line :

    gotoAndPlay(3);

    intro.stop();

to :

    intro.stop();

    gotoAndPlay(3);

  

everything works fine , i dont know why changing order of these two line are important   i though that Flash must run both of them but when i put  intro.stop(); in first row the probelm solved ...

maybe cause after     gotoAndPlay(3);   falsh cant find intro video cause it`s on frame 2 and when it goes to frame 3 first then flash cant find intro video anymore ...

thank you so much for spend time and help me my Friend

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

LATEST

Thank God i found this....i got the same exact problem like this....thank you thank you!!!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines