1 Reply Latest reply on Nov 18, 2006 5:54 AM by R@plicant

    Image Alternative Source

    R@plicant
      I'm looking for a methode to load an alternative source loading when mx.controls.Image receives a ioError event. Why you ask? Because i am creating a caching system for my images, so basicly my server gets picture strings from database like: "{'/images/cache/'+data.picturenum+'_icon.jpg'}". But when the Image component receives an ioError it should load the caching php script that it fetches the right picture from the net like: "{'/images/cacher.php?picnum='+data.picturenum}". So far i have not succeeded to override the "override mx_internal contentLoaderInfo_ioErrorEventHandler(event:IOErrorEvent)" method. Below is the code so far:


      package com.wepshop
      {

      import mx.controls.Image;

      public class ShopImage extends Image
      {
      [Bindable]
      private var altsourceLoaded:Boolean = false;
      private var _altsource:Object;

      public function ShopImage()
      {
      super();

      }

      public function set altsource(value:Object) {
      _altsource = value;
      }

      override mx_internal function contentLoaderInfo_ioErrorEventHandler(event:IOErrorEvent):void
      {
      if(!altsourceLoaded) {
      source = _altsource;
      load();
      altsourceLoaded = true;
      } else {
      super.contentLoaderInfo_ioErrorEventHandler(event);
      }
      }
      }
      }
      Can anyone tell what i am doing wrong?