/******************************************
 * @author Maria A. Zamora
 * @company Digitec Interactive Inc.
 * @version 0.1
 * @date 12/14/2010
 * 
 * This is the HomeCEE class for the CEE application
 * CS5 version of com.digitec.cee.HomeCEE
 *  
*******************************************/
package com.digitec.cee
{
	import flash.display.MovieClip;	
	import flash.events.*;				
	import flash.text.*;
	import flash.display.Stage; 
	import flash.display.StageAlign; 
	import flash.display.StageScaleMode; 
	public class HomeCEE extends BaseCEE	 
	{																				
		 private var myFont:Font = new Font3();
			private var versionField:TextField;	
		 public function HomeCEE()		
		 {			
		 	
			super(MainConstants.XMLHOME);
			setup();			
		}			
		
		/*******************************************************************
		 * FUNCTION: SETUP FRAME TEXT_FIELDS  FROM XML
		 *******************************************************************/
		override public function setFramesText(_xml:XML ):void
		{
			//SET HOME - FRAME 1
			this.frm1_intro_tf.text = _xml.xcaption; //maybe without the this.		
			var myFormat:TextFormat = new TextFormat();
			myFormat.font = myFont.fontName;
			myFormat.size = 14;
			myFormat.color = 0x8DC269;
			myFormat.bold = true;
			versionField = new TextField();
			
			versionField.defaultTextFormat = myFormat;
			versionField.height = 20;
			versionField.width = 50;
			versionField.background = false;
			versionField.border = false;
			versionField.multiline = true;
			versionField.wordWrap = true;
			versionField.embedFonts = true
			versionField.x = 409;
			versionField.y = 357;
			versionField.htmlText = "<b>"+_xml.xversion+"</b>";
			addChild(versionField);	
			//this.frm1_title_tf.text =  _xml.xtitle;
			//this.frm1_title2_tf.text =  _xml.xtitle2;
			//this.frm1_copyright_tf.text =  _xml.xtitle3;
			//this.frm1_version_tf.text = _xml.xversion;
			//this.concepts_button.btntitle_tf.text =  _xml.xbtnTitle1;
			this.concepts_button.btn_tf.text =  _xml.xbtntext1;
			//this.lessons_button.btntitle_tf.text =  _xml.xbtnTitle2;
			this.lessons_button.btn_tf.text =  _xml.xbtntext2;			
			//frm1_intro_tf			
		}							
		
		/*******************************************************************
		 * FUNCTIONS:  SET UP ALL BUTTONS AND TEXTFIELDS  
		  *******************************************************************/
		private function setup():void
		{			
			//this.stage.scaleMode = StageScaleMode.NO_SCALE;
			this.cover_button.useHandCursor=false;
			trace("this.stage"+this.stage);
			this.concepts_button.buttonMode = true;
			this.concepts_button.mouseChildren = false;
			//this.concepts_button.useHandCursor = true; 

			this.lessons_button.buttonMode = true; 
			this.lessons_button.mouseChildren = false; 			

			this.register_button.buttonMode = true; 
			this.register_button.mouseChildren = false;			

			this.close_button.buttonMode = true; 
			this.close_button.mouseChildren = false; 			
		
			this.about_button.buttonMode = true; 
			this.about_button.mouseChildren = false; 			
			
			this.concepts_button.addEventListener(MouseEvent.MOUSE_OVER, onConceptsOver);
			this.concepts_button.addEventListener(MouseEvent.MOUSE_OUT, onConceptsOut); 
			this.concepts_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoConceptsFrm); 

			this.lessons_button.addEventListener(MouseEvent.MOUSE_OVER, onLessonsOver);
			this.lessons_button.addEventListener(MouseEvent.MOUSE_OUT, onLessonsOut); 
			this.lessons_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoSearchFrm); 
			//this.lessons_button.addEventListener(MouseEvent.CLICK, gotoSearchFrm);

			this.register_button.addEventListener(MouseEvent.MOUSE_OVER, onRegisterOver); 
			this.register_button.addEventListener(MouseEvent.MOUSE_OUT, onRegisterOut); 
			this.register_button.addEventListener(MouseEvent.MOUSE_DOWN, onRegisterDown); 

			this.close_button.addEventListener(MouseEvent.MOUSE_OVER, onCloseOver); 
			this.close_button.addEventListener(MouseEvent.MOUSE_OUT, onCloseOut);
			this.close_button.addEventListener(MouseEvent.CLICK, onCloseClick); 
			this.about2_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoAboutFrm);
			this.about_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoAboutFrm); 			
		}
	
		/*******************************************************************
		 * FUNCTIONS:  BUTTONS ROLL OVER & OUT 
		  *******************************************************************/
		private function onConceptsOver(evt:MouseEvent):void
		{
			this.concepts_button.gotoAndStop(2);
		}	
		private function onConceptsOut(evt:MouseEvent):void
		{			
				this.concepts_button.gotoAndStop(1);
		}
		private function onLessonsOver(evt:MouseEvent):void
		{
			this.lessons_button.gotoAndStop(2);
		}	
		private function onLessonsOut(evt:MouseEvent):void
		{			
				this.lessons_button.gotoAndStop(1);			
		}
		private function onRegisterOver(evt:MouseEvent):void
		{
			this.register_button.gotoAndStop(2);
		}
		private function onRegisterOut(evt:MouseEvent):void
		{			
				this.register_button.gotoAndStop(1);			
		}
		private function onCloseOver(evt:MouseEvent):void
		{
			this.close_button.gotoAndStop(2);
		}
		private function onCloseOut(evt:MouseEvent):void
		{			
				this.close_button.gotoAndStop(1);			
		}
		 
	} // Main class
 
} //end package

