1 Reply Latest reply on Sep 1, 2006 12:21 AM by avanthika

    how to show alternate image , when actual image is not loaded

    avanthika
      Hi all,
      I am loading a image from the server in my flex application, using image component.
      if that image does not load, in place of that i want to load alternate image, so i am checking http status to see whether image is loaded or not. if it is not loaded I changed the image source property to new image. but this is not working.

      i am using following code:


      <mx:Image id="img" horizontalAlign="center" source=" http://www.mydomain.com/2006/img1.jpg" httpStatus="imgLoadStatus(event)" />

      <mx:Script>
      <![CDATA[
      private function imgLoadStatus(evt:flash.events.HTTPStatusEvent):void{

      if(evt.status==404){
      evt.currentTarget.source="assets/altImg.jpg"

      }
      }
      ]]>
      </mx:Script>




      when img1.jpg is not loaded , i am changing source but it is not working,

      is their any other way to load alternate image in flex.
      Any one please help me how to solve this.

      Thanks in advance

      Regards
      Avanthika