Skip to main content
Known Participant
January 7, 2013
Answered

Video fading in, but not out in movie clip.

  • January 7, 2013
  • 1 reply
  • 1240 views

Hi.

I need to run a video which I can turn off and on on top of other flash content.

Since I also need to add sub titles I decided to import the video clip into a movie clip. The movie clip now has as many frames as the video.

I added the subtitles by keyframing a text line in the movie clip and synched it up with the movie. (this was not real easy..)

I placed an instance of the movie clip on my main stage in frame 10. I added an on and and off button that simply would take you to a later frame without the movie clip instance, and back to frame 10 again if you want to see the video again. This worked well. 

To make the transistions elegant I wanted to fade the video in and out. So on the main stage in frame 10 I placed this action script:

(+ gave my movieclip the instance name mc)

stop();

import mx.transitions.Tween;

import mx.transitions.easing.*;

var myTween:Tween = new Tween (mc,"_alpha",Strong.easeIn,0,100,2,true);

which nicely fades the video in when the playhead gets to frame 10.

There is another part of the script that should be able to tell the upcoming end of the movie clip and fade it out:

myTween.onMotionFinished = function () {

   new Tween (mc,"_alpha",Strong.easeOut,100,0,2,true);

}

This however I can not get to work:

1)  If I place this code in frame 10, the video first fades in but immideately fades out again.

2)  I tried to put the code 15 frames from the end of the movie clip, and that did not work.

3)  I tried to put the code 15 frames from the end of the movie clip and add _parent.  and that did not work either.

Can this be made to work, and if so how?

If not, please let me know if you have any other proven approach to suggest.

ggaarde

This topic has been closed for replies.
Correct answer Ned Murphy

If the first tween works in the timeline, then in that same timeline at whattever frame near the end <edit: of your video/> you should just create another tween there. 

myTween = new Tween (mc,"_alpha",Strong.easeOut,100,0,2,true);

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
January 7, 2013

If the first tween works in the timeline, then in that same timeline at whattever frame near the end <edit: of your video/> you should just create another tween there. 

myTween = new Tween (mc,"_alpha",Strong.easeOut,100,0,2,true);

ggaardeAuthor
Known Participant
January 9, 2013

Hi Ned

Should the second tween also be in the main time line?

I a later frame or the same beginning frame?

The main time line stops when the movie clip starts playing...

Thanks on beforehand.

ggaarde

Ned Murphy
Legend
January 9, 2013

If you are tweening the same object, yes, the tween is best done in the same timeline.