1

I have an application that will mirror the sales of individualities and the group that will then be presented in a panel. I currently have the code that writes the data locally on the machine, however, I need to write to the server and I can not! follows the code that I have currently attached if someone can help clarifying how to record on the server!

I've tried a few things, however, I'm lost as to how I applied the "Get remote" option, I got the data to be recorded locally, however, for the intended purpose it would have to be the option to write to the server and the application access to the object.

code:

var save2: SharedObject = SharedObject.getLocal ("data");
var b: int;
b = (save2.data.b);
trace ("trace memory value b", save2.data.b);

init2 (); // this line goes directly beneath the variables
function init2 (): void {// call once to set everything up


if (save2.data.b == null) {// checks if there is save data
          trace ("No saved data yet."); // if there is any date on the computer ...
          save2.data.b = 0; // ... set the savedScore to 0
     } else {
          trace ("Save data found."); // if we did find data ...
          loadData2 (); // ... load the data
     }

    updateScoreText2 (); // finally, update the text field
}




function loadData2 (): void {
     b = save2.data.b; // set the current score to the saved score
     trace ("Data Loaded! is:", b);

}
function updateScoreText2 (): void
{
     textincre11.text = b.toString () ;; // set the text property of the txtScore
     trace ("Score text updated");
}


bt_incre.addEventListener (MouseEvent.CLICK, add2);
clean.addEventListener (MouseEvent.MOUSE_UP, clean4);

function somar2 (event: MouseEvent): void
{

trace ("in memory b =", b);
b ++;
trace ("Pos pos b =", b); // a = 11

textincre11.text = b.toString ();
//textincre_3.text = b.toString ();
save2.data.b = textincre11.text;
//guardar2.data.b = textincre_3.text;
save2.flush ();
trace ("trace pos somar2", save2.data.b);


}
function clean4 (e: MouseEvent): void {
b = 0;
textincre11.text = b.toString ();
//textincre_3.text = b.toString ();
save2.data.b = textincre11.text;
g // uardar2.data.b = textincre_3.text;
save2.flush ();
trace ("trace a apos equal to zero", save2.data.b);
}


bt_decrem.addEventListener (MouseEvent.CLICK, Decrease2);

function diminuir2 (event: MouseEvent): void
{

trace ("Trace in memory b =", b);
//B--;
if (b> = 1)
  B--;
  trace ("Decrement pos b =", b);
 }
else {
  return;
 }
trace ("Decrement pos b =", b);


textincre11.text = b.toString ();
//textincre_3.text = b.toString ();
save2.data.b = textincre11.text;
//guardar2.data.b = textincre_3.text;
save2.flush ();
trace ("trace pos decrease2", save2.data.b);
}
gandazeus
  • 11
  • 2
  • I add more information to clarify: The indicated code saves in the machine (get Local), it works perfectly. However, there is a need for a general panel because I can not access the object on each of the machines! I need to write to the server and whenever I access on any machine first I have to go see if the object on the server has data if yes load, if you do not start the variable to zero, as already happens in this code I shared but the process is performed locally. – gandazeus May 30 '19 at 08:59

0 Answers0