I tried to capture the TitleWindow focus, which I did, but somehow I
can no longer focus in its RichEdit component. Attached is my code.
Could anyone shred some light on it? Thanks!




/*==========================================================
  Main application
  ==========================================================*/
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
         xmlns:mx="http://www.adobe.com/2006/mxml";
         xmlns:user="*"
         layout="absolute" backgroundGradientColors="[#c6cdfd, #eeeeee]">
        <mx:Script>
                <![CDATA[
            import mx.core.*;
                        import mx.managers.PopUpManager;                        

                        [Bindable]
                        protected var _imX:int = 30;
                        protected var _imY:int = 30;
                        protected var _dist:int = 30;
                        

                        // create a new IM window, or bring the existing 
session to the front
                        protected function newWin(e:Event):void{
                                var win:myWin = null;
                                win = myWin(PopUpManager.createPopUp(this, 
myWin));
                                win.x = _imX;
                                win.y = _imY;
                                _imX += _dist;
                                _imY += _dist;
                        }
                ]]>
        </mx:Script>

        <mx:Button label="New window" top="20" height="60" width="180"
fontSize="16"
                click="newWin(event)" right="20"/>

</mx:Application>




/*==========================================================
  myWin.mxml
  ==========================================================*/

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"; 
        layout="absolute" width="504" height="378" fontWeight="bold"
        backgroundAlpha="0.9" showCloseButton="true"
updateComplete="rteInput.setFocus()"
        initialize="_init()" title="my title window"
        >
        <mx:Script>
                <![CDATA[
                        import mx.controls.List;
            import mx.managers.PopUpManager;
            import mx.core.*;
                        
                        [Bindable]
                        protected var _headerColors:Array = [["#AAAAAA", 
"#EEEEEE"],            //
blurred,
                                                                                
                 ["#A65904", "#E68701"]                 // focused
                                                                                
                ];

                        protected function _init():void {
                                this.addEventListener(FocusEvent.FOCUS_IN, 
focusInHandler);
                                this.addEventListener(FocusEvent.FOCUS_OUT, 
focusOutHandler);
                        }
                        
                        // $style: 0 - blurred, 1 - focused
                        public function setFocusStyle($style:Number):void {
                                setStyle("headerColors", _headerColors[$style]);
                        }

                        override protected function 
focusInHandler(event:FocusEvent):void {
                                super.focusInHandler(event);
                                setFocusStyle(1);
                        }
                        
                        override protected function 
focusOutHandler(event:FocusEvent):void {
                                super.focusOutHandler(event);
                                setFocusStyle(0);
                        }
                ]]>
        </mx:Script>

        <mx:RichTextEditor id="rteInput" bottom="10" height="318" left="5"
right="10" enabled="true">
        </mx:RichTextEditor>
        
</mx:TitleWindow>


Reply via email to