PDA

View Full Version : VideoDisplay complete event problem


mrtabs
10-05-2007, 01:03 PM
Hi all,

i have a problem with "complete" event for VideoDisplay.
Here is my code. I only use local video files. If i play a small flv video, it works (just some seconds). But if i play a video a little bit bigger (like some minutes), the complete event doesn't happens?
Can u help me????

Thanks!!!
(and sorry about my english)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initHandler(event)" >
<mx:VideoDisplay x="153" y="138" width="368" height="286" id="vd1" source="{FLV_URL}" autoPlay="false" autoRewind="false" complete="OnComplet(event)"/>
<mx:Script>
<![CDATA[
import mx.events.VideoEvent;
import mx.controls.Alert;

[Bindable]
private var FLV_URL:String;

[Bindable]
private var FLV_URL1:String = "assets/vd1.flv";

[Bindable]
private var FLV_URL2:String = "assets/vd2.flv";

private var flag:Boolean = false;

private function initHandler(event:Event):void {
FLV_URL = FLV_URL1;
vd1.play();
}

public function OnComplet(event:VideoEvent):void {
if (flag == false) {
FLV_URL = FLV_URL2;
flag = true;
} else {
FLV_URL = FLV_URL1;
flag = false;
}
vd1.play();
}
]]>
</mx:Script>
</mx:Application>

daveTheRave
10-05-2007, 03:04 PM
You're right about one thing. you do have a problem! !

mrtabs
10-05-2007, 03:07 PM
My english is not good...sorry ...:D

did you already saw this problem?? anybody can reproduce it?

atomic
10-05-2007, 08:31 PM
Is this Flex, AS2.0 or AS3.0?

http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00003537.html

http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00003771.html

mrtabs
10-05-2007, 08:34 PM
Flex Builder 2

atomic
10-05-2007, 08:43 PM
Why aren't you posting in the Flex forum then? :confused:

mrtabs
10-05-2007, 09:03 PM
Why aren't you posting in the Flex forum then? :confused:

I said that i'm using flex...and here isnt a flex forum?????

CyanBlue
10-05-2007, 09:12 PM
You posted the thread somewhere else... I have moved it to the Flex 2 forum... Please post your question to the appropriate forum next time...

mrtabs
10-08-2007, 11:53 AM
You posted the thread somewhere else... I have moved it to the Flex 2 forum... Please post your question to the appropriate forum next time...

Hum, ok, sorry!

Anybody can help me, please??

mrtabs
10-10-2007, 12:45 PM
SOLVED! I implemented a solution very close of this
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg57405.html

Chris07
01-09-2008, 02:13 PM
I would like to know how do you solved that problem exactly, because the thread you posted, doesn't seem to working correctly.

If have done something like this:


// Überprüfen ob das Video enden soll, und notfalls ein ein nextSong einleiten
if (player.totalTime - player.playheadTime < 2)
{
vidSource = player.source;
var timerComplete : Timer = new Timer(2000, 1);
timerComplete.addEventListener(TimerEvent.TIMER_CO MPLETE, completeHandler);
timerComplete.start();
}
}

private function completeHandler(event : TimerEvent) : void
{
if ((player.playing == true) && (player.source == vidSource) && (player.totalTime - player.playheadTime < 2))
{
player.dispatchEvent(new VideoEvent(VideoEvent.COMPLETE));
}
}


I tried something like this, but it doesn't seem to work fully (problems in Safari).