Quickie: Shared Object Fiddling

Quickie: Shared Object Fiddling

Personal Hit Counter Shared Object Example >>

Messing around with code in Flash MX / MX 2004 can produce some interesting results, some more useful than others, and in this case a quick and dirty personal hit counter for the number of times you have visited the site you implement the code on, along the lines of ‘You have been here xx times’ using the Shared Object.

Whilst displaying the result of the following code may seem a trite overboard, it does have uses and implementations; for example…

You could easily trigger functions to be called using a simple switch statement allowing you to conditionally display information based on the number of times a user has been to the site

You could change the navigation structure to suit the needs of the user based upon their click habits; the list goes on…so feel free to experiment


sObjVisits = SharedObject.getLocal("userVisitsLocal");
if (sObjVisits.data.visits == undefined) {
sObjVisits.data.visits = 1;
} else {
sObjVisits.data.visits = sObjVisits.data.visits+1;
}
howManyVisits = sObjVisits.data.visits;
sObjVisits.flush();
visits.text = "been here "+howManyVisits+" times";

Replay

Category: software Time: 2004-10-12 Views: 1
Tags:

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.157 (s). 12 q(s)