1 Reply Latest reply on Feb 28, 2012 9:43 PM by kglad

    Why doesn't this write to the variable until the 2nd time the button is pressed?

    jay54321

      When the button is first pressed, I can see in my debugger the data LocalID has a value, but why doesn't it write to the _root.PrimaryID until I press the button a second time?

       

       

      //////////////

      submit1.onPress = function(){

       

         getDatax.UniqID=UID;//Long string version of ID

               getDatax.sendAndLoad("GetID.cfm", getDatax, "POST") ;

       

      getDatax = new LoadVars()

          getDatax.onLoad = function(){       

             if(this.writing=="Acquired") {

                   _root.PrimaryID=this.LocalID;

       

       

            }}

      }

       

      Thanks in advance

        • 1. Re: Why doesn't this write to the variable until the 2nd time the button is pressed?
          kglad Adobe Community Professional & MVP

          because getDatax isn't defined after the first sendAndLoad().

           

          use:

           

           

           

          var getDatax:LoadVars = new LoadVars();

              getDatax.onLoad = function(){       

                 if(this.writing=="Acquired") {

                       _root.PrimaryID=this.LocalID;

           

           

                }}

           

          submit1.onPress = function(){

             getDatax.UniqID=UID;//Long string version of ID

                   getDatax.sendAndLoad("GetID.cfm", getDatax, "POST") ;

          }

          1 person found this helpful