vicky99
vicky99

Reputation: 49

I want to POST variables from actionscript 3.0 to PHP

I am trying to send some variables from my actionscript 3.0 to PHP file.. but if i am using POST method I am getting an error instead if I use GET method it is working fine but then there comes the security issue. All my variables are displayed in URL which I dont want to happen. This is my code:

gbtn.addEventListener(MouseEvent.CLICK,btng);

function btng(event:MouseEvent):void{
    var myVariables:URLVariables = new URLVariables();

     myVariables.white = "white";

     var myURLRequest:URLRequest = new URLRequest("scene4.php");

     myURLRequest.data = myVariables;

     navigateToURL(myURLRequest, '_self');

     gotoAndPlay(1,"Scene 4");
}

Please help. thanx...:)

Upvotes: 1

Views: 1403

Answers (1)

Eric
Eric

Reputation: 10626

var scriptRequest:URLRequest = new URLRequest("scene4.php");
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables(); 
scriptVars.white = "white"; 
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars; 
scriptLoader.load(scriptRequest);

Upvotes: 1

Related Questions