FORUMS: list search recent posts

cross fading between videos

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David Scott
cross fading between videos
on Feb 16, 2007 at 5:51:29 pm

Is there any way to cross fade between video clips. I have a button that sends the user from one video clip to another (vids are scripted into a video Object).

I need to make the transition from one to the next as seamless as possible. This wouldn't be a problem if the frames of the video I was jumping between were static but there will always be motion in the videos.

any ideas on this?

Thanks in advance for any info you may have.

David Scott

Return to posts index

Re: cross fading between videos
on Feb 17, 2007 at 10:42:01 pm

Hi David,

I hate to say it, but trying to use flv as a live edit, mixing in and out, is going to be a bit hit and miss. If indeed possible??? The pixel size in itself causes problem concerning smooth playback and this is going to be a live event?

If the video company are really pushing for the flv format then you could ask them to give you a long edit containing all the clips. Place clipevents in-between each clip and edit in actionscript a function/action to be activated on that clipevent. But that still leaves a problem when the clip has to loop.

Have you tried using flash's slideshow presentation, but instead of stills use the flv's with some buffer for each frame.


Return to posts index

Matt Klundt
Re: cross fading between videos
on Feb 19, 2007 at 11:12:17 pm

You would need to use two video objects. When the new one to load is finished buffering, you would script the old one (which would be on a higher layer) to reduce it's _alpha and volume. Then, when the old one's _alpha is at or below 0, use swapDepths() to make the new video the top one. Now you can repeat the process for the next time you need to crossfade.

I'm not sure how smooth this will play back for you though, it all depends on the size and bitrate of the video and the speed of the computer playing it.


Return to posts index

Re: cross fading between videos
on Feb 20, 2007 at 6:33:07 pm

not sure if this will do EXACTLY what you are after but I did something similar with JPGs. The images were dynamically loaded using MovieClipLoader class. I'm sure you could use FLVs somehow with this, maybe using FLVComponent. But basically I attach the loaded image to a movie clip that is TWEENED using built in mx tween class. Attach the image, tween alpha to 0, swap image, tween alpha to 100. If you had 2 MCs you could probably fake a crossfade (my method is more like a dip-to-color fade)...

I am also using a setInterval driven getTimer to fade the images every 6 seconds. Your needs may require something else. For this code to work all images need to be named gal_01.jpg, gal_02.jpg etc...

import mx.transitions.Tween;
import mx.transitions.easing.*;

var galleryMCL:MovieClipLoader = new MovieClipLoader();
var galleryListener:Object = new Object();
var curFrameNum:Number = 0;
var galInfo:LoadVars = new LoadVars();
var delay:Number;
var clock:Number = getTimer();

galInfo.load("gallery_info.txt"); //this is a text doc that has the value of a variable stored

// initiate the slide show sequence if the external variables have loaded
galInfo.onLoad = function(success){
galleryMCL.loadClip("gal_" + curFrameNum + ".jpg", _root.galSlide_mc);
var initSlide:Tween = new Tween(galSlide_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
function loadImage(){
var fadeOutSlide:Tween = new Tween(galSlide_mc, "_alpha", Regular.easeIn, 100, 0, 1, true);
var fadeOutShad:Tween = new Tween(shad_mc, "_alpha", Regular.easeIn, 100, 0, 1, true);
fadeOutSlide.onMotionFinished = function() {
galleryMCL.loadClip("gal_" + curFrameNum + ".jpg", _root.galSlide_mc);
var fadeInSlide:Tween = new Tween(galSlide_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
var fadeInShad:Tween = new Tween(shad_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);

// create timer to check duration of program
function updateClock() {
timer = getTimer();
delay = timer - clock;

// check if it is time to swap image, then reset vars, delay value in milliseconds
function resetDelay() {
if (delay >= 6000){
delay = 0;
clock = getTimer();

// check and update value of current frame, then call loadImage function
function swapImage() {
if (curFrameNum < Number(galInfo.totalFrames)-1){
} else {
curFrameNum = 0;

// set intervals for timer to be updated and checked
var clockTracker:Number = setInterval(updateClock, 100);
var delayTracker:Number = setInterval(resetDelay, 500);

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved