Archive for the ‘ASCuePoints’ Category
ActionScript 3.0: using ASCuePoint with Flash Video (.flv)
a cuepoint is a marker, in video it’s used to mark an event or a chapter and is very powerful when you want to synchronize your video with animations, speech, music or stuff like that.
cuepoints can be added in many ways, it can be added as the footage is edited, or it can be added in post-production.
in this example I’ll use ASCuePoints, actionscripted ASCuePoints, to trigger a function.
but first, watch the video without any effects here:
little girl screaming her lungs out
to cartoonize the video, I’ve masked it in a cartoon magazine holder.
and, by using ASCuePoints, I’ve added a “Waaaaaaaah” Batman TV-series stylish graphic every time the girl screams.
watch the video cartoonized with graphics and a mask here
here’s the ActionScript used to set this up:
import caurina.transitions.Tweener;
var wah:Wah;
//FLVPlayer.alpha = 0;
FLVPlayer.addASCuePoint(1, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(6.3, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(14.5, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(19.6, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(25, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(30.6, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(35, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(38, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(44, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(47, "scream", {text:"myFirstCuepoint"});
FLVPlayer.addASCuePoint(48.3, "screamveryshort", {text:"myFirstCuepoint"});
FLVPlayer.addEventListener(MetadataEvent.CUE_POINT, reactToCuepoint, false, 0, true);
function reactToCuepoint(evt:MetadataEvent):void {
wah = new Wah();
var myY:Number = Math.random()*150 + 100;
var myX:Number = Math.random()*140 + 120;
wah.x = myX;
wah.y = myY;
trace("wah.x = "+wah.x+" & wah.y = "+wah.y);
wah.alpha = 0;
Tweener.addTween(wah, {alpha:1, time:2});
Tweener.addTween(wah, {alpha:0, time:2, delay:5});
wahholder.addChild(wah);
if(evt.info.name == "scream") {
wah.gotoAndStop(1);
} else if(evt.info.name == "screamveryshort") {
wah.gotoAndStop(2);
}
}
function fadeIn(){
Tweener.addTween(FLVPlayer, {alpha:1, time:1, transition:"easeInSine"});
}
function fadeOut(){
Tweener.addTween(FLVPlayer, {alpha:0, time:1, transition:"easeOutSine"});
}
a big shout out to Esben Hindhede and Maria Bøge Sørensen for inspiration and helping create this post!
