Methods

FlashCookie class

org.thesourcecode.utils.FlashCookie

 

Overview

Author

Lee Brimelow [www.gotoandlearn.com]
Hasan Otuome [hasan.otuome.com]

Version

1.1

Usage

import org.thesourcecode.utils.FlashCookie;
var cookie:FlashCookie =  new FlashCookie("user",this);

Description

Provides easy methods for using Local SharedObjects. Specify the new name for the SharedObject or the name of an existing SharedObject plus the name of the MovieClip from whenst the class is invoked. Optionally, specify a path to the SharedObject of "/" to make it accessible to other SWFs in the same domain.

Methods

 

bakeCookie

Usage

cookie.bakeCookie({name:"Lee Brimelow",pass:"password"});

Description

Adds each property of the supplied object to the data object of the SharedObject

Parameters

obj
(Object) Object containing the elements to save to the SharedObject's data object

Returns

Nothing.
 

getChip

Usage

cookie.getChip(chip);

Description

Returns the property from the SharedObject's data object that matches the supplied parameter

Parameters

chip
(String) name of the property to return

Returns

String
 

getChips

Usage

var chips:Object = cookie.getChips();
for(i in chips){
		trace(chips[i]);
	  }

Description

Returns all members of the SharedObject's data object

Returns

Object
 

getCookieName

Usage

cookie.getCookieName();

Description

Returns the name of the Local SharedObject

Returns

String
 

checkCookie

Usage

var flds:Array = ["TextField1","TextField2","TextField3"];//etc,etc
cookie.checkCookie(chip,flds);

Description

Checks for the existence of the property specified by the chip parameter. If it exists, the TextField instances identified in the fields Array are populated with the corresponding data.

Returns

Nothing.
 

addChips

Usage

var flds:Array = ["TextField1","TextField2","TextField3"];//etc,etc
cookie.addChips(flds);

Description

Uses an array of TextField instance names to add data to the SharedObject

Returns

Nothing.
 

eatCookie

Usage

cookie.eatCookie();

Description

Destroys the Local SharedObject

Returns

Nothing.