2011-08-12 39 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

相關問題