2015-05-27 29 views
-2

我在我的主頁上有兩個按鈕(main.mxml)。 當我點擊btn1它必須顯示btn1_main.mxml,並且類似地點擊btn2我想要btn2_main.mxml。 這兩個btn1_main.mxml和btn2_main.mxml都在./components如何在Adobe Flash中的按鈕單擊事件中打開mxml頁面?

我已經創建了鼠標點擊按鈕上的事件偵聽器。 想知道在執行事件處理程序時應該怎麼做才能打開新頁面。

在此先感謝

回答

0

有2種方法可以做到在ViewStack這個

  1. 廣場btn1_main.mxml和btn2_main.mxml並在按鈕點擊更改ViewStack的當前索引。

<mx:ViewSatck width="100%" height="100%" id="vs"> 
     <components:btn1_Main/> 
     <components:btn2_Main/> 
</mx:ViewStack> 

現在BTN1單擊處理 - > vs.selectedIndex = 0;並在btn2中點擊 hanlder - > vsselectedIndex = 1;

  • 放置2個main.mxml mxmls並設置visible和includeInLayout真每當repective按鈕被點擊
  • <components:btn1_Main id="m1" visible="false" includeInLayout="false"/> 
    <components:btn2_Main id="m2" visible="false" includeInLayout="false"/> 
    

    現在,在btn1單擊處理程序 - > m1.visible = true; m1.includeInLayout = true; m2.visible = false; m2.includeInLayout = false

    現在在btn1中單擊Handler - > m1.visible = false; m1.includeInLayout = false; m2.visible = true; m2.includeInLayout = true

    相關問題