home *** CD-ROM | disk | FTP | other *** search
/ Practice Anatomy Lab / PAL.ISO / pc / PAL.swf / scripts / __Packages / com / argosy / ui / ImageLoader.as < prev    next >
Encoding:
Text File  |  2007-03-19  |  1.8 KB  |  68 lines

  1. class com.argosy.ui.ImageLoader extends com.argosy.ui.baseUI
  2. {
  3.    var content_mc;
  4.    var loader;
  5.    var dispatchEvent;
  6.    function ImageLoader()
  7.    {
  8.       super();
  9.    }
  10.    function clearImage()
  11.    {
  12.       this.content_mc.image.removeMovieClip();
  13.    }
  14.    function loadImage(url)
  15.    {
  16.       trace("loadImage: " + url);
  17.       this.content_mc.image.removeMovieClip();
  18.       this.content_mc.createEmptyMovieClip("image",100);
  19.       this.loader.loadClip(url,this.content_mc.image);
  20.    }
  21.    function init()
  22.    {
  23.       this.loader = new MovieClipLoader();
  24.       this.loader.addListener(this);
  25.       super.init();
  26.    }
  27.    function createChildren()
  28.    {
  29.       this.content_mc = this.createEmptyMovieClip("content_mc",100);
  30.       this.content_mc.cacheAsBitmap = true;
  31.    }
  32.    function fadeInImage()
  33.    {
  34.       new mx.transitions.Tween(this.content_mc.image,"_alpha",mx.transitions.easing.None.easeOut,0,100,5,true);
  35.    }
  36.    function scaleImage()
  37.    {
  38.       if(this.content_mc.image._width > this.width || this.content_mc.image._height > this.height)
  39.       {
  40.          var _loc2_ = 1 * Math.max(this.width / this.content_mc.image._width,this.height / this.content_mc.image._height) * 100;
  41.          this.content_mc.image._xscale = _loc2_;
  42.          this.content_mc.image._yscale = _loc2_;
  43.       }
  44.    }
  45.    function layout()
  46.    {
  47.    }
  48.    function onLoadInit(target_mc)
  49.    {
  50.       this.scaleImage();
  51.       this.dispatchEvent({type:"image_load",target:this});
  52.    }
  53.    function onLoadStart(target_mc)
  54.    {
  55.    }
  56.    function onLoadError(target_mc, errorCode)
  57.    {
  58.       trace("onLoadError: " + errorCode);
  59.       this.dispatchEvent({type:"image_error",target:this,error:errorCode});
  60.    }
  61.    function onLoadProgress(target_mc, loadedBytes, totalBytes)
  62.    {
  63.    }
  64.    function onLoadComplete(target_mc)
  65.    {
  66.    }
  67. }
  68.