7 Replies Latest reply on Dec 18, 2006 11:19 AM by dustinvh

    External FLV to swf

    dustinvh
      Is it possible to load an external flv and then load a swf file when the flv has finished? I've looked through the forums but haven't come across any solutions. Any help would greatly be appreciated.

      Thanks in advance.
        • 1. Re: External FLV to swf
          Level 7
          dustinvh,

          > Is it possible to load an external flv and then load a
          > swf file when the flv has finished?

          Sure thing. Flash is capable of loading both FLVs and SWFs at runtime.
          Is your question specifically how to tell when the FLV has finished playing?


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: External FLV to swf
            dustinvh Level 1
            Thank you for the information.
            I apologize for the question, I am playing flv and trying to load swf when the flv is finished playing.

            The flv was created by the Flash 8 encoder if that will make a difference on how to correct the problem.
            • 3. Re: External FLV to swf
              Level 7
              dustinvh,

              > Thank you for the information.
              > I apologize for the question, I am playing flv and trying
              > to load swf when the flv is finished playing.

              Okay, that's what I was thinking.

              > The flv was created by the Flash 8 encoder if that will
              > make a difference on how to correct the problem.

              Nah, that doesn't really make a difference. It's going to take a bit of
              code, and it isn't especially easy if you're totally new to programming.
              The most organized answer I have personally -- and it's not even especially
              organized -- are the comments to this one article I blogged on a while back.

              http://www.quip.net/blog/2006/flash/how-to-load-external-video

              Make some popcorn, because it's a long show. ;) In particular, pay
              attention to my May 16, 2006, reply to Mark.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."


              • 4. Re: External FLV to swf
                dustinvh Level 1
                Hi David,
                Thank you for the information, I read through your blog and tried a few things but I am not proficient enough with flash to make it work. Do you have any ActionScipt examples or now of any examples that I could look at.

                Thanks again,
                Dustin
                • 5. Re: External FLV to swf
                  Level 7
                  Dustin,

                  > Thank you for the information, I read through your
                  > blog and tried a few things but I am not proficient
                  > enough with flash to make it work.

                  That particular entry isn't especially clear, given that the suggestions
                  are spread among the entry itself and its comments.

                  > Do you have any ActionScipt examples or now of
                  > any examples that I could look at.

                  Sure. From one of the comments itself:

                  // Load the video
                  var nc:NetConnection = new NetConnection();
                  nc.connect(null);
                  var ns:NetStream = new NetStream(nc);
                  videoPlayer.attachVideo(ns);
                  ns.play("externalVideo.flv");
                  // Monitor the video
                  this.onEnterFrame = function() {
                  if (ns.time >= 25) {
                  trace("Video is finished!");
                  delete this.onEnterFrame;
                  }
                  }
                  That handles the loading of the video, as explained in the article, as
                  well, as a loop to check the NetStream.time property against an arbitrary
                  figure -- in this case, 25. This requires that you know the length of the
                  video beforehand, which may or may not meet your needs.

                  The trouble is that there isn't a way to check the length of the video
                  programmatically unless you have Flash Media Server. That's where the
                  arbitrary 25 comes into play in the above sample code.

                  There's also the NetStream.onStatus approach, alluded to in that and
                  other comments. Thing is, I haven't done enough testing on my own to be
                  fully confident that checking for a status message indicates the end of the
                  video as opposed to a "hiccup" due to network traffic or some other pause.


                  David Stiller
                  Adobe Community Expert
                  Dev blog, http://www.quip.net/blog/
                  "Luck is the residue of good design."


                  • 6. Re: External FLV to swf
                    jonnybennett Level 1
                    You could also check out http://www.gotoandlearn.com ... there are really good video tutorials on using flash video and other actionscript stuff.
                    • 7. Re: External FLV to swf
                      dustinvh Level 1
                      David,

                      The script works perfectly, thank you for the help.


                      Thanks,
                      Dustin