Preload+classes

Hello I have a problem with something pretty simple I can’t understand…
I have a fla file where I set the export classes frame to be different than 1 (the frame is 3 in this case) and on the fifth frame I have a stop(); action and a movie clip that’s instance of a class that’s linked to it from the library. And when the movie clip has no instance name everything is ok but when I give it one this error appears:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2d14821 to Roller.

I have no clue how to fix it, please help.

Here’s an exemplary file:

Ok.
I has lincage MovieClip class


package {
     import flash.display.*; 
     import flash.text.*; 
     import flash.geom.*;
 
 
    public class Central_all_loading_prog extends MovieClip {
    public var my_txt:TextField;
 
 
        public function Central_all_loading_prog() {
              var txt:TextField = new TextField();
              txt.text = "I am loading for 2 frame";
              txt.autoSize = TextFieldAutoSize.LEFT;            
              txt.scaleX=txt.scaleY=3;
              addChild(txt);//
              my_txt = txt;
 
        }
    }
}
 

and Documen Class export in 2 frame? if I want new Central_all_loading_prog
in Document Class mast loading class Central_all_loading_prog


var Load_Central_all_loading_prog:Class = 
loaderInfo.applicationDomain.getDefinition("Central_all_loading_prog") as Class;

Document class all coding


package {
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;
     import flash.filters.*;    
 
    public class My_doc_class extends MovieClip {
 
 
 
        public function My_doc_class() {
            //super();
            stop();
            preload_mc.scaleX = 0;
            loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            loaderInfo.addEventListener(Event.COMPLETE, completeHandler);
        }
 
        private function progressHandler(event:ProgressEvent):void {
            var loaded:uint = event.bytesLoaded;
            var total:uint = event.bytesTotal;
            var procent:uint = int(loaded/total*100);
            preload_mc.scaleX = loaded/total;
            preload_txt.text = "Progress
"+int(loaded/total*100);
            preload_txt.filters= new Array(new GlowFilter (0xffff00, procent, procent, procent,procent, 3, false, false));
        }
 
        private function completeHandler(event:Event):void {
            gotoAndStop(2);
            main();//after all loading
            //}
        }
 
        private function main():void {
            stop();
            var Load_Central_all_loading_prog:Class = 
            loaderInfo.applicationDomain.getDefinition("Central_all_loading_prog") as Class;
            var ex_mc = new Load_Central_all_loading_prog();//loading_class
            addChild(ex_mc);//this MovieClip has Class and his in 2 frame (SHOW HIM)
            ex_mc.y = 300;
            with (ex_mc.my_txt){border = true; background = true; y = -50;backgroundColor = 0xff0000;
            selectable = false; htmlText = "<a href=\"event:track1.mp3\">Press me</a>";}
            ex_mc.my_txt.addEventListener(TextEvent.LINK, goto_next);
            function goto_next(TextEvent)
            {
                nextFrame();
                stop();
                removeChild(ex_mc);
                var txt = new TextField();txt.scaleX=txt.scaleY=4;
                txt.htmlText = "<a href='http://www.dnadillo.dn.ua/fla/Prelod_2_frame.zip'>Zip</a>";
                addChild(txt);
            }
 
            /* // Logic, but not working code:
            var program:Central_all_loading_prog = new Central_all_loading_prog();
            addChild(program);
            */
        }
    }
}

example
http://www.dnadillo.dn.ua/fla/Preload-second-fram.html