Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Swishmax & Cookies, Basics
cybernetix
post Dec 3 2005, 12:36 PM
Post #1


ReloadeD
Group Icon
Group: Honored
Posts: 562
Joined: 20-May 04
From: Belgrade, Serbia
Member No.: 17





/*
SwishMax and cookies, basics by cybernetix.
*/


onload() {

mySharedObj = SharedObject.getLocal("swishMaxCookie");
// this will read existing local shared object. if object does not
// exist, new one will be created.

// mySharedObj - variable, rename it to whatever you want.

// "swishMaxCookie" - unique name of file that will be stored localy
// on visitor's computer. it would be good to use name of your site
// and suffix "cookie" for example: "mySiteCookie".

// IMPORTANT: do not use any of special chars!!!

}


onFrame(1) {


createTextField("infoText", 1, 0, 0, 300, 300);
// create text filed to display info

// now you can examine or create content of cookie.

// var someData = mySharedObj.data.someData;
// this will find value of data named someData in sharedobject,
// rename someData to whatever you want. see below.


var visitCounter = mySharedObj.data.visitCounter;
// find number of visits

var visitDate = mySharedObj.data.visitDate;
// find date of last visit

infoText.text = "Old datas" + "\n" + "Counter: " + visitCounter + " / Date: " + visitDate + "\n";
// display actual values

// now you can change datas in object to some new values

if (mySharedObj.data.visitCounter) {
mySharedObj.data.visitCounter += 1;
} else {
mySharedObj.data.visitCounter = 1;
}

// increase number of visits for one, if shared object is just
// created set visitCounter to 1;

dateObj = new Date();
mySharedObj.data.visitDate = dateObj.toString();

// change date to actual date

mySharedObj.flush();
// this will save new values to local sharedobject.

}


onFrame(2) {


mySharedObj = SharedObject.getLocal("swishMaxCookie");
// read object again

infoText.text += "\n" + "New datas" + "\n" + "Counter: " + mySharedObj.data.visitCounter + " / Date: " + mySharedObj.data.visitDate + "\n";
// display new values

}



/*
NOTE:
if amount of stored data in cookie is more than 100kb flash player will
ask visitor to allow it, otherwise it will work transparently.

Also, remember that sharedobjet is not really cookie but it can be
used for that purposes as well. So, if visitor's browser is set to
block cookies it will not affect to your cookie.


TO ACHIEVE THIS FEATURE YOU MUST EXPORT YOUR APP TO SWF6 OR LATER!!!


---------------------------------------------------------------------

To see this tutorial in action create new swi file, set movie size
at least 300x300pix and copy/paste this script into Script panel, set
export file to SWF6 or later and test it in external browser. You can
try to click refresh button in browser to see how datas change.
*/


/*
SWI FILE AVAILABLE IN DOWNLOAD SECTION.
*/
 
+Quote Post  Go to the top of the page
Eddie_K
post Dec 3 2005, 02:46 PM
Post #2


Hush now, I'm thinking...
Group Icon
Group: *Premier*
Posts: 3,977
Joined: 25-May 04
From: Heaven
Member No.: 47





Thanks for this cybernetix thumbsup.gif

This post has been edited by Eddie_K: Dec 3 2005, 03:09 PM
 
+Quote Post  Go to the top of the page
the_iceman
post Dec 3 2005, 05:07 PM
Post #3


Good Ol' Dot
Group Icon
Group: *Premier*
Posts: 219
Joined: 27-October 05
From: Seattle, WA
Member No.: 7,814





Great Information and presentation for the use of Shared Objects! Thanks cyber!
 
+Quote Post  Go to the top of the page
*D*
post Dec 3 2005, 06:19 PM
Post #4


Merry KissMoose
Group Icon
Group: Main Team
Posts: 15,990
Joined: 18-May 04
From: North Pole
Member No.: 2





biggrin.gif This is pretty kewl even though I had to ask why it wasn't working for me blush.gif if it doesn't work make sure you don't have Mask off-stage objects checked.

I really need to open SMax more lol clean the cob webs off

Thanks Nemo Tip-Hat.gif
 
+Quote Post  Go to the top of the page
Faakher
post Dec 28 2005, 03:36 AM
Post #5


Regular Dot
Group Icon
Group: Member
Posts: 57
Joined: 28-December 05
Member No.: 8,750





Nice Sharing Brother

Thanks

Faakher
 
+Quote Post  Go to the top of the page
chriskanye
post Feb 12 2006, 10:10 PM
Post #6


Getting Used To The Dots
Group Icon
Group: Member
Posts: 31
Joined: 12-February 06
Member No.: 9,709





Nice and this can be done in SwishMax! Koool!
 
+Quote Post  Go to the top of the page
osta90
post May 3 2006, 07:56 PM
Post #7


New Member
Group Icon
Group: Member
Posts: 23
Joined: 28-November 04
Member No.: 1,224





Thanks..
 
+Quote Post  Go to the top of the page
sanjushekar
post May 6 2007, 10:33 PM
Post #8


New Member
Group Icon
Group: Member
Posts: 1
Joined: 18-July 06
Member No.: 12,017





nice thanks!!
 
+Quote Post  Go to the top of the page
ghostx
post Jun 7 2007, 04:26 PM
Post #9


New Member
Group Icon
Group: Member
Posts: 3
Joined: 7-June 07
Member No.: 16,415





Great Information and presentation for the use of Shared Objects!
 
+Quote Post  Go to the top of the page
mariaan
post Mar 7 2008, 03:35 PM
Post #10


New Member
Group Icon
Group: Member
Posts: 17
Joined: 29-June 05
Member No.: 5,087





Interesting information
Mariaan
 
+Quote Post  Go to the top of the page

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 29th July 2010 - 11:09 PM
Anime | Broadband | Package Holidays | Package Holidays | Home Insurance