伙计我做错了什么?请帮助它不断抛出错误。这是我的剧本:
package{
import flash.display.MovieClip;
import flash.net.FileFilter;
import flash.events.MouseEvent;
import flash.net.FileReference;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.URLVariables;
public class Main extends MovieClip{
private var filefilter:FileFilter= new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
private var filename:String="";
private var randomname:String;
private var fileType:Array=new Array(filefilter);
private var fileref:FileReference;
public function Main(){
uploadbtn.addEventListener(MouseEvent.MOUSE_UP, upload)
}//public function
private function upload(e:MouseEvent){
randomname=String(Math.ceil(Math.random()*10000))
trace(randomname)
fileref=new FileReference()
fileref.addEventListener(Event.SELECT,selectHandler);
fileref.addEventListener(Event.CANCEL,cancelHandler);
fileref.addEventListener(Event.COMPLETE,completeHandler);
fileref.browse(fileType);
}//upload
private function selectHandler(e:Event){
var urlrequest:URLRequest = new URLRequest("http://localhost/upload.php")
var urlvariable:URLVariables=new URLVariables()
urlvariable.randomname = randomname;
urlrequest.data = urlvariable;
urlrequest.method= URLRequestMethod.POST;
}
private function cancelHandler(e:Event){
}
private function completeHandler(e:Event){
}
}// public class
} //包
答案 0 :(得分:2)
您是否尝试导入URLRequestMethod
import flash.net.URLRequestMethod;