Solved! Go to Solution.
this.addElement(printBox);
this.removeElement(printBox);
this.parent.addChild(printBox);
this.parent.removeChild(printBox);
private var printWin:PrintWidgetWindow; private function showPrint():void { printWin = PopUpManager.createPopUp(this, PrintWidgetWindow,false) as PrintWidgetWindow; printWin.map = myMap; PopUpManager.centerPopUp(printWin); }
<?xml version="1.0" encoding="utf-8"?> <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Script> <![CDATA[ import com.esri.ags.Map; import mx.events.CloseEvent; import mx.managers.PopUpManager; [Bindable] public var printWidgetOpen:Boolean = false; private var printWid:PrintWidget; public var map:Map; protected function hgroup1_rollOutHandler(i:Image):void { i.width = 30; i.height = 30; } protected function hgroup1_rollOverHandler(i:Image):void { i.width = 45; i.height = 45; } protected function printIcon_clickHandler(event:MouseEvent):void { if(!printWidgetOpen){ printWid = PopUpManager.createPopUp(parent, PrintWidget,false) as PrintWidget; printWid.map = map; printWid.addEventListener(CloseEvent.CLOSE,printCloseHandler, false, 0, true); PopUpManager.centerPopUp(printWid); printWidgetOpen = true; } } protected function printCloseHandler(event:CloseEvent):void{ printWidgetOpen = false; } ]]> </fx:Script> <s:BorderContainer width="20" height="160" cornerRadius="10" backgroundAlpha="0.8" backgroundColor="#333333" borderAlpha="0.9" borderColor="#222222" borderStyle="solid" borderVisible="true" borderWeight="3"> <mx:VBox width="100%" height="100%" horizontalAlign="left" verticalAlign="middle"> <!--Print Button--> <s:HGroup width="25" height="30" gap="2" horizontalAlign="left" verticalAlign="middle"> <s:Line id="printLine" height="25" includeInLayout="{printWidgetOpen}" visible="{printWidgetOpen}"> <s:stroke> <s:SolidColorStroke caps="square" color="#ede00a" weight="2"/> </s:stroke> </s:Line> <mx:Image id="printIcon" resizeEffect="Resize" width="30" height="30" buttonMode="true" smoothBitmapContent="true" useHandCursor="true" source="@Embed('assets/images/i_print.png')" click="printIcon_clickHandler(event)" toolTip="Impression" rollOut="hgroup1_rollOutHandler(printIcon)" rollOver="hgroup1_rollOverHandler(printIcon)"/> </s:HGroup> </mx:VBox> </s:BorderContainer> </s:Group>
<widgets:ToolsController map="{mainMap}" left="30" bottom="60" />
this.addElement(printBox);
this.removeElement(printBox);
this.parent.addChild(printBox);
this.parent.removeChild(printBox);