2017-01-03 38 views
-1

我製作音樂播放器並使用FileFilter來過濾mp3和..文件。
這是我的代碼:AS3 Flash Builder錯誤參數數量不正確

<![CDATA[ 
      import flash.events.IOErrorEvent; 
      import flash.events.ProgressEvent; 
      import flash.media.Sound; 
      import flash.media.SoundChannel; 
      import flash.media.SoundTransform; 
      import flash.net.URLRequest; 

      private var sound:Sound; 
      private var songLength:String; 
      private var soundChannel:SoundChannel; 
      [Bindable] 
      private var readyToPlay:Boolean = false; 
      [Bindable] 
      private var playing:Boolean = false; 
      private var file:File; 
      private var filter:FileFilter = new FileFilter("Music", "*.mp3;*.ogg"); 

      protected function browse_clickHandler(event:MouseEvent):void { 
       file = new File(); 
       file.addEventListener(Event.SELECT, onFileSelect); 
       file.browseForDirectory("Open",[filter]); 
      } 

在此行中的錯誤:

file.browseForDirectory( 「打開」,[過濾]);

1137:參數的數量不正確。預計不超過1

謝謝

回答

1

錯誤說清楚什麼是錯的。你總是可以打開相關的代碼中的文檔和檢查必需的參數:Adobe File class documentation

在你的情況,你必須刪除第二個參數:

file.browseForDirectory("Open"); // assuming that Open is a dirname 

如果你想使用的FileFilter,然後用另一種方法:

file.browseForOpen("Open",[filter]); 
相關問題