/* * Copyright(c) 2008 the Spark project. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package{ import flash.display.*; import flash.events.*; import flash.net.*; import flash.system.LoaderContext; import flash.text.*; import flash.system.ApplicationDomain; import flash.system.System; import flash.system.Security; import jp.cohesion.core.Kernel; import jp.cohesion.common.Logger; import jp.cohesion.test.DummySocket; /* == [Project Cohesion] =================================================== */ [Frame(factoryClass="Preloader")] /** * Cohesion ブートストラップメインムービ * * @author $Author$ * @revision $Rev$ * @date $Date$ */ public class Main extends Sprite { // コンストラクタ /////////////////////////////////////////////////////////////////// // Constructors // ///////////////////////////////////////////////////////////////////////////////////// /** * デフォルトの設定を用いてオブジェクトを構築するコンストラクタ */ public function Main(){ super(); Logger.DebugMode = CHConfig.DEBUG_MODE; Logger.TraceMode = true; Security.loadPolicyFile("xmlsocket://" + CHConfig.HOST + ":" + CHConfig.PORT); _server = new XMLSocket(); //_server = new DummySocket(); _singleton = this; _sharedObject = SharedObject.getLocal(CHConfig.SHARED_OBJECT_NAME); this.addEventListener(Event.ADDED, onAdded); } /** * Cohesion Kernelを起動します。 * * @param evt */ private function onAdded(evt:Event):void { this.removeEventListener(Event.ADDED, onAdded); _kernel = new Kernel(); addChild(_kernel); } // 内部フィールド定義 /////////////////////////////////////////////////////////////// // Fields // ///////////////////////////////////////////////////////////////////////////////////// /** */ public static const MESSAGE_DIGEST:String = "md5"; /** */ public static const CIPHER:String = "blowfish-cbc"; // プロパティ /////////////////////////////////////////////////////////////////////// // Properties // ///////////////////////////////////////////////////////////////////////////////////// /** */ private static var _singleton:Main; /** * プリローダ使用の際、rootプロパティがnullになってしまう問題に対応。
* via http://d.hatena.ne.jp/flashrod/20070317
* * @return このムービークリップ自身 */ public static function get instance():Main { return _singleton; } /** Cohesionカーネル */ private static var _kernel:Kernel; /** * Cohesionカーネル * @return Cohesionカーネル */ public static function get kernel():Kernel { return _kernel; } /** XMLSocket接続 */ private static var _server:XMLSocket; /** * Cohesion ServerへのXMLSocket接続 * @return XMLSocket接続 */ public static function get server():XMLSocket { return _server; } /** SharedObject */ private static var _sharedObject:SharedObject; /** * ローカル保持データ * @return ローカル保持データ */ public static function get localdata():Object { return _sharedObject.data; } } }