Mira te paso el código que uso para guardar las posiciones de varias figuras en un juego de puzzle
que usa SharedObject
Código ActionScript :
/*GUARDAR DATOS */
function guardarDatos(
pol0x:String,pol0y:String,pol1x:String,pol1y:String,pol2x:String,pol2y:String,
pol3x:String,pol3y
/*****ROTACIONES*****/
Po_rot0:String,Po_rot1:String,Po_rot2:String,Po_rot3:String
) {
var disco_so:SharedObject;
disco_so = SharedObject.getLocal("datos");
disco_so.data.Pol0x = pol0x; disco_so.data.Pol0y = pol0y;
disco_so.data.Pol1x = pol1x; disco_so.data.Pol1y = pol1y;
disco_so.data.Pol2x = pol2x; disco_so.data.Pol2y = pol2y;
disco_so.data.Pol3x = pol3x; disco_so.data.Pol3y = pol3y;
/******ROTACIONES******/
disco_so.data.Po_Rot0 = Po_rot0;
disco_so.data.Po_Rot1 = Po_rot1;
disco_so.data.Po_Rot2 = Po_rot2;
disco_so.data.Po_Rot3 = Po_rot3;
disco_so.flush();
}
PARA CARGAR LOS DATOS
Código ActionScript :
function cargarDatos(dato) {
var disco_so:SharedObject;
disco_so = SharedObject.getLocal("datos");
if (dato == "pol0x") { return disco_so.data.Pol0x;}
else if (dato == "pol0y") { return disco_so.data.Pol0y;}
else if (dato == "pol1x") { return disco_so.data.Pol1x;}
else if (dato == "pol1y") { return disco_so.data.Pol1y;}
else if (dato == "pol2x") { return disco_so.data.Pol2x;}
else if (dato == "pol2y") { return disco_so.data.Pol2y;}
else if (dato == "pol3x") { return disco_so.data.Pol3x;}
else if (dato == "pol3y") { return disco_so.data.Pol3y;}
else if (dato == "Po_rot0") { return disco_so.data.Po_Rot0;}
else if (dato == "Po_rot1") { return disco_so.data.Po_Rot1;}
else if (dato == "Po_rot2") { return disco_so.data.Po_Rot2;}
else if (dato == "Po_rot3") { return disco_so.data.Po_Rot3;}
}
EN EL BOTON GUARDAR
[/as]
on (release) {
x_pog = polig0._x; y_pog = polig0._y;
x_pog1 = polig1._x; y_pog1= polig1._y;
x_pog2 = polig2._x; y_pog2= polig2._y;
x_pog3 = polig3._x; y_pog3= polig3._y;
/******ROTACIONES******/
Rot_pog0 =polig0._rotation;
Rot_pog1 =polig1._rotation;
Rot_pog2 =polig2._rotation;
Rot_pog3 =polig3._rotation;
}
guardarDatos(
x_pog,y_pog,
x_pog1, y_pog1,
x_pog2, y_pog2,
x_pog3, y_pog3,
/**ROTACIONES**/
Rot_pog0,Rot_pog1,
Rot_pog2,Rot_pog3,
}
}
[/as]
Y EN EL BOTON CARGAR
Código ActionScript :
on (release) {
polig0._x = cargarDatos("pol0x"); polig0._y = cargarDatos("pol0y");
polig1._x = cargarDatos("pol1x"); polig1._y = cargarDatos("pol1y");
polig2._x = cargarDatos("pol2x"); polig2._y = cargarDatos("pol2y");
polig3._x = cargarDatos("pol3x"); polig3._y = cargarDatos("pol3y");
/*******ROTACIONES*******/
polig0._rotation = cargarDatos("Po_rot0");
polig1._rotation = cargarDatos("Po_rot1");
polig2._rotation = cargarDatos("Po_rot2");
polig1._rotation = cargarDatos("Po_rot3");
}
Puedes guardar cuantas variables quieras solo tienes que declararlas en guardarDatos como string,