I'm having trouble with a simple AS3 (CS5.5) project I have imported a video encoded through Adobe media encoder as a FLV file and have added a Navigation Cue Point at the end of the video as I would like the video to simply go to a frame number when the video has ended so it doesn't stop on that video.
I have used a code I have used on many occasions in AS2 which I put on a keyframe at the top where the video runs under and give the video an instance name of vid:
stop();
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
// Put any code you like here<br>
trace("Cue point name: " + eventObject.info.name);
trace("Cue point type: " + eventObject.info.type);
if(eventObject.info.name=="movieend")
{
gotoAndPlay(135);
}
}
vid.addEventListener("cuePoint", listenerObject);
For some reason this is coming up with an error in AS3.
Ideally I just want the code go to a frame number when the video finishes instead of staying on the video.
Your code seems to be a little out of whack. Try this.
stop();
vid.addEventListener(MetadataEvent.CUE_POINT, cp_listener);
function cp_listener(eventObject:MetadataEvent):void {
trace("Cue point name: " + eventObject.info.name);
trace("Cue point type: " + eventObject.info.type);
if (eventObject.info.name == "movieend") {
//flvPlaybak.seek(0);
//flvPlaybak.play();
gotoAndPlay(135);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.