dos variables:
nombre="Antonio"
cargo="Administrador"
funciones para guardar los datos en la maquina del visitante y para recuperarlas de ella.
para guardar el contenido llamo a:
Código :
guardarDatos(nombre,cargo)
Código :
function guardarDatos(nombre:String, cargo:String) {
var tuVariable:SharedObject;
tuVariable = SharedObject.getLocal("NombreArchivo");
tuVariable.data.elNombre = nombre;
tuVariable.data.elCargo = cargo;
tuVariable.flush();
}
Para leer el contenido llamo a:
Código :
Variable1=cargarDatos("nombre")// si quiero recuperar la variable "nombre"
Variable2=cargarDatos("cargo") //si quiero recuperar la variable "cargo"Código :
function cargarDatos(dato) {
var tuVariable:SharedObject;
tuVariable = SharedObject.getLocal("NombreArchivo");
if (dato == "nombre") {
return tuVariable.data.elNombre;
} else if (dato == "cargo") {
return tuVariable.data.elCargo;
}
}Saludos