Arranging movieclips on Z axis

Hi guys …

I’m a newbie to AS3 and I’m struggling with getting a mc to sit infront of this slideshow to overlay it …

My MC is called - overlay

How do I do this? I know it’s something to do with addChild() and addChildAt() but I don’t understand how to get it working as the overlay mc is in the library and the slideshow is dynamically generated …

Any help would be much appreciated!



package {

    import flash.display.Sprite;
    import flash.events.*;
    import flash.text.*;
    import noponies.net.LoadXml;
    import noponies.display.Xslides;

    public class As3_CrossFade extends Sprite {
        //private vars
        private var myloadXml:LoadXml;
        private var newSlides:Xslides;
        private var playPause:button_mc;
        private var prg_txt:TextField
        private var status_txt:TextField
        
        public function As3_CrossFade() {
            myloadXml = new LoadXml("images.xml");
            myloadXml.addEventListener(Event.COMPLETE, initSlides);
            //set the stage frame rate.
            stage.frameRate=31;
            //create a UI
            playPause = new button_mc();
            playPause.x = 200;
            playPause.y = 120;
            playPause.btn_txt.text = "PAUSE";
            playPause.addEventListener(MouseEvent.CLICK, playPauseSlides);
            addChild(playPause);
            //progress text
            //status text
            
        }
        //create a new instance of the crossfading slideshow in the callback
        //handler of the XML parsing routine.

        private function initSlides(event:Event):void {
            newSlides = new Xslides(myloadXml.imagesArray);
            newSlides.xFadeTime = 3;
            newSlides.imageTime = 4;
            newSlides.slidesPlayRandom = true;
            newSlides.slidesLoop = true;
            newSlides.slidesAutoPlay = true;
            //Note, add to display list after class instance props are set..
            addChild(newSlides);
            //demo event listeners showing how you can listen in for slide events and the use of some of the 
            //classes getter functions to access information about each slide.
            newSlides.addEventListener(Event.OPEN, handleSlideOpen);
            newSlides.addEventListener(ProgressEvent.PROGRESS, handleSlideProgress);
            newSlides.addEventListener(Event.COMPLETE, handleSlideLoad);
            newSlides.addEventListener(Xslides.SLIDE_SHOW_COMPLETE, handleSlideShowComplete);
        }
        private function playPauseSlides(event:MouseEvent):void {
            if (!newSlides.slideShowPaused) {
                newSlides.dispatchEvent(new Event(Xslides.PAUSE_SLIDE_SHOW,true));
                playPause.btn_txt.text = "PLAY";
            } else {
                newSlides.dispatchEvent(new Event(Xslides.RESUME_SLIDE_SHOW,true));
                playPause.btn_txt.text = "PAUSE";
            }
        }
        private function handleSlideLoad(event:Event):void {
            status_txt.text = "Slide number "+newSlides.currentImage+" of "+newSlides.totalSlides+" slides loaded";
        }
        private function handleSlideOpen(event:Event):void {
            trace("New slide "+newSlides.currentImageName+" requested");
        }
        private function handleSlideProgress(event:ProgressEvent):void {
            prg_txt.text = Math.round(100 * (event.bytesLoaded / event.bytesTotal))+" %"
        }
        private function handleSlideShowComplete(event:Event):void {
            trace("Shows Over");
        }
        
        //text field utility creation method
        //fileText = createDynTextField("Selected File: " + fileNameString)
        public static function createDynTextField(txt:String):TextField {
            var tf:TextField = new TextField()
            tf.type=TextFieldType.DYNAMIC;
            tf.autoSize=TextFieldAutoSize.LEFT;
            tf.embedFonts = true
            tf.antiAliasType = AntiAliasType.ADVANCED;
            tf.multiline = true
            tf.wordWrap = false;
            tf.mouseEnabled=false;    
            tf.text = txt
            return tf;
        }
        
        //util textformat creaton function
        public static function createTextFormat(size:int, colour:int, weight:Boolean,font:Class, leading:int,kerning:Number):TextFormat {
            var tfFormat = new TextFormat();
            tfFormat.font = new font().fontName;//class name of font in parent library
            tfFormat.size=size;
            tfFormat.bold=weight;
            tfFormat.color=colour;
            tfFormat.letterSpacing=kerning;
            tfFormat.leading = leading;
            return tfFormat;
        }
    }
}