0
夥計們我做錯了什麼?請幫助它不斷拋出錯誤。這裏是我的腳本:訪問未定義的屬性URLRequestMethod.POST
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
} //包
這件事爲我工作(我只是複製源和建),讓我知道如果它也適用於你。 – Ankit 2011-02-02 06:50:57