Search code examples
apache-flexmodal-dialogtextareaflash-builder

Modal Spark TextArea?


I want to make the background appear as if a modal window was opened but, instead of a window, I wnat to use Spark TextArea.. Is this possible?


Solution

  • You can use PopUpManager to create any IFlexDisplayObject as a modal view.

    Example:

    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    
        <fx:Script>
            <![CDATA[
                import mx.managers.PopUpManager;
    
                import spark.components.TextArea;
                protected function button1_clickHandler(event:MouseEvent):void
                {
                    var ta:TextArea = new TextArea();
                    ta.width = 300;
                    ta.height = 200;
    
                    PopUpManager.addPopUp(ta, this, true);
                    PopUpManager.centerPopUp(ta);
                }
            ]]>
        </fx:Script>
    
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:Button label="Click" click="button1_clickHandler(event)"/>
    </s:Application>