AS3 Flash Builder 错误参数数量不正确
AS3 Flash Builder Error Incorrect number of arguments
我制作音乐播放器并使用 FileFilter 过滤 mp3 和 .. 文件。
这是我的代码:
<![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("Open",[过滤器]);
1137: Incorrect number of arguments. Expected no more than 1.
谢谢
错误清楚地说明了问题所在。您始终可以打开与您的代码相关的文档并检查所需的参数:Adobe File class documentation
在您的情况下,您必须删除第二个参数:
file.browseForDirectory("Open"); // assuming that Open is a dirname
如果要使用FileFilter,则使用其他方法:
file.browseForOpen("Open",[filter]);
我制作音乐播放器并使用 FileFilter 过滤 mp3 和 .. 文件。
这是我的代码:
<![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("Open",[过滤器]);
1137: Incorrect number of arguments. Expected no more than 1.
谢谢
错误清楚地说明了问题所在。您始终可以打开与您的代码相关的文档并检查所需的参数:Adobe File class documentation
在您的情况下,您必须删除第二个参数:
file.browseForDirectory("Open"); // assuming that Open is a dirname
如果要使用FileFilter,则使用其他方法:
file.browseForOpen("Open",[filter]);