SharedObject between 2 movies
Posted in actionscript 3, projects & snippets on January 28th, 2010 by admin – 1 CommentSo lets create 2 files:
setCookies.fla
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | var date:Date = new Date(); val_ti.text = ">> " +date.time; setCookie_btn.addEventListener(MouseEvent.CLICK, clickHandler); show_btn.addEventListener(MouseEvent.CLICK, showHandler); function clickHandler(info:MouseEvent):void { var local_data:SharedObject = SharedObject.getLocal("VSh", "/"); local_data.data.key = val_ti.text; status_txt.text = local_data.flush(); } function showHandler(info:MouseEvent):void { var local_data:SharedObject = SharedObject.getLocal("VSh", "/"); read_ti.text = local_data.data.key; } |
getCookies.fla
1 2 3 4 5 6 7 8 9 10 11 | var timer:Timer = new Timer(500, 0); timer.addEventListener(TimerEvent.TIMER, checkForCookieHandker); timer.start(); info_ta.text = "check for cookies every 0.5 sec ... "; function checkForCookieHandker(info:TimerEvent):void { var local_data:SharedObject = SharedObject.getLocal("VSh", "/"); local_data.flush(); info_ta.text = "[" + timer.currentCount + "] key: " + local_data.data.key + ", size: " + local_data.size + "\n" + info_ta.text; } |
Demo
Set cookie
Get cookie
see also:
where is .sol files in windows 7





