Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / July 2008



Tip: Looking for answers? Try searching our database.

Undefined ASCuePoint

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hector McDougal - 16 Jul 2008 10:34 GMT
I have a Flash 8 AS2 file where I'm trying to add a number of ASCuePoint to a
FLV playback component, my_FLVPlybk. The time numbers for the cue points are
stored in an array called cuepoints_array in the form 4.02|7|12.3|22.7 etc.  I
have a cue point event listener added to the FLV playback component which
triggers at the event but it when I try to trace the name, type and time of the
cuepoint, then it comes out as undefined.  Any suggestions?

function cuePoint(eventObject:Object):Void {
    trace("eventObject.info.time = "+eventObject.info.time);
    var rtn_obj:Object = new Object();
    rtn_obj = my_FLVPlybk.findNearestCuePoint(eventObject.info.time);
    trace("Cue point name is: "+rtn_obj.name);
    trace("Cue point time is: "+rtn_obj.time);
    trace("Cue point type is: "+rtn_obj.type);
}
my_FLVPlybk.addEventListener("cuePoint", cuePoint);
//Add the cuepoints for this FLV to the my_FLVPlybk component
function populateMc():Void {
    if (cuepoints_array[count].indexOf("|")>0) {
        //More than one cue point for this video
        myTempCP_array = cuepoints_array[count].split("|");
        for (var j:Number = 0; j<myTempCP_array.length; j++) {
            //create cue point object
            var cuePt:Object = new Object();
            cuePt.time = myTempCP_array[j];
            cuePt.name = "cp"+(j+1);
            cuePt.type = "actionscript";
            my_FLVPlybk.addASCuePoint(cuePt);
        }
    } else {
        //Only one cuePt for this video
        var cuePt:Object = new Object();
        //create cue point object
        cuePt.time = cuepoints_array[count];
        cuePt.name = "cp1";
        cuePt.type = "actionscript";
        my_FLVPlybk.addASCuePoint(cuePt);
    }
}
Hector McDougal - 30 Jul 2008 16:05 GMT
I now have the cuepoints added but they don't always trigger. If I have three
cuepoints at 71, 108, 140, all three cuepoints trigger at 140 seconds rather
than triggering in turn.  Any ideas why that's happening? Here's the relevant
code. Thanks in advance.

//this callback function will be called every time the event listener hears a
cuepoint being triggered
function cuePoint(eventObject:Object):Void {
    //trace("cuepoint function called. my_FLVPlybk. asquepoints =
"+my_FLVPlybk._cpMgr[0].asCuePoints[0].name);
    trace("eventObject.info.time = "+eventObject.info.time);
    trace("eventObject.info.time = "+eventObject.info.name);
    var nameString:String = eventObject.info.name;
    if (nameString.charAt(2) != 0) {
        var cpNumber:String = nameString.charAt(2)+nameString.charAt(3);
    } else {
        var cpNumber:String = nameString.charAt(3);
    }
    //check to see if the next slide is different to the current one
    if (slideSplitArray[Number(cpNumber)] != slideSplitArray[Number(cpNumber-1)])
{
        //fade out slide 1
        _root[slideSplitArray[Number(cpNumber-1)]]._alpha = 0;
        _root[slideSplitArray[Number(cpNumber)]]._alpha = 100;
    }
}
//Add the cuepoints for this FLV to the my_FLVPlybk component
my_FLVPlybk.addEventListener("cuePoint", cuePoint);
//this function will be called when one of the 8 buttons on the left are
pressed
for (var m:Number = 0; m<9; m++) {
    eval("launchFlv"+m).onRelease = function() {
        //remove any listeners currently attached to the flv
        for (var p:Number = 0; p<10; p++) {
            my_FLVPlybk.removeASCuePoint("cp0"+p);
        }
        var buttonNum:String = this._name.charAt(9);
        count = Number(buttonNum)-1;
        populateMc();
    };
}
//This will add the cue points to the flv
function populateMc():Void {
    //load the relelvent flv
    my_FLVPlybk.contentPath = vids_array[count];
    //my_FLVPlybk.load(vids_array[count]);
    //the slideSplitArray will consist of the slides for this array split by a "|"
    if (slides_array[count].indexOf("|")>0) {
        slideSplitArray = slides_array[count].split("|");
    } else {
        slideSplitArray[0] = slides_array[count];
    }
    if (cuepoints_array[count].indexOf("|")>0) {
        //More than one slide for this video
        myTempCP_array = cuepoints_array[count].split("|");
        for (var j:Number = 0; j<myTempCP_array.length; j++) {
            var numberJ:Number = +(Number(j));
            if (j<10) {
                my_FLVPlybk.addASCuePoint(myTempCP_array[j], "cp0"+(numberJ+1));
            } else {
                my_FLVPlybk.addASCuePoint(myTempCP_array[j], "cp"+(numberJ+1));
            }
        }
    } else {
        //check to see if there's a slide change here
        if (cuepoints_array[count] != "") {
            //Only one slide for this video
            var cueP2t:Object = new Object();
            //create cue point object
            cuePt2.time = cuepoints_array[count];
            cuePt2.name = "cp01";
            cuePt2.type = "actionscript";
            my_FLVPlybk.addASCuePoint(cuePt2);
        }
    }
    //hide the slides after the first one for now
    for (var k:Number = 0; k<=32; k++) {
        if (k<10) {
            _root["slide0"+k]._alpha = 0;
        } else {
            _root["slide"+k]._alpha = 0;
        }
    }
    _root[slideSplitArray[0]]._alpha = 100;
}
Hector McDougal - 31 Jul 2008 10:17 GMT
I've figured out that adding cuepoints over 100 seconds is causing the problem.
If I add three cuepoints, the highest being 99 seconds, then it works fine. But
if any of them are over 100 then they won't trigger one at a time, but all
three will trigger at the time of the highest cuepoint. Don't know how to
rectify this.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.