FORUMS: list search recent posts

Play Video When Enough Downloaded

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tony Ingrassia
Play Video When Enough Downloaded
on Jul 29, 2009 at 3:36:51 pm

I'm building a banner for a website that includes a talking head. I'm working with Flash CS3, using ActionScript 3.0. My goal is that, when enough of the video has loaded that it can play through to the end without pausing, the video fades up and begins playing. The FLV itself starts on a poster frame of the actor. I'm using a Motion Tween to fade the video up.

I've found the "playWhenEnoughDownloaded" function, but my problem is that when enough of the video downloads, I don't want it to play quite yet. I first want the video to fade up.

So basically, the code would look something like this:

videoMC.addEventListener (VideoEvent. playWhenEnoughDownloaded, fadeUp);
function fadeUp (event:VideoEvent):void

I'm new to Flash, so I'm sure I butchered the code, but it should give you a general idea of what I'm trying to do. "videoMC" is a movie clip containing the FLV Playback component. So when enough of the video has downloaded, it triggers the "videoMC" movie clip to play, which contains a Motion Tween fading up the video.

I hope that makes at least a little bit of sense.

Any ideas?

Return to posts index

Richard Gropius
Re: Play Video When Enough Downloaded
on Aug 5, 2009 at 6:09:31 pm


Do you know the GreenSock Tweening library? I use it all the time. It's free, intuitive, and incredibly well-documented.

What I would do is create a Tween in your fadeUp() which, once completed, would go to another function which actually started the video.

Check it out:

// This is the GreenSock Tweening stuff
import gs.TweenLite;

// Your E.L.
videoMC.addEventListener (VideoEvent. playWhenEnoughDownloaded, fadeUp);

// First function just handles the fade up. Target your MC's alpha.
function fadeUp (event:VideoEvent):void
// Unless you've already done this earlier in your code
videoMC.alpha = 0.0;

// This creates an object "TweenLite" which will take
// 1 second to bring the alpha of videoMC up to 1, and
// then, once complete, go to the function "videoTrigger"., 1, {alpha:1, onComplete:videoTrigger});

// Let this function actually launch the video because it will not
// be reached until the Tween is complete.
function videoTrigger():void

Hope this helps.

Return to posts index

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