3 Replies Latest reply on Nov 4, 2006 6:38 AM by Newsgroup_User

    testing for web

    Level 7

      I want to have a local movie to display an image from a website. I can
      do this through importFileInto - right? But to ensure some graphic
      shows, if the internet page is not found then it well use a local image
      instead.

      So how do I do that
      * test to see if website is active
      * best way to link to that file and use placeholder graphic if image is
      not found.

      Thanks

        • 1. Re: testing for web
          Level 7
          Hi student,

          Use downloadNetThing() to get a remote file.
          Use netDone() to test for completeness of the download
          Use netError() to see if all is well (file loaded OK or not)
          Use importFileInto() to import dowloaded file in cast

          In your case (or better, at all times) you need to check for neterrors
          after netDone equals true. If no error occurred, you can use the
          downloaded graphic, otherwise display some error or any default image
          you like.

          hope this helps,
          Manno

          uni-student wrote:
          > I want to have a local movie to display an image from a website. I can
          > do this through importFileInto - right? But to ensure some graphic
          > shows, if the internet page is not found then it well use a local image
          > instead.
          >
          > So how do I do that
          > * test to see if website is active
          > * best way to link to that file and use placeholder graphic if image is
          > not found.
          >
          > Thanks
          >

          --
          ----------
          Manno Bult
          manno@xs4all.nl
          • 2. Re: testing for web
            Level 7
            > hope this helps,
            > Manno
            >

            Manno - It helps very much. Thanks for being so clear and detailed in
            giving me everything I need to know. I'll go test it out.

            • 3. Re: testing for web
              Level 7

              You're welcome!

              but after rereading I think I could have been more clear (was about to
              leave). The list of commands I gave is all you need, but also the
              sequence of steps taken to achieve the desired result.

              So (a bit more detailed):

              -- declare global var of net operation in each script that uses it
              global netID

              -- initiate download
              netID = downloadNetThing("remote", "local")

              -- in a frameloop further down the line or in a timeout script
              if ( netDone(netID) = true ) then

              if ( netError(netID) = 0 ) then
              importFileInto("local")
              else
              -- report error/show default image
              end if

              end if

              I couldn't help it but write it out...


              uni-student wrote:
              >> hope this helps,
              >> Manno
              >>
              >
              > Manno - It helps very much. Thanks for being so clear and detailed in
              > giving me everything I need to know. I'll go test it out.
              >

              --
              ----------
              Manno Bult
              manno@xs4all.nl