Bitmap smooth issue

Hi!

I’m trying add image smooth code to xml gallery (green text):

[COLOR=Silver]package 
{ 
    import caurina.transitions.*;
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.text.*;
    import flash.utils.*;
    

    public class mainClass extends MovieClip
    {
        
        private var numSlides:int;
        private var selectedThumb:MovieClip;
     
        private var xml:XML;
        public var container_mc:MovieClip;

       [/COLOR][COLOR=Silver] // and many more vars here

        public function mainClass(){
        
            transitionTime = 0.5;
            transitionType = "easeOutSine";
            yPos = 0;
            intCurrentSlide = -1;
                     
                             
            
            addEventListener(Event.ADDED_TO_STAGE,go);
        }[/COLOR]
        
       [COLOR=Silver] private function go(evt:Event):void
        {
            removeEventListener(Event.ADDED_TO_STAGE,go);
            xmlPaths = MovieClip(parent.parent).XmlDir;
            position();
            loadXml();
            return;
        }// end function[/COLOR]
        

       [COLOR=Silver] private function loadImage(param1:int) : void
        {
            var URLreq:URLRequest;
            var cont:MovieClip;
            var initCeva:Function;
            var done:Function;
            
            var init1:Function;
            var finishTween:Function;
            var intSlide:* = param1;
            initCeva = function (event:ProgressEvent) : void
            {
                container_mc.preloader_txt.visible = true;
                container_mc.preloader_txt.text = Math.floor(event.bytesLoaded / (event.bytesTotal / 100)) + " %";
                return;
            }// end function
            ;
            done = function (event:Event) : void
            {
                container_mc.preloader_txt.visible = false;
                position();
                
                Tweener.addTween(container_mc.bg, {width:event.currentTarget.width + 10, height:event.currentTarget.height + 10, time:transitionTime, transition:transitionType, onComplete:init1});
                Tweener.addTween(container_mc.btn, {width:event.currentTarget.width + 10, height:event.currentTarget.height + 10, time:transitionTime, transition:transitionType});
               
                return;
            }// end function
            
            init1 = function () : void
            {
                Tweener.addTween(cont, {time:transitionTime, alpha:1, transition:transitionType /*,onComplete:onSlideFadeIn*/});
               
                return;
            }// end function
            ;
            intCurrentSlide = intSlide;
            URLreq = new URLRequest(xml.node[selectGallery].picture[intCurrentSlide].img);
            description_mc.txt.htmlText = xml.node[selectGallery].picture[intCurrentSlide].desc;
           
            [COLOR=Black]loaderMC = new Loader();
            loaderMC.load(URLreq);
            cont = container_mc.container;
            cont.alpha = 0;
            loaderMC.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, initCeva);
            loaderMC.contentLoaderInfo.addEventListener(Event.COMPLETE, done);[/COLOR][/COLOR]
            [COLOR=SeaGreen]var image:Bitmap;[/COLOR]
            if (cont.numChildren >= 1)
            {
                finishTween = function () : void
            {
                cont.removeChildAt(0);
                [COLOR=SeaGreen]cont.image =loaderMC.content as Bitmap;
                cont.image.smoothing=true;[/COLOR] [COLOR=Blue] //<--- this is working fine[/COLOR]
                
                cont.addChild(loaderMC);
                loaderMC.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, initCeva);
                loaderMC.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
                position();
                return;
            }// end function
            
                Tweener.addTween(cont, {time:transitionTime, alpha:0, transition:transitionType, onComplete:finishTween});
            }
            else
            {  cont.addChild(loaderMC);
                
                [COLOR=SeaGreen]cont.image =loaderMC.content as Bitmap;
                cont.image.smoothing=true;[/COLOR]   [COLOR=Red]//<--- null object error [/COLOR]
               
            }

I don’t know why always first loaded photo is loading with null object error and without of smoothing, but any next photo is loading fine without of any errors and with smooth option enabled.

The gallery is loaded into main.swf with Loader class.

How can I fix this?

Pleas help! it is not commercial project, but i must finish it.

(sorry my English :frowning: )