Access of undefined property URLRequestMethod.POST
Guys what have I been doing wrong? Kindly help it keeps throwing errors. Here's my script:
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= URLReque开发者_Python百科stMethod.POST;
}
private function cancelHandler(e:Event){
}
private function completeHandler(e:Event){
}
}// public class
}//package
Did you try also importing URLRequestMethod
import flash.net.URLRequestMethod;
精彩评论