I have had this problem for like a day and still cannot figure it out. How woold I attach an external SWF on cue point?
Here is my code, all of it, the cue points are at the bottom.
stop();
//Establishes a connection to the internet and pulls the info from the server where
//the FLV is stored.
var nc:NetConnection = new NetConnection();
nc.connect (null);
var videoPlayer:NetStream = new NetStream(nc);
//vidHolder.attachVideo(videoPlayer);
//videoPlayer.play("http://images.legacynetwork.com/flv/tutorial.flv");
var duration:Number;
videoPlayer["onMetaData"] = function(obj){
duration = obj.duration;
}
//Code for the control buttons with animated states.
playButt.onRollOver = over;
playButt.onRollOut = out;
muteButt.onRollOver = over;
muteButt.onRollOut = out;
pauseButt.onRollOver = over;
pauseButt.onRollOut = out;
backButt.onRollOver = over;
backButt.onRollOut = out;
//Functions for the controls and what they do.
function over() {
this.gotoAndPlay (2);
}
function out() {
this.gotoAndPlay (11);
}
pauseButt.onRelease = function(){
videoPlayer.pause();
}
playButt.onRelease = function(){
videoPlayer.pause();
}
backButt.onRelease = function(){
videoPlayer.seek(0);
}
//Scrubber code. Sets the scrubber arguments for seamless scrubbing
var scrubInterval;
loader.scrub.onPress = function(){
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,654,this._y);
}
//Allows the scrubber to move through loaded content
function scrubit() {
videoPlayer.seek(Math.floor((loader.scrub._x/654)*duration));
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus, 100);
this.stopDrag();
}
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded:Number;
function videoStatus(){
amountLoaded = videoPlayer.bytesLoaded / videoPlayer.bytesTotal;
loader.loadBar._width = amountLoaded * 654;
loader.scrub._x = videoPlayer.time / duration * 653;
}
//Mute button methods of attaching an audio from the FLV and putting it in the
//empty MC
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth())
vSound.attachAudio(videoPlayer);
var so:Sound = new Sound (vSound);
so.setVolume(100);
//Rollover functions for the states and the mute function itself
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");
}
}
//This batch of code attaches the FLV from the server and plays it in the vidHolder
//and pauses it in the beginning. The metaData method checks for cues as well
//as provides the scrubber with neccessary information to scrub.
videoPlayer.onMetaData = function(metaProp:Object) {
trace("The metadata:");
traceMeta(metaProp);
duration = metaProp.duration
};
vidHolder.attachVideo(videoPlayer);
videoPlayer.play("http://images.legacynetwork.com/flv/tutorial.flv");
videoPlayer.pause();
function traceMeta(metaProp:Object):Void {
var p:String;
for (p in metaProp) {
switch (p) {
case "cuePoints" :
trace("cuePoints: ");
//cycles through the cue points
var cuePointArr:Array = metaProp[p];
for (var j:Number = 0; j < cuePointArr.length; j++) {
//cycle through the current cue point parameters
trace(" cuePoints[" + j + "]:");
var currentCuePoint:Object = metaProp[p][j];
var metaPropPJParams:Object = currentCuePoint.parameters;
trace(" name: " + currentCuePoint.name);
trace(" time: " + currentCuePoint.time);
trace(" type: " + currentCuePoint.type);
if (metaPropPJParams != undefined) {
trace(" parameters:");
traceObject(metaPropPJParams, 4);
}
}
break;
default :
trace(p + ": " + metaProp[p]);
break;
}
}
}
//Checks for cues as they go and outputs a trace statement as the cues comes up
videoPlayer.onCuePoint = function(infoObject:Object)
{
onCuePoint("one") = function(){
txt.gotoAndPlay(1);
}
trace("onCuePoint:");
for (var propName:String in infoObject) {
if (propName != "parameters")
{
trace(propName + " = " + infoObject[propName]);
}
else
{
trace("parameters =");
if (infoObject.parameters != undefined) {
for (var paramName:String in infoObject.parameters)
{
trace(" " + paramName + ": " + infoObject.parameters[paramName]);
}
}
else
{
trace("undefined");
}
}
}
trace("---------");
}