11 Replies Latest reply on Sep 25, 2006 4:55 PM by Mister Peanut

    SWF vs FLV

    Mister Peanut

      I was wondering if anyone could clarify a few questions I have about FLV's & SWF's. As I was trying to learn about importing external video, I originally thought it would be best to have a movie container to load different movies at different depths when the user selected options from a movie menu. I thought that using the loadMovieNum would be good for SWF files as all tutorials show you how to do this.

      Here's where I'm confused. I know Flash uses FLV files and somehow converts SWF's into FLV's upon playback? Am I wrong? okay, I'm a little confused because in no tutorial does it show you how to loadMovieNum with an FLV file. For example, as far as I know, you would never see:


      but you might see:

      loadMovieNum("movie.swf", 10)

      So my biggest question is: How do you reference an FLV file, or load it into a movie clip using actionScript? What I am doing right now is importing 1 FLV video to each frame, and creating buttons that link the viewer to the specific frame that the video is in. Is this how FLV videos are used? If not, how would I go about making an FLV video player that loads different movies when a different menu item is selected?

      The video files I have are all FLV files. I want to load them either into a single video player, or into a separate frame - whichever is the best method. Is it easier to use SWF files? Mon, I'm lost.

      Any clarification on this would be greatly appreciated.
        • 1. Re: SWF vs FLV
          Rothrock Level 5
          FLV and SWF are two different formats. FLash Video is a way of encoding video files, ShockWave Format is for regular Flash files.

          A SWF file can wrap around an FLV and have it inside of it and in that case you could use loadMovie, loadMovieNum, or the MovieClipLoader class to load and play that SWF – which just happened to contain and FLV.

          But for a straight FLV file you need to use either the Media components or the NetStream class to load and control it.

          Read the help files for all of these things and you will get a much better understanding. PS: Don't do a search, just go to the ActionScript and Component Dictionaries in the help files. There you will find entries for each of these things and all their capabilities.
          • 2. Re: SWF vs FLV
            Mister Peanut Level 1
            Hey, thanks a lot for the advice. I'm sure I'll find some useful info. It's hard when you don't know what to search for in the first place.


            • 3. Re: SWF vs FLV
              Level 7
              > Here's where I'm confused. I know Flash uses FLV files and somehow
              > converts
              > SWF's into FLV's upon playback? Am I wrong?

              Yes .. you are completely wrong.

              > okay, I'm a little confused
              > because in no tutorial does it show you how to loadMovieNum with an FLV
              > file.

              That's because yu cannot laod and FLV with loadMovieNum .. that is for
              loading SWF (and some image formats).

              • 4. Re: SWF vs FLV
                Rothrock Level 5
                Good luck.

                That is the secret of the help files for actionscript: Don't search. Almost always you will get too many hits about topics that won't help you. Instead go right to the dictionaries for the Actionscript language and/or the components. There you can fairly easily find the class or component you need. Then everything you can do with it will be laid out right there. Sometimes if you are just totally lost, do a search until you find a page that has a Class that you need and then go directly to that page.
                • 5. Re: SWF vs FLV
                  Darshan Rane Level 3
                  hi drag a video component from component panel

                  name it my_video

                  var my_video:Video; // my_video is a Video object on the Stage
                  var my_nc:NetConnection = new NetConnection();
                  var my_ns:NetStream = new NetStream(my_nc);

                  this code will hep you to play flv file dynamically
                  • 6. Re: SWF vs FLV
                    Mister Peanut Level 1
                    Thanks for the code, Darr. This brings up a question, though:

                    I have imported 5 separate flv videos into five separate frames, and I am using gotoAndStop to go to each frame to play each video. Is there a disadvantage to doing it this way? It seems to work fine, and I'm pretty sure it is not embedded and loading dynamically.

                    Can you tell me what the advantages are to using NetStream to attach the video over the method I am using? I would like to make my webpage with the most efficient code I can figure out. Thanks for any advice.

                    • 7. Re: SWF vs FLV
                      Rothrock Level 5
                      If you have imported them into the frame then they are most likely embedded. How big is your published SWF file? When published do you have to put the html, swf, and five FLV files onto your website to make it work?

                      The advantage to external files dynamically called is that the original SWF will load quicker, allows the Flash plug-in to better manage memory usage, and (this is the best part!) the external FLVs can have a different frame rate from the swf file.
                      • 8. Re: SWF vs FLV
                        Mister Peanut Level 1
                        My published swf is about 1MB. The videos are all around 2MB each. My guess is that they are getting loaded as needed, and are not embedded. Is there an easy way to find out?

                        Moving my swf from its original file folder to the desktop and clicking on the movie links, the movies do not play. I am guessing that this means that the SWF is getting the video from the original file folder. I am relatively new to web design, so I'm never completely sure.

                        Thanks for the info and all the help. I'll try to return the favour some day.

                        • 9. Re: SWF vs FLV
                          Rothrock Level 5
                          That would indicate that they have indeed been linked and not embedded. So I'm a little bit confused by what you meant by "I have imported 5 separate flv videos into five separate frames."

                          My guess is that on five different frames you have put an instance of the media playback component and set the source to be the respective five files? To my mind it would be better to have one instance of the media player and use the code to load different movies into the same one as needed.

                          Also 1MB is rather large for something going to be delivered over the web.

                          The Macromedia/Adobe components work fine (for the most part) when used exactly as intended. They add a fair amount of heft to your published file – especially when compared to what they do. Not that the media components add that much to your 1MB total, but you can get the size down by using the NetStream technique. Of course you then need to make your own player and, depending upon what features you need, that can be a fairly simple or daunting task.

                          There used to be good tutorials at gotoAndLearn.com, but last time I was there I didn't see where they had gone.
                          • 10. Re: SWF vs FLV
                            Mister Peanut Level 1
                            This is how I linked to my flv videos:

                            I selected the keyframe on which I wanted to have the video play.
                            I chose Import Video
                            Selected my FLV
                            Selected Skins, etc
                            The video componed then appeared on stage.
                            I resized the video to appear where I wanted it to.
                            Moved on to the next frame where I wanted the next video to appear.

                            I am pretty sure that this has made 5 separate video components in the website. Would this be the cause of such a large file size? I have many graphics and tweens throughout that probably contribute, as well as an external MP3. I made a mistake on the file size, as it is actually 673kb. Still too big? There are around 12 graphically-intensive pages.

                            I will check out gotoAndLearn.com.

                            • 11. Re: SWF vs FLV
                              Mister Peanut Level 1
                              gotoandlearn is awesome.