/** * com.sekati.events.LcBroadcaster * @version 1.0.0 * @author jason m horwitz | sekati.com | tendercreative.com * Copyright (C) 2007 jason m horwitz, Sekat LLC. All Rights Reserved. * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php */ import com.sekati.core.CoreObject; /** * Singleton LocalConnection Broadcaster * * {@code Usage: * var lb:LcBroadcaster = LcBroadcaster.getInstance (); * lc.subscribe (fooMc); * lb.broadcast ("onChangeAlpha", 50); * } */ class com.sekati.events.LcBroadcaster extends CoreObject { private static var _instance:LcBroadcaster; private var _tx:LocalConnection; private var _rx:LocalConnection; public var connectionName:String = "_com.sekati.events.LcBroadcaster"; public var methodName:String = "lcHandler"; /** * Singleton Private Constructor */ private function LcBroadcaster() { super( ); _tx = new LocalConnection(); _rx = new LocalConnection(); _rx.allowDomain = _rx.allowInsecureDomain = domain; _rx[methodName] = handler; _rx.connect( LCBinding.connectionName ); } /** * Singleton Accessor * @return LcBroadcaster */ public static function getInstance():LcBroadcaster { if (!_instance) _instance = new LcBroadcaster( ); return _instance; } /** * shorthand singleton accessor getter * @return LcBroadcaster */ public static function get $():LcBroadcaster { return LcBroadcaster.getInstance( ); } /** * Open LocalConnection to all domains. * @return Boolean */ public static function domain():Boolean { return true; } }