2011-08-12 33 views
0

我正在使用flex 4弹出式管理器弹出面板,但面板的孩子不在面板内。但是当我关闭弹出窗口时,孩子正在被删除。为什么我的弹出式面板的孩子出现在面板之外

像这样:(抱歉,我不能张贴图片)

  ---------- 
      l________l 
      l  l 
    ..... please enterl 
      l--------1 

有人知道为什么吗?这里是我的代码:

var forgotPopup:Panel = PopUpManager.createPopUp(this, forgottenForm, true) as Panel; 
     PopUpManager.centerPopUp(forgotPopup); 

这里就是我弹出:

<?xml version="1.0" encoding="utf-8"?> 
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details"> 


    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 

    <fx:Script> 
     <![CDATA[ 

      import mx.controls.Alert; 
      import mx.events.FlexEvent; 
      import mx.managers.PopUpManager; 

      // Handle the close button and Cancel button. 
      private function handleCloseEvent():void { 
       PopUpManager.removePopUp(this); 
      } 

     ]]> 
    </fx:Script> 

    <mx:Form horizontalCenter="0" verticalCenter="0"> 
     <mx:FormHeading label="Please enter your e-mail address and your login details will be e-mailed to you"/> 
     <mx:FormItem label="E-mail"> 
      <s:TextInput id="userInput" x="78" y="49"/> 
     </mx:FormItem> 
     <mx:FormItem direction="horizontal"> 
      <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" /> 
      <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/> 
     </mx:FormItem> 
    </mx:Form> 

</s:Panel> 

任何帮助就这将是辉煌的,谢谢。

+0

为什么你使用MX表单而不是Spark表单? –

回答

0

尝试使用以下内容:

<?xml version="1.0" encoding="utf-8"?> 
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details"> 


    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 

    <fx:Script> 
     <![CDATA[ 

      import mx.controls.Alert; 
      import mx.events.FlexEvent; 
      import mx.managers.PopUpManager; 

      // Handle the close button and Cancel button. 
      private function handleCloseEvent():void { 
       PopUpManager.removePopUp(this); 
      } 

     ]]> 
    </fx:Script> 

    <mx:Form left="10" right="10" top="10" bottom="10"> 
     <mx:FormHeading label="Please enter your e-mail address and your login details will be e-mailed to you"/> 
     <mx:FormItem label="E-mail"> 
      <s:TextInput id="userInput" x="78" y="49"/> 
     </mx:FormItem> 
     <mx:FormItem direction="horizontal"> 
      <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" /> 
      <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/> 
     </mx:FormItem> 
    </mx:Form> 

</s:Panel> 

如果你需要有头自动换你应该拒绝标准FormHeadingLabel替换为:

<?xml version="1.0" encoding="utf-8"?> 
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details"> 


    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 

    <fx:Script> 
     <![CDATA[ 

      import mx.controls.Alert; 
      import mx.events.FlexEvent; 
      import mx.managers.PopUpManager; 

      // Handle the close button and Cancel button. 
      private function handleCloseEvent():void { 
       PopUpManager.removePopUp(this); 
      } 

     ]]> 
    </fx:Script> 

    <mx:Form left="10" right="10" top="10" bottom="10"> 
     <s:Label width="100%" text="Please enter your e-mail address and your login details will be e-mailed to you" fontWeight="bold" /> 
     <mx:FormItem label="E-mail"> 
      <s:TextInput id="userInput" x="78" y="49"/> 
     </mx:FormItem> 
     <mx:FormItem direction="horizontal"> 
      <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" /> 
      <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/> 
     </mx:FormItem> 
    </mx:Form> 

</s:Panel> 

但是,最好的方法就是切换到自Flex 4.5以后可用的Spark Form

+0

是的,这几乎奏效,但现在只是标题出来的右边缘。基本上我需要头部不止一行,有没有办法做到这一点? 感谢您修复我的诡计图! – flesanf

+0

我已添加更多代码和详细信息。 – Constantiner

+0

谢谢,我也加了一个高度= 100%,以使标签显示所有的文字和工作。 我有闪光灯生成器4溢价,但我不知道如何升级SDK或我是否必须购买4.5! – flesanf

0

请避免X和Y位置 这可能也会导致对象位置。

+0

这不是问题,但你是正确的,我已经删除了这些,谢谢 – flesanf

相关问题