3 Replies Latest reply on Oct 17, 2007 11:40 AM by Newsgroup_User

    Getting the server Host name in Action Script?

    Level 7
      Good Morning --

      Is it possible in a flash movie (CS3/AS 3.0) to get the host name of the
      server running the flash movie?

      For example, if the URL is http://www.domain.com/movie.swf, I would like to
      be able to read a variable / function and have the result be "domain.com"

      Thanks

      Rich


        • 1. Re: Getting the server Host name in Action Script?
          Raju Khinda Level 1
          Hi Rich Morey ,

          I think it is not possible in as3.0 becoz it tottly support client . We can get client information with System class .

          Thanks
          Raj
          • 2. Re: Getting the server Host name in Action Script?
            Level 7
            Rich,

            > Is it possible in a flash movie (CS3/AS 3.0) to get the host name
            > of the server running the flash movie?

            In AS2, it was a simple matter of checking MovieClip._url against the
            root, since the main timeline is, after all, a movie clip ...

            trace(_root._url);

            ... then manipulating the string -- say, with String.substr() -- to format
            it how you need.

            In AS3, it's a simple matter of checking the LoaderInfo instance
            associated with the root. In AS3, the main timeline is an instance or
            subclass of DisplayObject (such as Sprite or MovieClip), and DisplayObject's
            have a loaderInfo property that refers to the necessary associated
            LoaderInfo instance, which has a loaderURL property that points to what
            you're after:

            trace(root.loaderInfo.loaderURL);

            If you pop a quick dynamic text field in the main timeline and give it
            the instance name output, you could put this line of code in a script layer:

            output.text = root.loaderInfo.loaderURL;

            ... and you'd see the info you're after. Again, use String methods to chop
            off whatever part of the string you don't need.


            David Stiller
            Co-author, Foundation Flash CS3 for Designers
            http://tinyurl.com/2k29mj
            "Luck is the residue of good design."


            • 3. Re: Getting the server Host name in Action Script?
              Level 7
              Excellent! Thank you. I will give this a shot.

              Rich

              "David Stiller" <stiller@quip-remove-.net> wrote in message
              news:ff57ge$hj2$1@forums.macromedia.com...
              > Rich,
              >
              >> Is it possible in a flash movie (CS3/AS 3.0) to get the host name
              >> of the server running the flash movie?
              >
              > In AS2, it was a simple matter of checking MovieClip._url against the
              > root, since the main timeline is, after all, a movie clip ...
              >
              > trace(_root._url);
              >
              > ... then manipulating the string -- say, with String.substr() -- to format
              > it how you need.
              >
              > In AS3, it's a simple matter of checking the LoaderInfo instance
              > associated with the root. In AS3, the main timeline is an instance or
              > subclass of DisplayObject (such as Sprite or MovieClip), and
              > DisplayObject's have a loaderInfo property that refers to the necessary
              > associated LoaderInfo instance, which has a loaderURL property that points
              > to what you're after:
              >
              > trace(root.loaderInfo.loaderURL);
              >
              > If you pop a quick dynamic text field in the main timeline and give it
              > the instance name output, you could put this line of code in a script
              > layer:
              >
              > output.text = root.loaderInfo.loaderURL;
              >
              > ... and you'd see the info you're after. Again, use String methods to
              > chop off whatever part of the string you don't need.
              >
              >
              > David Stiller
              > Co-author, Foundation Flash CS3 for Designers
              > http://tinyurl.com/2k29mj
              > "Luck is the residue of good design."
              >