Hello
Im trying to make an swf send a phone-number to a specific asp-fil on the press of a button. But since I'm an as3 rookie I have no idea where this code is going wrong (PLEASE HELP):
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.error.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");
}
}