我有一个应用程序,可以反映个性化产品的销售情况,然后将其显示在面板中。我目前有在计算机上本地写入数据的代码,但是,我需要写入服务器,但是我不能!如果有人可以帮助澄清如何在服务器上进行记录,请遵循我当前附加的代码!
我已经尝试了几件事,但是我对如何应用“获取远程”选项却迷失了,我将数据记录在本地,但是,出于预期目的,它必须是写入服务器和应用程序访问对象的选项。
代码:
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);
}