A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Translating HTML into Actionscript

  1. #1
    Member
    Join Date
    Dec 2002
    Posts
    45

    Translating HTML into Actionscript

    I am making an order form in my Flash website. There is an important piece of HTML that I need to translate into Flash terms in order for the form to be compatible with my hosts form-mail script. Here's the line:

    input type="hidden" name="_vDeckformid" value="39"

    Does anyone know how to write this as Actionscript?
    Thanks!

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    At some point, the Flash movie is going to post to a CGI script using either getURL or the loadVars object.

    If you use getURL(), you can add that parameter to the URL, e.g:

    getURL("http://mydomain.com/myscript?_vDeckformid=39");

    If you use loadVars.sendAndLoad() you can make sure that variable is included. Here's a slightly modified example I copied from Colin Moock's Actionscript: The Definitive Guide

    code:

    varSender = new LoadVars();
    // ...and one to receive.
    varReceiver = new LoadVars();

    // Assign properties to the sender, which will be the variables sent to the server.
    varSender.name = "Bruce";
    varSender.age = "13";
    varSender._vDeckformid = 39; // <-- SEE???

    // Assign a callback function to the varReceiver's onLoad property.
    // The handler will process the variables when they arrive.
    varReceiver.onLoad = function () {
    // We can access the loaded variables as properties of this, as in this.age.
    // We use a for-in loop to list the properties of the varReceiver object.
    // Note that the loaded and contentType properties are not enumerated.
    for (p in this) {
    // We don't want to list the onLoad property, so check if the
    // current property is a string. If it is...
    if (typeof this[p] = = "string") {
    // ...show its value in the Output window. All loaded
    // variables are received as strings.
    trace("The variable " + p + " has the value " + this[p]);
    }
    }
    }

    // Before sending our variables, we'll display them
    // in the Output window. (Good for debugging)
    trace("Sending " + varSender.toString());

    // Now send the variables to the server, and wait for a reply
    varSender.sendAndLoad("http://www.yourserver.com/cgi-bin/lookup.pl",
    varReceiver, "GET");



    - Jim

  3. #3
    Member
    Join Date
    Dec 2002
    Posts
    45
    Thanks so much!!

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