| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <mx:Application backgroundColor="0xFFFFFF" backgroundImage="" xmlns:mx="http://www.adobe.com/2006/mxml" width="800" height="600" |
| xmlns:comps="comps.*"> |
| <mx:Script> |
| <![CDATA[ |
| |
| import mx.managers.PopUpManager; |
| import mx.controls.Button; |
| import mx.containers.Panel; |
| import mx.managers.ISystemManager; |
| import comps.MyCanvasMXML; |
| import mx.core.IFlexDisplayObject; |
| import mx.core.UIComponent; |
| import mx.events.FlexMouseEvent; |
| import mx.managers.PopUpManagerChildList; |
| |
| public var iPopUp:IFlexDisplayObject; |
| |
| public var iPanel:Panel; |
| |
| |
| public function closeWindow(popUp:IFlexDisplayObject):void |
| { |
| PopUpManager.removePopUp(popUp); |
| } |
| |
| |
| public function openWindow4(modalSetting:Boolean):void |
| { |
| iPopUp = PopUpManager.createPopUp(ISystemManager(this.systemManager).getSandboxRoot(), comps.MyCanvasMXML, modalSetting, "popup"); |
| } |
| |
| public function openWindow3(modalSetting:Boolean):void |
| { |
| iPopUp = PopUpManager.createPopUp(this, comps.MyCanvasMXML, modalSetting, "popup"); |
| } |
| |
| public function centerMyPopUp():void |
| { |
| PopUpManager.centerPopUp(iPopUp); |
| } |
| |
| public function centerPanel(event:MouseEvent):void |
| { |
| PopUpManager.centerPopUp(iPanel); |
| } |
| |
| public function addWindow(modalSetting:Boolean):void |
| { |
| iPanel = new Panel(); |
| iPanel.title = "My Test PopUp: Modal Setting:" + String(modalSetting); |
| iPanel.width=220; |
| iPanel.height=150; |
| var btn2:Button = new Button(); |
| btn2.label="close"; |
| iPanel.addChild(btn2); |
| var btn3:Button = new Button(); |
| btn3.label = "center"; |
| btn3.addEventListener("click", centerPanel); |
| iPanel.addChild(btn3); |
| PopUpManager.addPopUp(iPanel, this , modalSetting, PopUpManagerChildList.POPUP); |
| } |
| |
| ]]> |
| </mx:Script> |
| |
| <mx:Style source="../../../../Assets/Fonts/myStyles.css" /> |
| |
| <mx:TextInput id="ta" /> |
| <mx:Panel id="myPanel" /> |
| <mx:CheckBox label="modal checkbox" id="modalCheckBox" /> |
| <mx:Button id="btn_openWindow4" click="openWindow4(modalCheckBox.selected)" /> |
| <mx:Button id="btn_centerMyPopUp" click="centerMyPopUp()" /> |
| <mx:Button id="btn_closeWindow" click="closeWindow(iPopUp)" /> |
| <mx:Button id="btn_addWindow" click="addWindow(modalCheckBox.selected)" /> |
| <mx:Button id="btn_openWindow3" click="openWindow3(modalCheckBox.selected)" /> |
| </mx:Application> |