Copy link to clipboard
Copied
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
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);
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
If you are tweening the same object, yes, the tween is best done in the same timeline.
Copy link to clipboard
Copied
Hi Ned
This does not work for me.
Again the instance of the movieclip is on the main timeline in frame 10 with stop action
I have put the code you suggested in frame 13 of the main time line. also with a stop action.
Then in the movieclip I have put this code approx 100 frames from the end of the clip:
_parent.gotoAndPlay(13);
How else would he main movieclip know when to start the fadeout?
The myTween.onMotionFinished = function should maybe detect it, but i have not had luck using it. The only time it works is like described in my first post, but it triggers right away and fades out as soon as it is done with the fade in.
Is there a way to tell it on which frame in the mc it should start the fade out?
ggaarde
Copy link to clipboard
Copied
The onMotionFinished is going to detect when the first tween ended, which I don't believe is when you want to start the other tween. YOu want to start the other tween after the movieclip has finished playing, correct?
Copy link to clipboard
Copied
The movie is an animated character. I want the character to fade in in the beginning and out right before the clip ends.
If the fade is triggered at the end of the clip there are no frames to fade out. There is transparent background in the video clip so the character hovers over the underlying content in the main time line.
The animation mc is 1525 frames long. It would be ideal to fade out the clip maybe 80 - 100 frames before the end of the clip. That way the character will fade out just as nice as it faded in.
Can we trigger the AS to start the fadeout in f.ex. frame 1450 of the movieclip?
Copy link to clipboard
Copied
You should be able to. Try putting a function in the main timeline that reassigns the tween for the fade out and have your movieclip call that function when it gets to the point where you want it to start fading (1450). You can call it using a _parent reference, for example...
_parent.fadeOut();
and in the main timeline you create that function with the tween I showed earlier inside it.
Copy link to clipboard
Copied
Hi Ned that worked!
Thank you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now