A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Sending variables to PHP

  1. #1
    Member
    Join Date
    Feb 2005
    Posts
    33

    Sending variables to PHP

    so making a high score board i can use in my games. the tutorial i found (every tutorial i found, in fact) was AS2, so i've taking the principles in the tutorial and converting them to AS3. I'm pretty darn close to having it work. i have it successfully pulling the data in the php/database to the flash file and listing the contents of the high score board, but i seem to be missing something when sending new name and score info to it.

    here is my test file:

    http://actionfigurekingdom.com/high-score-test.html

    you can see the high score list comes up (the info coming in is from when i went through the AS2 tutorial), but as you can see it's not adding the name and score you enter in the first part to the list.

    here is code i'm using to send the info:

    Code:
    var sendScoreVars:URLVariables = new URLVariables();
        sendScoreVars.userName = userName;
        sendScoreVars.myScore = userScore;
    
        var kingdomUrlRequest:URLRequest = new URLRequest();
        kingdomUrlRequest.method = "POST";
        kingdomUrlRequest.url = "http://actionfigurekingdom.com/addScore.php";
    
        var loaderForScores:URLLoader = new URLLoader();
        loaderForScores.data = sendScoreVars;
        trace(loaderForScores.data);
        loaderForScores.addEventListener(Event.COMPLETE, onLoaderForScoresComplete);
    
        loaderForScores.load(kingdomUrlRequest);
    so what am i missing? any help would be greatly appreciated. also if anyone wants to look at the fla source file i can upload that too.

    thanks.

  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    Try kingdomUrlRequest.method = URLRequestMethod.POST;

    That's what I do instead of "POST", don't know if it makes a difference though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center