1 Reply Latest reply on Nov 4, 2007 8:00 AM by Peter deHaan

    Validating Photo Link

    ab1301 Level 1
      I want to allow users to add a link to a photo. Before I allow the user to submit the link, I want to validate it, to make sure the link points to an image that can be displayed by flex. Right now, I have textInput for the user to enter the link, and an image with the source set to the textInput. When a valid link is typed into the input, an image is displayed, and when an invalid link is typed a broken link is displayed.

      What I would like to do is have a Submit button that submits the link if the image is displayed properly, and displays an error message if the broken link symbol is displayed. How do I get flash to tell me whether or not the image is being displayed properly?
        • 1. Re: Validating Photo Link
          Peter deHaan Level 4
          ab1301,

          It may be easier to just try and load the image (regardless of whether it is a valid URL) and then listen for the httpStatus event to determine if the load was successful. Then, if the status code is something like "404" or "500", you could hide the broken image icon (and then set the visible property to true if the status is "200").