brianburgess
04-29-2008, 04:32 PM
I’ve been struggling with how to seek a specific cue point when I click a button. I’m using AS3 to load and control the video, and it traces the right data when the cue points are hit, but when I try to place the name of the cue point in the ns.seek(), it says the property is undefined. What am I missing here? Here is an example of the code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
videoPlayer.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
listener.onCuePoint = function(evt:Object):void {
// instructions here
trace(evt.name);
trace(evt.time);
trace(evt.parameters);
trace(evt.type);
};
ns.client = listener;
ns.play(”flv/Instructional Video_Cue Points.flv”);
function clickHandler(event:MouseEvent):void {
//ns.seek(30);
//this works fine.
ns.seek(chp1);
//this gives the error: Access of undefined property chp1.
}
btn1.addEventListener(MouseEvent.CLICK, clickHandler);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
videoPlayer.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
listener.onCuePoint = function(evt:Object):void {
// instructions here
trace(evt.name);
trace(evt.time);
trace(evt.parameters);
trace(evt.type);
};
ns.client = listener;
ns.play(”flv/Instructional Video_Cue Points.flv”);
function clickHandler(event:MouseEvent):void {
//ns.seek(30);
//this works fine.
ns.seek(chp1);
//this gives the error: Access of undefined property chp1.
}
btn1.addEventListener(MouseEvent.CLICK, clickHandler);