home *** CD-ROM | disk | FTP | other *** search
- class application.ui.PicLoader extends MovieClip
- {
- var instCounter;
- var align;
- var height;
- var width;
- var pic;
- var onEnterFrame;
- function PicLoader()
- {
- super();
- this.instCounter = 1;
- }
- function loadPic(picture, width, height, align)
- {
- this.align = align;
- this.height = height;
- this.width = width;
- this.pic = this.createEmptyMovieClip("pic",this.instCounter++);
- if(picture != null)
- {
- this.pic.loadMovie(picture);
- this.onEnterFrame = function()
- {
- if(this.pic.getBytesLoaded() > 10 && this.pic.getBytesLoaded() >= this.pic.getBytesTotal() && this.pic._currentframe >= 1)
- {
- if(this.pic._width > this.width)
- {
- this.pic._width = this.width;
- this.pic._yscale = this.pic._xscale;
- }
- if(this.pic._height > this.height)
- {
- this.pic._height = this.height;
- this.pic._xscale = this.pic._yscale;
- }
- switch(this.align)
- {
- case "right":
- this.pic._x = int(this.width - this.pic._width);
- break;
- case "center":
- this.pic._x = int((this.width - this.pic._width) / 2);
- }
- if(this.pic._width <= this.width && this.pic._height <= this.height)
- {
- this.onEnterFrame = null;
- }
- }
- };
- }
- else
- {
- this.pic.unloadMovie();
- }
- }
- }
-