2013-02-16 42 views
2

我在Flash Builder中編寫我的第一個應用程序,但我對Flash有很多經驗。我試圖在Flash Builder中使用按鈕類,但是我的錯誤顯示「無法找到導入按鈕」。我試圖導入flash.display,flash.ui來查看它Button被隱藏在其他地方。關鍵是通過xml動態加載按鈕及其標籤。任何幫助表示讚賞。謝謝!FlashBuilder 4.6 mx.controls.Button丟失?

<fx:Script> 
    <![CDATA[ 
     import flash.events.*; 
     import mx.controls.Button; 

     private function doAdd(e:Event):void { 

      var buttonList:XMLList = new XMLList([email protected]); 
      for(var i=0; i<buttonList.length(); i++){ 
       var btn:Button = new Button(); 
       btn.label = buttonList[i]; 
       buttonBox.addElement(btn); 
      } 
     } 
    ]]>  
</fx:Script> 

<s:VGroup left="30" right="30" top="50" bottom="30" id="buttonBox"> 
</s:VGroup> 

回答

1

即時猜測你正在創建一個移動應用程序?由於mx組件在移動應用程序中不可用(默認情況下)。

您可以使用spark button - spark.components.Button - 或手動包括通過導入mx.swc庫MX組件(的Flex SDK中找到)

+0

非常感謝你李!火花按鈕工作完美! – user1876246 2013-02-17 00:31:26

+0

沒問題。請標記爲回答:) – 2013-02-17 01:30:27

1

的mx.swc添加到您的項目,那會的。

在Flash Builder 6.0,請執行下列操作:

  • 該項目在Package Explorer透視右鍵單擊
  • 屬性...
  • Flex構建路徑(在左側導航窗格)
  • 單擊添加SWC ...
  • 找到你的盒子上的mx.swc。在OSX在此寫就的時間爲:

    /應用/使用Adobe Flash Builder的4.6 /的SDK/4.6.0 /框架/庫/ MX/mx.swc

  • 單擊確定

  • 重建您的項目

+0

謝謝 - 舊的答案,但它幫助我。 – 2015-09-24 20:05:27

相關問題