jeg er igang med med shared object i en menu:
http://www.macromedia.com/support/flash/ts/documents/local_so.htmJeg loader en variabel string via ASP og vil ligge den ind i et object så jeg ikke skal hente data fra server næste gang swf bliver kaldt. Menuen loades via Flash MX named anchors og derved bliver Shares object loaded når movien går til andre lavels end den første hvor string loades.
Jeg har siddet med det et par dage, men er ikke så hård i actionscripting endnu. Kommer fra LINGO som er mit hovedsprog.
shared object koden ser sådan ud:
stop();
//create the local Shared Object
myLocalSO = sharedobject.getLocal("flashcookie" );
//Populate the text field if the SO already contains a name
if (myLocalSO.data.name != null) {
userName.text = myLocalSO.data.name;
numVisits.text = "You have been here " + myLocalSO.data.counter + " times."
}
//Populate the text fields if the SO does not contain a name
else {
userName.text = "<type your name here>";
numVisits.text = "This is your first visit.";
myLocalSO.data.counter = 1;
}
//update counter for number of visits
myLocalSO.data.counter++;
// Handler for userName.onChanged
userName.onChanged = function() {
myLocalSO.data.name = userName.text;
}
//Reset the data in the SO, and text fields
blueButton.onRelease = function () {
trace (myLocalSO.objectName);
myLocalSO.data.name = null;
myLocalSO.data.counter = 2;
userName.text = "<type your name here>";
numVisits.text = "This is your first visit.";
}