1 Reply Latest reply on Jun 17, 2008 6:59 PM by *gsb*

    Check to see if image exists (Flex 3)

    CyberCoda
      Hi,

      I'm a newbie at Flex 3 and I'm trying to figure out as to how I can check to see if an image file exists and if it doesn't, then display a default image in it's place. The image file names are being pulled from a database query and then displayed in a TileList which uses the following ItemRenderer...

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml"
      styleName="plain"
      verticalAlign="middle"
      horizontalAlign="center"
      horizontalScrollPolicy="off"
      verticalScrollPolicy="off"
      width="100%"
      height="100%">

      <mx:Image source="assets/{data.ImageFilename}" height="200" width="150" />
      <mx:Label text="{data.Name}" truncateToFit="True" width="100" />
      </mx:VBox>

      I found a nice component that would simplify this but it is only applicable to Flex 1.5...

      <mx:Loader
      autoLoad="true|false"
      brokenImage="No default."
      source="No default."
      horizontalAlign="left|center|right"
      scaleContent="true|false"
      verticalAlign="top|middle|bottom"
      complete="Event handler; no default."
      progress="Event handler; no default."
      />

      Can anyone suggest a way of doing this in Flex 3?

      Thanks a mill!!!