-
Obsolete Vernacular
Simulated Cue Points
I have a Flash video player I've built that plays a video of a speaker, and to the side shows a Flashpaper presentation. In the past, the speaker has stopped and started with each slide so that we could have a separate video for each one. For this reason, the player was built to advance Flashpaper pages when a new video was loaded. (Usually at the end of the previous video.)
The challenge now is that we have a speech where the speaker doesn't stop. So during the video, we want the Flashpaper pages to change at specific times. Ordinarily people would embed cue points into the video, but since we're already using XML and will need to in the future, I want the cues to be in the player's XML configuration.
With the back and next buttons, it's easy to switch to the cue points. What I'm having trouble with is coming up with a way for the slides to switch without the viewer doing anything.
I believe there just needs to be something in the code that checks every second to see if the video's matching the correct slide. How would I go about doing that - a while loop? A listener? (I've never worked with listeners and have no idea whether or not that's their department or not.)
Any help would be much appreciated.
-
Flash Video Moderator
I would use onEnterFrame. I'm not sure how accurate you need to be, but I've found that using the actual frame (not seconds) to be the best way to keep things exactly in snyc.
Code:
<cueNode>
<cue>1252</cue>
<cue>2545</cue>
<cue>3656</cue>
</cueNode>
Then the actionscript:
Code:
//
function checkCues():Void{
var xmlObj = new xmlMethod();
var target:MovieClip = videoHolder;
var cueCount:Number = 0;
var currentCue:Number = xmlObj.cue[cueCount];
this.onEnterFrame = function(){
if (target._currentframe == currrentCue) {
// fire cue function here
cueCount++;
currentCue = xmlObj.cue[cueCount];
if (currentCue == xmlObj.cue.length) {
// all cues have been executed
this.onEnterFrame = undefined;
}
}
}
}
Last edited by Wheels; 04-16-2006 at 09:26 PM.
-
Obsolete Vernacular
Thanks Wheels, this has put me in the right direction!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|