4 Replies Latest reply on Sep 22, 2006 2:03 PM by Newsgroup_User

    relative paths?

    Michael Lunsford
      I am attempting to use flashvars to determine a getURL address to get...

      for example: the flashvars param is "returnto=.." on some, and just "returnto=." on others. the getURL(returnto + "/index.html", "_self") seems to work fine online, but when I download the URL to my local hard drive, it tries to get index.html from system root.

      The client wants their site both online and burned to CDs for distribution with their brochure -- thus the relative path. Any idea what I'm doing wrong or how to fix?
        • 1. Re: relative paths?
          Michael Lunsford Level 1
          Oh, I feel I should mention that the flash menu itself is in the ../../graphics directory relative to some, and ../graphics relative to others.
          • 2. Re: relative paths?
            Level 7
            Michael,

            >> the getURL(returnto + "/index.html", "_self") seems to work
            >> fine online, but when I download the URL to my local hard
            >> drive, it tries to get index.html from system root.

            That makes sense, right? That's what the opening slash does: it sends
            you to the root. Servers are configured to let a "root" be something other
            than the actual root drive of the machine, which is why this works online.

            >> The client wants their site both online and burned to CDs
            >> for distribution with their brochure -- thus the relative path.
            >> Any idea what I'm doing wrong or how to fix?

            Look into the System.capabilities object. It provides a wealth of
            information, including a test for whether the SWF is being played in a
            browser or in a Projector (and more). Use an if() statement to check where
            the SWF is being played, then direct your getURL() function to the relevant
            relative path.


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


            • 3. Re: relative paths?
              Michael Lunsford Level 1
              Thanks for the reply. I'm afraid my comments may have been a bit misleading. The actual directory where the files reside are not in the domain root, but rather a subdirectory.

              so. http://www.example.com/path/to/file.html will point to ../index.html -- which should be /path/index.html. This seems to be working fine on the server, but when brought local I get a 404 not found in the browser -- reporting that we're looking for file:///path/index.html.

              Second challenge is the site isn't going to be projected any differently between the CD and the URL because the local version is HTML embedded flash just like the online version. Can the System.capabilities still see that it's local, even if I'm running it in a browser?

              Thanks!

              PS> I'm running MX2004
              • 4. Re: relative paths?
                Level 7
                Michael,

                > Thanks for the reply. I'm afraid my comments may have
                > been a bit misleading.

                We'll give it another shot. :)

                > The actual directory where the files reside are not in the
                > domain root, but rather a subdirectory.

                That's fine. As long as it's a place you could reach with a relative
                path, you're in the clear.

                > so. http://www.example.com/path/to/file.html will point to
                > ../index.html -- which should be /path/index.html. This seems
                > to be working fine on the server, but when brought local I get
                > a 404 not found in the browser -- reporting that we're looking
                > for file:///path/index.html.

                This must depend on where you're playing the file locally. If you're
                instructing it to back up one folder, which is what ../ does, then it will
                back up one folder. If, in doing so, it cannot find a subfolder named path,
                or an index.html inside that ... well, you'd be out of luck.

                Tip: When a SWF is embedded in an HTML document, it sees *that page* as
                its point of view for relative paths, rather than itself. If the SWF and
                the HTML document are in the same folder, the point of view amounts to the
                same. If they're in different folders, it is still the HTML document's
                folder that "feels like home" to the SWF embedded in that document. This
                rule of thumb holds for relative paths references from the SWF for anything
                but FLV files.

                > Second challenge is the site isn't going to be projected any
                > differently between the CD and the URL because the local version
                > is HTML embedded flash just like the online version.

                Aha.

                > Can the System.capabilities still see that it's local, even if I'm
                > running it in a browser?

                You'll have to check. But if it doesn't, you can always check the
                MovieClip._url property of the _root. The published SWF itself is a movie
                clip, so all of the MovieClip class members are valid for it. If you check
                _root._url, you'll get a string that either contains http: or file: -- that
                should do it. :)


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