13 Replies Latest reply on Aug 14, 2008 4:43 PM by WebPiper

    Fade out video clip?

    WebPiper
      I have placed a video in the Flash timeline with a mask so that only a portion of the video is seen (it's a slow-motion of a manufacturing process). I want the video to fade out after about five seconds. How do I achieve this? I tried saving the video as a movie clip then creating a motion tween in the last 30 frames, but the video starts over again at the start of the tween. I also tried making the mask into a graphic and making a motion tween with the mask, but then the video did not play. What are my options?
        • 1. Re: Fade out video clip?
          Shandy Elliott Level 1
          I created an example for you of how you can do this at http://www.shan-dysigns.com/flash/fire4.zip You will need to download the .fla and the fire4.flv files into a folder on your computer - open up fire4.fla to look at my code.

          You will have to incorporate this into your flash file, but I will tell you what I did. In the Flash library panel at the top of the panel (and under the "x" to close the pane)l is a little arrow pointing down. Click that, then new video, name your video, make sure to select "action script controlled", press "ok". Place this new symbol on the stage with an instance name (for this example) of "cpVideo". I'm assuming your video is flv. If not, you should convert it to an flv using Adobe's Flash Converter. Place that flv in the same folder as your flash document (fla). Copy and paste the code in my example to a frame. The only values you will need to change are:

          netStream.play("fire4.flv");
          - change the "fire4.flv" to the name of your video

          new Tween(cpVideo, "_alpha", Strong.easeOut, 100, 0, .5, true);
          - change the ".5" to another number - this represents how long you want the fade to take from 100 to 0 - for the example, ".5" represents 1/2 second

          setTimeout(fadeOut,1000);
          - change "1000" to "5000" to equal 5 seconds - in my example, I used a shorter video to keep the file size down, so it fades out in 1 second in my example.

          Let me know if you have questions.
          • 2. Re: Fade out video clip?
            WebPiper Level 1
            Thank you. I will try this now and post the results.
            • 3. Re: Fade out video clip?
              WebPiper Level 1
              Where in the action script do I indicate the frame in / frame out? I am not able to get the video to play, but I think it is because the current script in your example starts at frame one, and the video I have starts at frame 101. So when I test the movie, I get the following error messages (or do you know why I'm getting these messages?):

              1172: Definition mx.transitions could not be found.
              1180: Call to a possibly undefined method Tween.
              1120: Access of undefined property Strong.
              1061: Call to a possibly undefined method attachVideo through a reference with static type flash.media:Video.

              I'm attaching the code I used. I checked the file name and instance name several times.
              • 4. Re: Fade out video clip?
                Shandy Elliott Level 1
                "Where in the action script do I indicate the frame in / frame out?" - I don't understand.

                "I am not able to get the video to play, but I think it is because the current script in your example starts at frame one, and the video I have starts at frame 101" - well, then place that action script on frame 101

                "So when I test the movie, I get the following error messages (or do you know why I'm getting these messages?):" - what version of Flash do you have, and what version of flash player is your main flash file set to?

                I may need to see your flash file to help you apply this code.
                • 5. Re: Fade out video clip?
                  WebPiper Level 1
                  Contractual obligations prevent me from sharing info about the project. Many thanks for your offer, though. This forum has always been a great help. And I will continue to try to fix this as I can see that it clearly works in the example you posted.
                  • 6. Re: Fade out video clip?
                    Shandy Elliott Level 1
                    One thing to try is to copy all the frames in my example and paste it into a new movie clip. Then, just place that movie clip on the stage whenever you want the video to start loading. This way, that whole video loader thing is self-contained, and you won't have to do anything else with it. You should add this code under import mx.transitions.*;

                    import mx.transitions.easing.*;

                    I forgot to add that earlier.
                    • 7. Re: Fade out video clip?
                      WebPiper Level 1
                      I tried copying and pasting your frames into a movie clip, then renaming the appropriate parts. I still get about seven errors. Are NetConnection and NetStream server functions? If so, this may be the problem. I don't have Flash to run with any server functions...only to play the files that are embedded. I did make a copy of the referenced file and put it in the folder where the .fla file resides, though.

                      Also, I notice that the example you sent me only plays in the .swf file; I am not able to "test" the movie in Flash.

                      Thanks again for your help. I need to move ahead to the next part of the presentation, but I'll return to this when I get more time, so if you have additional ideas, please let me know.
                      • 8. Re: Fade out video clip?
                        Shandy Elliott Level 1
                        What do you mean "I don't have Flash to run with any server functions...only to play the files that are embedded."?

                        This video is not embedded. I don't understand "not able to test the movie in flash". You should be able to hit F12 while in Flash to view the published swf file. I don't know what else to tell you. It's obviously something to do with the other parts of your flash file, but since I can't see it, I don't know what else to tell you.
                        • 9. Re: Fade out video clip?
                          WebPiper Level 1
                          I agree. I know I have done something wrong with the file because I can see it works in the one you sent when I view the .swf file that you attached. However, when I hit F12 while in your .fla file, the preview file comes up as a black screen with no preview of the file. I hit Play in the Control menu of the F12 popup menu, but that also returns no playback. I cannot explain this. I am running Flash CS3 Professional on Windows XP Pro SP2. Really, I do appreciate your help, and I will try to get this to work for me.
                          • 10. Re: Fade out video clip?
                            Shandy Elliott Level 1
                            Do you have the fla and the flv in the same folder?
                            • 11. Re: Fade out video clip?
                              WebPiper Level 1
                              Yes, I set up a separate folder and named it "Flash". Inside it are the fire4.flv, fire4.fla, and fire4.swf files. There is also a copy of the AC_RunActiveContent.js file in this folder.
                              • 12. Re: Fade out video clip?
                                Shandy Elliott Level 1
                                Sorry, I don't know what else to tell you at this point. The code is there and works, so you need to find a way to apply it to what you have already. I wish I could help further, but if I can't see your problem, I can't help any more.
                                • 13. Re: Fade out video clip?
                                  WebPiper Level 1
                                  Yes, and I thank you for sticking with this for so long.

                                  Best regards-