A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: sending POST data to an ASP file

  1. #1
    Senior Member zeroreality's Avatar
    Join Date
    Jun 2000
    Posts
    130

    sending POST data to an ASP file

    i saw the code somewhere to do it, it was something LIKE this
    im looking for clarification
    Code:
    new loadVars()
    loadVars[0] = somevar
    loadVars[1] = somevar
    loadVars[2] = somevar
    loadvars.send()
    little help?

    or am i WAY off?

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Location
    Pittsburgh
    Posts
    252
    hi,

    you'll need to start by creating an instance of the loadVars object:
    sendLV = new LoadVars();

    and assign properties to that object to pass to your asp page:
    sendLV.myName = some var;
    sendLV.myPhone = some other var;

    i would recommend using sendAndLoad so you can get some sort of response from the server after you have sent your info.
    response = new LoadVars();

    set the callback function after you recieve your response:
    response.onLoad = getResponse; //func to call onLoad below

    send it:
    sendLV.sendAndLoad("yourPage.asp", response, "POST");

    callback function:
    function getResponse() {
    _root.myTextFieldInstanceName = response.flashVarPassedBack;
    }


    you can find more info under the LoadVars object in help.

    Hope this helps some,
    Dunc

  3. #3
    Senior Member zeroreality's Avatar
    Join Date
    Jun 2000
    Posts
    130
    thanx a bunch
    i got it working with a different method tho

    turns out that Flash 5 and FlashMX have very different ways of handling POST data

    i used this
    Code:
    onClipEvent (load) {
    	queryString = "SELECT ";
    	queryString += "Sales_Code, ";
    	queryString += "Name, ";
    	queryString += "Extension ";
    	queryString += "FROM corp_reps ";
    	queryString += "WHERE Name != '' ";
    	queryString += "AND Extension != 0 ";
    	queryString += "ORDER BY Sales_Code ";
    	loadStatus = false;
    	loadVariables (_root.moviePath+"getdata.asp", this, "POST");
    }
    onClipEvent (data) {
    	if (loadStatus == "true") {
    		_root.make2DArray("corpArray", returnString);
    	}
    	else if (loadStatus == "error") {
    		trace("ono, broken")
    	}
    }

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