2012-01-23 61 views
0

我創建了一個Popup,它是自定義組件擴展Canvas我希望畫布的外觀與圖像中顯示的類似。是否有任何想法,如何創建類似的彈出窗口。 enter image description here在FLEX 3.0中創建Popup

我在這裏給你,我已經做了到現在爲止的示例代碼...

<?xml version="1.0" encoding="utf-8"?> 
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="550" height="350" backgroundAlpha="0"> 
<mx:Script> 
    <![CDATA[ 
     import mx.managers.PopUpManager; 

     public function btnImage_click():void 
     { 
      PopUpManager.removePopUp(this); 
     } 

    ]]> 
</mx:Script> 
<mx:Image source="Images/close.png" top="4" left="500" useHandCursor="true" buttonMode="true" click="{btnImage_click();}" /> 
<mx:Fade id="fadeIn" duration="700" alphaFrom="0.0" alphaTo="1.0"/> 
<mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle"> 
    <mx:Canvas height="85%" width="90%" backgroundColor="#ffffff" backgroundAlpha="1" > 
     <mx:VBox height="100%" width="100%"> 
      <mx:HBox height="70%" width="100%" horizontalAlign="center" verticalAlign="middle"> 
       <mx:Image id="btnPrevious" source="Images/previous.png" 
        click="{vsSubImages.selectedIndex--}" enabled="{vsSubImages.selectedIndex!=0}"/> 
       <mx:ViewStack height="100%" width="90%" creationPolicy="all" id="vsSubImages"> 
        <mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle" showEffect="{fadeIn}"> 
         <mx:Image id="img1" maintainAspectRatio="true" height="100%" width="100%" horizontalAlign="center" verticalAlign="middle" />  
        </mx:VBox>     
        <mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle" showEffect="{fadeIn}"> 
         <mx:Image id="img2" maintainAspectRatio="true" height="100%" width="100%" horizontalAlign="center" verticalAlign="middle" />  
        </mx:VBox>     
        <mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle" showEffect="{fadeIn}"> 
         <mx:Image id="img3" maintainAspectRatio="true" height="100%" width="100%" horizontalAlign="center" verticalAlign="middle" />  
        </mx:VBox>     
       </mx:ViewStack> 
       <mx:Image id="btnNext" source="Images/next.png" 
        click="{vsSubImages.selectedIndex++}" enabled="{vsSubImages.selectedIndex!=2}" /> 
      </mx:HBox> 
      <mx:Box height="30%" width="100%" horizontalAlign="right" verticalAlign="top"> 
       <mx:Form height="100%" width="100%"> 
        <mx:FormItem label="Project Name : " > 
         <mx:Label id="lblName" /> 
        </mx:FormItem> 
        <mx:FormItem label="Description : " > 
         <mx:Label id="lblDescription" /> 
        </mx:FormItem> 
        <mx:FormItem label="Technology Name : " > 
         <mx:Label id="lblTechnology" /> 
        </mx:FormItem> 
       </mx:Form> 
      </mx:Box> 
     </mx:VBox> 
    </mx:Canvas> 
</mx:VBox> 
</mx:Canvas> 

的主要思想是,以顯示在畫布上的關閉按鈕目前我得到的是背後的畫布。 請幫幫我。

回答

1

<mx:Image source="Images/close.png" top="4" left="500" useHandCursor="true" buttonMode="true" click="{btnImage_click();}" />標記放在代碼最底部的最後一個</mx:Canvas>標記之前。因爲畫布的行爲與la​​st相似,所以它位於z-index的最頂端。

+0

謝謝..很好的回答... –