Flash AS3: (VideoEvent.COMPLETE, completePlay) - listener is triggered before video is completed

Posted by Tevi on Stack Overflow See other posts from Stack Overflow or by Tevi
Published on 2010-03-18T15:00:20Z Indexed on 2010/03/18 15:01 UTC
Read the original article Hit count: 1308

Filed under:
|
|
|
|

Hello,

I have a flash video using the standard FLV Playback component that comes with Flash. I'm using ActionScript 3 to modify the appearance and set up an event listener. I've set it up to go to a new URL using "externalInterface" when the video completes play. The URL is set in a variable using SWFObject.

On only a few instances (3 people out of 50 - tested using Amazon Turk), people reported being taken directly to the new url, before the video even started playing. It's difficult to repeat the issue, but it did happen to me once. It doesn't have anything to do with cache, since it has been reported on people going to the url for the first time.

Here's the url to the video: http://www.partstown.com/is-bin/INTERSHOP.enfinity/WFS/Reedy-PartsTown-Site/en_US/-/USD/ViewStaticPage-UnFramed?page=tourthetown

Here's the code:

import flash.external.*;
import fl.video.*;
var myVideo:FLVPlayback = new FLVPlayback();

var theUrl:String = this.loaderInfo.parameters.urlName;
var theScript:String = this.loaderInfo.parameters.scriptName;


myVideo.source = this.loaderInfo.parameters.videoPath;//"partstown.flv";
myVideo.skin = this.loaderInfo.parameters.skinPath;//"SkinUnderPlayStopSeekMuteVol.swf"
myVideo.skinBackgroundColor = 0xAEBEFB;
myVideo.skinBackgroundAlpha = 0.5;
myVideo.width = 939;
myVideo.height = 660;


myVideo.addEventListener(VideoEvent.COMPLETE, completePlay);
function completePlay(e:VideoEvent):void {
 myVideo.alpha=0.2;
 ExternalInterface.call(theScript);
}


addChild(myVideo);

Why would the listener be triggered before the event complete? How can I fix it?

Thanks!

© Stack Overflow or respective owner

Related posts about flash

Related posts about flvplayback