Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (38 sloc) 1.014 kB
/**
* ...
* @author alexander farkas
*/
import flash.external.ExternalInterface;
class Main
{
public static function main(swfRoot:MovieClip):Void
{
var storage:SharedObject = SharedObject.getLocal('domStorage');
ExternalInterface.addCallback('getItem', null, function(name) {
var val = storage.data[name];
return (typeof val == 'undefined') ? null : val || '';
});
ExternalInterface.addCallback('removeItem', null, function(name) {
delete storage.data[name];
});
ExternalInterface.addCallback('setItem', null, function(name, val) {
storage.data[name] = '' + val;
storage.flush();
});
ExternalInterface.addCallback('clear', null, function() {
storage.clear();
});
ExternalInterface.addCallback('key', null, function(i) {
var ctr = 0;
for (var k in storage.data) {
if (ctr == i) {
return k;
} else {
ctr++;
}
}
return null;
});
ExternalInterface.call('jQuery.webshims.localStorageSwfCallback', 'swf');
}
}
Jump to Line
Something went wrong with that request. Please try again.