1 Reply Latest reply on May 12, 2006 2:30 AM by blemmo

    Creating Dynamically Linked Buttons?

      Is it at all possible to dynamically create links on-the-fly using variables INSIDE the getURL command?

      Example -

      I am building a website in Flash 8 that POSTs information to a Mals-E shopping cart. I have already discovered that the post command will not work from flash...wierd but true. It winds up spitting a bunch of crap at the cart (though it is using ColdFusion...) and the cart cannot parse the information. I have tried MANY different ways but it just will not work. Ultimately what I am looking to do is format the getURL command as such:

      getURL(" http://ww9.aitsafe.com/cf/add.cfm?userid=MyIDHERE&product=[VARIABLEHERE and so on and so forth. I know that you cannot use ampersands (&'s) in Flash, but you ALSO cannot use %26 as CF will not parse it as an ampersand. I am at a loss for words.

      I anyone would like a demonstration of what is going wrong, please visit www.falcor-systems.com/Te/

      Go to the Flash portion of the site. Click on Chaircover Wholesale and then on Standard Banquet. At this point in time I am ONLY trying to get the CHAIRCOVERS ONLY portion to work. Once that part is solved it will be easygoing for the rest.

      So...fill out the form (Enter a number higher than 50, click Continue, Select a Fabric, click Continue, select a Color, click Continue, and then click 'Chair Covers ONLY.')

      You can see that the variables are in fact beeing stored properly. Everything is confirmed the way it should be. When you click on 'Add to Cart' this function is being executed:

      sbfinalizecco0.onRelease = function(){
      var userid:String;
      userid = "12341234"
      var product:String;
      product = (purchase_sb.quan)
      product += (purchase_sb.cccol)
      product += (purchase_sb.ccfab);
      product += "Chair Covers";
      var qty:Number;
      qty = (purchase_sb.quan);
      var units:Number;
      units = (purchase_sb.units);
      var price:String;
      price = (purchase_sb.price);
      getURL(" http://ww9.aitsafe.com/cf/add.cfm", "_blank", "POST");

      And the link that opens in the new browser window is as follows:

      http://ww9.aitsafe.com/cf/add.cfm?FPushButtonClass=%5Btype+Function%5D&purchase%5Fsb=cccol %3Dregal%2520red%26price%3D9%252E00%26ccfab%3Dsatin%2520silk%26units%3D3%26quan%3D150&vari ables%5Fcart=&fieldsFilled=%5Bobject+Object%5D&fabrictype=%5Bobject+Object%5D&silk%5Fcolor =%5Bobject+Object%5D

      Which is TOTALLY incorrect! It SHOULD read like this:

      http://ww9.aitsafe.com/cf/add.cfm?userid=[THEPASSEDVARIABLE and so on.

      Something I am doing wrong?? Any help would be GREATLY appreciated!

        • 1. Creating Dynamically Linked Buttons?
          blemmo Level 1

          the POST method works fine, but not from the Flash IDE, when you test the movie. From the getURL Help:


          Make sure you test your documents in a browser window, because otherwise your variables are sent using GET

          So when you use POST, you have to test the movie in a browser. When it's working right, there shouldn't be any variables in the URL string at all, because POST sends them in an extra header. I just mention that because you wrote


          Which is TOTALLY incorrect! It SHOULD read like this:
          http://ww9.aitsafe.com/cf/add.cfm?userid=[THEPASSEDVARIABLE and so on.

          This would be the case when you use GET, so make sure you use the right method.

          Another thing: getURL sends ALL defined variables that exist in the movie. If you just want to send some chosen ones, have a look at the LoadVars class. It lets you specify which vars to send, and you also have more control over the loading progress through some events.