Load external file - the infamous Error #1009

By itself, the gallery that I found here (http://www.kirupa.com/forum/showthread.php?t=272301) can run successfully.

But when I load it into another movie I got this error :


TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at classes::Script()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at classes::ImageViewer()
	at classes::Script/xmlLoaded()
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at flash.net::URLLoader/onComplete()


Here’s the Script.as


package classes {
	
	import flash.display.Sprite;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.events.Event;
	
	public class Script extends Root {
		
		private var xmlLoader:URLLoader = new URLLoader ();
		
		private var container:Sprite = new Sprite ();
		
		private var thumbScroller:ThumbScroller;// = Root.thumbScroller;
		private var galleryChooser:GalleryChooser;// = Root.galleryChooser;
		private var imageViewer:ImageViewer;// = Root.imageViewer;
		
		public function Script () {
			xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded);
			xmlLoader.load (new URLRequest ('images.xml'));
			
			addChild (container);

			Root.stage.addEventListener (Event.RESIZE, stageResized);
		}
		
		private function stageResized (evt:Event) : void {
			container.y = int ((stage.stageHeight - container.height) * .5);
		}
		
		private function xmlLoaded (evt:Event) : void {
			Root.images = new XML (evt.target.data);
			Root.curGal = images.gallery [0].@name;
			
			imageViewer = new ImageViewer ();
			imageViewer.x = int ((stage.stageWidth - imageViewer.width) * .5);
			
			thumbScroller = new ThumbScroller ();
			thumbScroller.y = int (imageViewer.y + imageViewer.height + 15);
			container.addChild (thumbScroller);
			
			thumbScroller.construct (Root.images.gallery [0]);
			
			addEventListener ('LOADING_COMPLETE', imageLoaded);
			
			if (Root.images.gallery.length () != 1) {
				galleryChooser = new GalleryChooser (thumbScroller);
				galleryChooser.x = int ((stage.stageWidth - galleryChooser.width) * .5);
				//galleryChooser.x = int (galleryChooser.x);
				galleryChooser.y = int (thumbScroller.y + thumbScroller.height + 15);
				
				
				
				container.addChild (galleryChooser);
				
				Root.galleryChooser = galleryChooser;
			}
			
			container.addChild (imageViewer);
			
			container.y = int ((stage.stageHeight - container.height) * .5);
			container.cacheAsBitmap = true;
			
			Root.imageViewer = imageViewer;
			Root.thumbScroller = thumbScroller;
			Root.container = container;
		}
		
		private function imageLoaded (evt:Event) : void {
			evt.stopPropagation ();
			
			if (evt.target.imageName != Root.curImage) {
				imageViewer.showImage (evt.target.image, evt.target.imageName, evt.target.url);
				Root.curImage = evt.target.imageName;
			}
		}
	}
}

Can someone help me?