Setting left- or right-oriented layout on MOUSE_OVER

i have an event that fires on roll-over in my thumbnail class. it sets the position of all my children within the thumbnail object class to be right aligned.

i need to set up a statement that looks at the placement of the thumb on the stage (which is built in my main document class) and loads up my children to the left of the thumb.

what’s the best way to do this? i tried to do it by adding an if statement inside the constructor, but got nowhere…i also tried to do a switch statement, which, since i don’t know how to do it right didn’t work either.

here’s the relevant bit of code:



public function Thumbnail(thumb:String, title:String, date:String) {

**           // all my textformatting is in here...i cut it out for readability**

            this.addEventListener(MouseEvent.MOUSE_OUT, onHoverOut);
            this.addEventListener(MouseEvent.MOUSE_OVER, onHoverRight);
            
       **     if (this.width >= stage.stageWidth) {
                
            this.addEventListener(MouseEvent.MOUSE_OVER, onHoverLeft);
            
                     }**
/*            
            switch (this) {
                
                case this.width >= stage.stageWidth - 5:
                this.addEventListener(MouseEvent.MOUSE_OVER, onHoverLeft);
                break;
                
                case this.width <= stage.stageWidth - 5:
                this.addEventListener(MouseEvent.MOUSE_OVER, onHoverRight);
                break;
                
                default:
                
                }*/
        }

        private function onHoverRight(e:MouseEvent):void {
            
            dateTXT.visible=true;
            titleTXT.visible=true;
            box.visible = true;
            this.width = 225;
            this.scaleX = 1;
            parent.setChildIndex(this, parent.numChildren-1);

        }

        private function onHoverLeft(e:MouseEvent):void {

            dateTXT.x = -165;
            dateTXT.visible=true;
            titleTXT.x = -165;
            titleTXT.visible=true;
            box.visible = true;
            box.x = -170;
            this.scaleX = 1;
            parent.setChildIndex(this, parent.numChildren-1);

        }