flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: focusManager and Popup with TitleWindow
Date Tue, 17 Dec 2013 17:51:43 GMT
Probably calling too soon.  Try waiting until after addPopUp returns or on
creationComplete event

On 12/17/13 8:14 AM, "mark goldin" <markzolotoy@gmail.com> wrote:

>Not sure if this is a bug but here is the situation.
>I am creating a popup based on TitleWindow. I am trying to access
>focusManager in the following fashion:
>trace(UIComponent(control_ID).focusManager);
>
>I am getting null.
>Here are two sample files:
>
>TitleWindowTest.mxml
><?xml version="1.0" encoding="utf-8"?>
><!--
>http://blog.flexexamples.com/2009/10/23/displaying-a-popup-spark-titlewind
>ow-container-in-flex-4/-->
><s:Application name="Spark_TitleWindow_test"
>   xmlns:fx="http://ns.adobe.com/mxml/2009"
>   xmlns:s="library://ns.adobe.com/flex/spark"
>   xmlns:mx="library://ns.adobe.com/flex/halo">
><s:controlBarContent>
><s:Button id="btn"
>  label="Show TitleWindow"
>  click="btn_click(event);" />
></s:controlBarContent>
> <fx:Script>
><![CDATA[
>import mx.core.UIComponent;
>import mx.managers.PopUpManager;
> protected function btn_click(evt:MouseEvent):void {
>var ttlWndw:MyTitleWindow = PopUpManager.createPopUp(this, MyTitleWindow,
>true) as MyTitleWindow;
>PopUpManager.centerPopUp(ttlWndw);
>}
>override protected function childrenCreated():void
>{
>trace(UIComponent(textinput).focusManager);
>}
>]]>
></fx:Script>
><s:TextInput id="textinput"/>
></s:Application>
>
>MyTitleWindow.mxml
><?xml version="1.0" encoding="utf-8"?>
><!--
>http://blog.flexexamples.com/2009/10/23/displaying-a-popup-spark-titlewind
>ow-container-in-flex-4/-->
><s:TitleWindow name="MyTitleWindow"
>   xmlns:fx="http://ns.adobe.com/mxml/2009"
>   xmlns:s="library://ns.adobe.com/flex/spark"
>   xmlns:mx="library://ns.adobe.com/flex/halo"
>   title="Spark TitleWindow title"
>   width="300" height="200"
>   close="ttlWndw_close(event);">
> <fx:Script>
><![CDATA[
>import mx.core.IFlexDisplayObject;
>import mx.events.CloseEvent;
>import mx.managers.PopUpManager;
>import mx.core.UIComponent;
>protected function ttlWndw_close(evt:CloseEvent):void {
>PopUpManager.removePopUp(evt.currentTarget as IFlexDisplayObject);
>}
>override protected function childrenCreated():void
>{
>trace(UIComponent(textinput).focusManager);
>}
>]]>
></fx:Script>
><s:TextInput id="textinput"/>
></s:TitleWindow>
>
>Works fine in the main file, but not in the popup.
>
>Thanks for help.


Mime
View raw message