I have a cuePoint Listener tha I use to detect a specified time to trigger a gotoAndPlay(“end”) that I use with an FLVPLayback component. I have a second FLV player that does not use the FLVPLayback component that I would ike to combine the ability to trigger the same gotoAndPlay(“end”) but no matter what I try in combining the two I can’t get that to happen.
The second example uses a video object rather than a component.
var cuePt:Object = new Object();
cuePt.time = 10.5;
cuePt.name = "VideoFinished";
cuePt.type = "actionscript";
theVideo.addASCuePoint(cuePt); // flvPlayer is the instance name of your FLVPlayback Component
var myLis:Object = new Object();
myLis.cuePoint = function(eventObject:Object):Void {
if(eventObject.info.name == "VideoFinished"){
_root.gotoAndPlay("end");
}
}
theVideo.addEventListener("cuePoint", myLis);
The Video object example
//THIS IS WHERE THE VIDEO FILE IS LOCATED ON AKAMAI'S SERVERS
//YOU CAN CREATE NEW DIRECTORIES IN THE ADS DIRECTORY
var thaVid = "cincinnati/ads/museumcenter/grandcanyon";
replayButton._visible = false;
//THIS SETS UP A CONNECTION & BUFFER WITH THE SERVER
//YOU DO NOT NEED TO CHANGE THE SERVER URL
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://cp22449.edgefcs.net/ondemand");
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(5);
ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
trace('buffer full');
}
if(info.code == "NetStream.Buffer.Empty") {
trace("buffer empty");
//THIS IS THE TIME IS SECONDS IT STOPS ON AFTER PLAYING VIDEO ONCE - IT'S SET TO 30 SECONDS CURRENTLY TO PAUSE ON THE LOGO
playButton._visible = false;
replayButton._visible = true;
ns.play(thaVid,28,0);
}
if(info.code == "NetStream.Play.Stop") {
trace('stop');
}
}
//THIS TELLS THE CONNECTION WHICH FILE TO STREAM WHICH IS SPECIFIED IN thaVid AT THE TOP
theVideo.attachVideo(ns);
ns.play(thaVid, 0, -1);
//FUNCTION DEFINITIONS FOR PLAY, REWIND, SCRUB/SCAN, BUFFER ETC
rewindButton.onRelease = function() {
ns.seek(0);
}
playButton.onRelease = function() {
ns.pause();
}
replayButton.onRelease = function() {
// replay the ****ing video
replayButton._visible = false;
playButton._visible = true;
ns.play(thaVid, 0, -1);
}
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
// LOAD BAR INSTRUCTIONS - NUMBER MUST EQUAL THE WIDTH OF INSTANCE 'loader' WHICH IS LOCATED INSIDE 'loader' IN LIBRARY
function videoStatus() {
amountloaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 195;
loader.scrub._x = ns.time / duration * 195;
}
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,-6,this._y,200,this_y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus, 100);
this.stopDrag();
}
// SCRUB BAR INSTRUCTIONS - NUMBER MUST EQUAL THE WITH OF LOAD BAR THAT YOU WANT SCRUB CONTROL TO BE ABLE TO MOVE
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/197)*duration));
}
// THIS IS TO SET WHAT YOU WANT TO APPEAR IN THE POPUP WHEN A USER RIGHT CLICKS ON THE SWF FILE
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
var i1:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::",trace);
theMenu.customItems[0] = i1;
var i2:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::",trace);
theMenu.customItems[0] = i2;
var i3:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseIt,true);
theMenu.customItems[1] = i3;
var i1:ContextMenuItem = new ContextMenuItem("Replay Video",replayIt);
theMenu.customItems[2] = i1;
var i4:ContextMenuItem = new ContextMenuItem("Copyright 2007 azcentral.com",trace,true);
theMenu.customItems[3] = i4;
function pauseIt () {
ns.pause();
}
function replayIt(){
ns.seek(0);
}
// REMOVE THE SOUND FROM THE NETSTREAM AND ATTACH TO A NEW MOVIE CLIP. CREATE A NEW SOUND OBJECT AND CONTROL WITH NEW FUNCTIONS BELOW.
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth())
vSound.attachAudio(ns);
var so:Sound = new Sound (vSound);
so.setVolume(0);
mute.onRollOver = function() {
if(so.getVolume() == 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}
mute.onRollOut = function() {
if(so.getVolume() == 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}
mute.onRelease = function() {
if(so.getVolume() == 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
}