如何用php沟通actionscript3.0?

i am trying to send the data from actionscript to php file.but am not able to communicate with php file.am getting error like this "Undefined index: username in C:\xampp\htdocs\As\basics.php on line 2". my code is below. /*********actionscript******************/

 var str:String = "hi";
 var myscore = 0;
 submit.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_7);

 function fl_ClickToGoToAndStopAtFrame_7(event: MouseEvent): void {
 var myrequest:URLRequest = new URLRequest("http://localhost/As/basics.php");
 myrequest.method = URLRequestMethod.POST;
 var variables:URLVariables = new URLVariables();
 variables.username = str;
 variables.score = myscore;
 myrequest.data = variables;
 var loader:URLLoader = new URLLoader();
 loader.dataFormat = URLLoaderDataFormat.VARIABLES;
 loader.addEventListener(Event.COMPLETE, dataOnLoad);
 loader.load(myrequest);
}
 function dataOnLoad(evt:Event)
 {
   submit.alpha=100;
     //status is a custom flag passed from back-end
  }

/*********php code**********************/

   <?php
     $name = $_POST['username'];
    echo "Result:<input type='text' value='$name'>";
    echo "<param name='movie' value='cmphp.swf' />";
     echo "<object type='application/x-shockwave-flash' data='cmphp.swf'width='1024'  height='500'>";
    echo "<param name='movie' value='FlashVars_AS2.swf' />";

 ?>