1 Reply Latest reply on Jun 23, 2008 11:54 AM by matthew horn

    Image Loader Question

    Level 7
      Hi

      I am using a Loader to get an image from a server. The url causes a
      web-service type handler to stream the requested image back to the client.

      No problem so far.

      My problem is that I need to return some kind of text based error message
      like: "Session Expired" or "You don't have access to this image etc"

      I am using the IOError event and trying to access the Loader.content object
      without much success.


      Can anyone help me with this please..

      Thanks

      Martyn



        • 1. Re: Image Loader Question
          matthew horn Level 3
          Does this help?

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">

          <mx:Script>
          <![CDATA[
          import mx.controls.Alert;
          import flash.events.IOErrorEvent;
          import mx.utils.ObjectUtil;

          private function initApp():void {
          ml1.addEventListener("ioError", myErrorHandler);
          ml1.source="SWF_With_An_Error.swf";
          }

          private function myErrorHandler(e:IOErrorEvent):void {
          trace(ObjectUtil.toString(ml1.content.loaderInfo));
          mx.controls.Alert.show("There was an error loading the SWF");
          ml1.source = null;
          }
          ]]>
          </mx:Script>

          <mx:SWFLoader id="ml1"/>
          </mx:Application>

          matt horn
          flex docs