1  /*
     2   * Copyright the original author or authors.
     3   * 
     4   * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   * 
     8   *      http://www.mozilla.org/MPL/MPL-1.1.html
     9   * 
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  import org.as2lib.env.log.logger.RootLogger;
    18  import org.as2lib.env.log.level.AbstractLogLevel;
    19  import org.as2lib.env.log.handler.FlashoutHandler;
    20  import org.as2lib.env.log.repository.LoggerHierarchy;
    21  import org.as2lib.env.log.LogManager;
    22  
    23  /**
    24   * {@code Mtasc} is intended for configuration of applications compiled with MTASC.
    25   * 
    26   * <p>It allows you to define all MTASC specific configurations similar to the
    27   * configuration in {@link main.Configuration}.
    28   * 
    29   * <p>The current code contains an example that matches usual cases. If you have
    30   * additional configuration you have to overwrite (not extend!) this class in your
    31   * directory. All that must stay to be compatible is the {@link #init} method.
    32   * 
    33   * @see main.Configuration
    34   * @author Martin Heidegger
    35   * @version 1.0
    36   */
    37  class main.Mtasc {
    38  	
    39  	/**
    40  	 * Initializes and starts the MTASC configuration.
    41  	 * 
    42  	 * @param container the root movie-clip that is passed by MTASC to the main method
    43  	 */
    44  	public static function init(container:MovieClip):Void {
    45  		// sets up logging
    46  		setUpLogging();
    47  	}
    48  	
    49  	/**
    50  	 * Sets up MTASC specific logging. This configures the As2lib Logging API to log
    51  	 * to Flashout.
    52  	 */
    53  	private static function setUpLogging(Void):Void {
    54  		// creates a new root logger
    55  		var root:RootLogger = new RootLogger(AbstractLogLevel.ALL);
    56  		// TODO: Create a Mtasc - only working logger ...
    57  		root.addHandler(new FlashoutHandler());
    58  		// sets the logger hierarchy as repository
    59  		LogManager.setLoggerRepository(new LoggerHierarchy(root)); 
    60  	}
    61  	
    62  }