我試圖讓一個swf發送一個電話號碼到一個特定的asp-fil按下按鈕。 但因爲我是一個菜鳥AS3我不知道在哪裏這個代碼是怎麼了?(請幫助):用as3發送變量到asp的正確方法是什麼?
import flash.events.IOErrorEvent;
import flash.display.*;
import flash.events.MouseEvent;
import flash.net.*;
import flash.events.Event;
public class action extends MovieClip
{
private var swf_front_mc:swf_front = new swf_front ;
var request:URLRequest = new URLRequest("succes.html");
var request2:URLRequest = new URLRequest("http://www.example.com");
public var mobilNr:Number = new Number(swf_front_mc.mobilInput.text);
public var varsToSend:URLVariables = new URLVariables();
public function action()
{
addChild(swf_front_mc);
swf_front_mc.name = "swf_front_mc";
swf_front_mc.x = 0;
swf_front_mc.y = 0;
makeInteraction();
}
private function makeInteraction():void
{
swf_front_mc.submit_mc.addEventListener(MouseEvent.CLICK, submitForm);
}
function submitForm(e:MouseEvent):void
{
//trace("hello");
varsToSend.RecipientMobileNumber = mobilNr;
// Create URL Request, set to POST, and attach data
var formRequest:URLRequest = new URLRequest("webform_input.asp");
formRequest.method = URLRequestMethod.GET;
formRequest.data = varsToSend;
// Create URL Loader, attach listeners, and load URL Request
var varLoader:URLLoader = new URLLoader ;
varLoader.addEventListener(Event.COMPLETE, onLoaded);
varLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
varLoader.load(formRequest);
}
function onLoaded(e:Event):void
{
navigateToURL(request,"blank");
}
function ioErrorHandler(e:IOErrorEvent):void
{
navigateToURL(request2,"blank");
}
}
好了,這樣你就不會尋找類似FlourineFx或的WebORB。感謝您的反饋。 – Gunslinger47 2010-08-17 08:35:15