Jump to content
GreenSock

jwiley

Timing Multipe Videos Playing in Sequence

Recommended Posts

Hi,

Flash AS3 GS v.11

I am trying to play MC's that contain video in between displays of text only. I have made 3 frame based movies to represent the FLV's embedded into the MC's. I need to play the whole thing backwards and forward. I will have a slide control. Some versions will have TL labels. I am just modeling this to understand the behaviors so I can model the most used versions my non-programmer's who will add captions to the FLA. The movies will be named in sequence in the libray (nice for 'For loop'). The captions and all other text will be Strings from the localization Strings panel.

 

The SWF will have a slider control with time display.

 

I will use addCallback to change text on a MC textfield and change the alpha with a Tweenlite to make it visible or not.

 

The time and framerates do not match. Old flash issue. I need MC to stop on the last frame - not stop early or late so transitions work

Using labels is not working as I expect.

Do I create TL nested movieclips?

Can I mix frame control (nested TL) and time control (main TL)?

 

import com.greensock.*;
import com.greensock.easing.*;
import flash.display.MovieClip;
import fl.controls.Button;
import flash.events.Event;
import flash.events.MouseEvent;
var first_btn:Button;// = new Button;
var second_btn:Button;// = new Button;
var third_btn:Button;// = new Button;
var play_btn:Button;// = new Button;
var stop_btn:Button;// = new Button;
first_btn.addEventListener(MouseEvent.CLICK, goToHandler);
second_btn.addEventListener(MouseEvent.CLICK, goToHandler);
third_btn.addEventListener(MouseEvent.CLICK, goToHandler);
play_btn.addEventListener(MouseEvent.CLICK, playHandler);
stop_btn.addEventListener(MouseEvent.CLICK, stopHandler);
var mc:Array = new Array;
mc[0]= new MC2 as MovieClip;
mc[1]= new MC3 as MovieClip;
mc[2]= new MC4 as MovieClip;
var timeLine:TimelineMax=new TimelineMax({paused:true,onComplete:done});//paused:true,
timeLine.addLabel("first", timeLine.duration);
timeLine.addCallback(addMovieFromLibrary,0.5, [(mc[0])]);
timeLine.addLabel("second", timeLine.duration);
timeLine.addCallback(addMovieFromLibrary,0.5, [(mc[1])]);
timeLine.addLabel("third", timeLine.duration);
timeLine.addCallback(addMovieFromLibrary,0.5, [(mc[2])]);

function done():void{
	trace ("done");
}
function addMovieFromLibrary(mc:MovieClip){
			mc.stop();
			mc.x = 16;
			mc.y = 16;
			mc.alpha = 0;
	addChild(mc);
			timeLine.append(TweenMax.to(mc, 0.5, {alpha:1}));
			timeLine.addCallback(mcPlay,0,[mc]);
			timeLine.append(TweenLite.delayedCall((mc.totalFrames/stage.frameRate), removeMovie,[mc]), -0.25);
}
function removeMovie(mc:MovieClip){
	timeLine.append(TweenMax.to(mc, 0.5, {alpha:0}), -0.25);	  
	mc.stop();
	removeChild(mc);
	trace("Remove Child Next");
}
function mcPlay(mc:MovieClip){
	mc.play();	
}
function goToHandler(e:MouseEvent):void{
	trace(e.target.label);
	timeLine.gotoAndPlay(e.target.label);
}
function playHandler(e:MouseEvent):void{
	trace(e.target.label);
	timeLine.play();
}
function stopHandler(e:MouseEvent):void{
	trace(e.target.label);
	timeLine.stop();
}

Test_main_timeLine-gs.zip

Link to comment
Share on other sites

If I understand your question properly, I think you want to control the video mcs with the TweenLite frame plugin.

 

So instead of calling mcPlay() and hoping that it will end around the time that the timeline resumes, you can create a tween that controls the frames playing backwards and forwards:

 

timeline.insert(TweenMax.to(someVideoMc, 30, {frame:600}));

 

when the TimelineMax gets scrubbed, so will your video mc.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×