7 Replies Latest reply on Apr 25, 2006 12:34 PM by Newsgroup_User

    Getting flash to know what it's filename is?

    Level 7
      Is it possible to get the filename of the swf loaded within the swf itself?


      Why? I have been working on a loader that checks the status of the load and
      reports back to the main timeline what is currently loaded (or trying to
      load and it's status).

      I would prefer it if i didn't have to write "var thisMovieName:String =
      'test.swf'; " in the first frame of every movie.

      Thanks,
      Koop


        • 1. Re: Getting flash to know what it's filename is?
          Level 7
          If you are loading an external movie you would know the file name to load
          it.

          To get the file name of the running movie I use:

          trace( _url.substr(_url.lastIndexOf("/")+1))



          --
          Lon Hosford
          www.lonhosford.com
          May many happy bits flow your way!
          "Koop" <koop@o2.nsm> wrote in message
          news:e1uqb2$62h$1@forums.macromedia.com...
          Is it possible to get the filename of the swf loaded within the swf itself?


          Why? I have been working on a loader that checks the status of the load and
          reports back to the main timeline what is currently loaded (or trying to
          load and it's status).

          I would prefer it if i didn't have to write "var thisMovieName:String =
          'test.swf'; " in the first frame of every movie.

          Thanks,
          Koop


          • 2. Re: Getting flash to know what it's filename is?
            NSurveyor Level 2
            Or....

            _url.split("/").pop()
            • 3. Re: Getting flash to know what it's filename is?
              Level 7
              Thank you for both of your replies, however this would only work for the
              container movie in the html if i'm correct. My task is for any swf loaded
              into another to know what it's name is at runtime. Is this possible?

              Nice trick though i'll find a use for those

              Koop.


              • 4. Re: Getting flash to know what it's filename is?
                NSurveyor Level 2
                clipLoadingSWF._url.split("/").pop()

                ?

                So, you are loading an swf into a movieclip, clipLoadingSWF for example? And you want to determine the filename of the loaded movieclip? As Motion Maker said, wouldn't you already know this?
                • 5. Re: Getting flash to know what it's filename is?
                  Level 7
                  Oh I see i thought this would only apply to the root movie clip.
                  And yes, generally i should already know this but it gets a little difficult
                  to keep all variable directories up to date a prevent overlaps without just
                  grabbing the current value of some of them. plus its an easier way to
                  prevent a user reloading a movie clip without again setting a variable
                  stating the current expected clip as many things can cause this to go wrong,
                  incomplete load, multiple rapid clicks to load different content etc.

                  Many thanks for your input, both of you.
                  Koop.


                  • 6. Re: Getting flash to know what it's filename is?
                    Level 7
                    Might want to disable the button or user control until the external movie is
                    loaded. This is a good use for MovieClipLoader.

                    --
                    Lon Hosford
                    www.lonhosford.com
                    May many happy bits flow your way!
                    "Koop" <koop@o2.nsm> wrote in message
                    news:e20mp5$fi9$1@forums.macromedia.com...
                    Oh I see i thought this would only apply to the root movie clip.
                    And yes, generally i should already know this but it gets a little difficult
                    to keep all variable directories up to date a prevent overlaps without just
                    grabbing the current value of some of them. plus its an easier way to
                    prevent a user reloading a movie clip without again setting a variable
                    stating the current expected clip as many things can cause this to go wrong,
                    incomplete load, multiple rapid clicks to load different content etc.

                    Many thanks for your input, both of you.
                    Koop.


                    • 7. Re: Getting flash to know what it's filename is?
                      Level 7
                      Yes, this is also a good way around some of the potential issues, I have
                      never really thought of this as a solution which is strange as it's the
                      first thing i do with any javascript that needs to have any catches in
                      place.

                      Thanks again,
                      Koop