2 Replies Latest reply on Feb 21, 2007 6:45 AM by vergeerkaas

    Refresh Image in loop

    vergeerkaas
      I'm new in Flex2 (mac) and searching for a way to refresh an mx:Image.
      I've created a for-next loop where the source of an mx:Image is
      changing a few times but the App is running so fast that it won't use
      any time to show me the new picture. Is there a way to tell the Flash
      enige to update it's graphics?

      Thanks in advance!

      Jaap Cammeraat
      http://www.vergeerkaas.nl
        • 1. Re: Refresh Image in loop
          peterent Level 2
          When you set the image's source property it doesn't actually change the image. The Flex framework waits until the end of the frame (remember that Flex is a SWF which is a movie-like format). So setting the image's source property over and over in a loop will only result in the last image shown when the loop ends the framework gets a chance to load the image.

          You should set up a complete event handler on the image. When the complete event handler fires it can then load the next image. You could also have 2 images, one in front of the other and show one at a time. You can set up a Fade effect on the image's using their hideEffect style. When an image has loaded, set it's visible property to true and the other image's visible property to false. Then one image will fade out showing the new one.

          Also check http://www.quietlyscheming.com for Ely's "SuperImage" control.
          • 2. Re: Refresh Image in loop
            vergeerkaas Level 1
            I've created a solution with the Timer class!