Newer
Older
CEE_VE50 / com / digitec / cee / AboutCEE.as
@cwolsen cwolsen on 19 Jun 2019 9 KB Initial Import
/******************************************
 * @author Maria A. Zamora
 * @company Digitec Interactive Inc.
 * @version 0.1
 * @date 12/14/2010
 * 
 * AboutCEE class for aboutFrame2 movie of the CEE application
 * CS5 version of com.digitec.cee.AboutCEE
 *  
*******************************************/
package com.digitec.cee
{
	import flash.display.MovieClip;	
	import flash.events.*;	
	import flash.text.*;
	import flash.display.Sprite;					
	import flash.text.StyleSheet;	
	import flash.text.TextField;		
	import flash.display.Loader;	
	import flash.net.*;
	//import flashx.textLayout.conversion.TextConverter;
	//import flashx.textLayout.elements.TextFlow;	
//	import flashx.textLayout.elements.*;
//	import flashx.textLayout.conversion.*;
//	import flash.textLayout.conversion.TextConverter;
//	import flash.textLayout.elements.TextFlow;	
	import flash.text.TextFormat;	
	//import flash.html.HTMLLoader;
	//import flash.html.HTMLPDFCapability;
	import flash.net.URLRequest;
	//import flash.filesystem.File;
	import flash.system.Capabilities;
	//import flash.core.UIComponent;
	public class AboutCEE extends BaseCEE
	{								
		 private var myFont:Font = new Font3();
		private var versionField:TextField;	
		//private var mypdf:String="data/about.html"
		private var hwidth:Number=700;
		private var hheight:Number=410;
		private var position:Array=[44,93]
		//private var htmlLoader:HTMLLoader = new HTMLLoader();
		private var testLink:Object;
		//private var appDirectory;
		//private var storageDirectory;
		//private var mypdffinal;
		//private var appDirectory:String = File.applicationDirectory;
		//private var storageDirectory:String = File.applicationStorageDirectory;
		//PDF
		 public function AboutCEE()
		 {
			super(MainConstants.XMLABOUT);
			//getDrive();
			setup();			
		}		
					
				/*	
private function getDrive():void
	{
     var os:String = Capabilities.os.substr(0, 3).toLowerCase();
	 var currentDrives:Array = (os=="mac") ? new File('/Volumes/').getDirectoryListing() : File.getRootDirectories() ;
	 
	 trace(currentDrives);
     for each(var file:File in currentDrives){
		 var dtemp = file.name;
		 if (os=="mac"){
			 var currentDirectories:Array =  new File('/Volumes/'+dtemp+'/').getDirectoryListing() ; 
		 } else {
			 var currentDirectories:Array =  new File(dtemp+'/').getDirectoryListing() ;
		 }
		 for each(var file2:File in currentDirectories){
			 if (file2.name=="_VE4DATA"){
			 trace('/Volumes/'+dtemp+'/');
			 //dwpath=
			 if (os=="mac"){
			 	 mypdffinal="file:///Volumes/"+dtemp+"/";
				  trace("MAC");
			 }else{
				 
				 mypdffinal="file:///"+dtemp+"/";
				 trace("PC");
			 }

			 }

     };
	 
     }
	 //pdfread();
	} 
	*/
		/*******************************************************************
		 * FUNCTION: SETUP FRAME TEXT_FIELDS  FROM XML
		 *******************************************************************/
		override public function setFramesText(_xml:XML ):void
		{

			this.title_tf.text = _xml.xtitle; //maybe without the this.
			this.version_tf.text =  _xml.xversion;
			var myFormat:TextFormat = new TextFormat();
			myFormat.font = myFont.fontName;
			myFormat.size = 12;
			myFormat.color = 0x8DC269;
			myFormat.bold = true;
			versionField = new TextField();	
			versionField.defaultTextFormat = myFormat;
			versionField.height = 17;
			versionField.width = 50;
			versionField.background = false;
			versionField.border = false;
			versionField.multiline = true;
			versionField.wordWrap = true;
			versionField.x = 415;
			versionField.y = 581;
			versionField.embedFonts=true;
			versionField.text = _xml.xversion2;
			addChild(versionField);	
			var myFormat2:TextFormat = new TextFormat();
			myFormat2.font = myFont.fontName;
			myFormat2.size = 18;
			myFormat2.color = 0x000000;
			myFormat2.bold = true;
			
			this.about_tf.htmlText =  _xml.xcaption1;
			this.about_tf.addEventListener(TextEvent.LINK, linkEvent);		
			this.about_tf.defaultTextFormat = myFormat2;
			this.about_tf.embedFonts=true;
			//this.info1_tf.text =  _xml.xinfo1;			
			//this.link1_tf.text = _xml.xlink1;
			//this.council_tf .text = _xml.xcaption2;
			//this.info2_tf.text =  _xml.xinfo2;
			//this.link2_tf.text =  _xml.xlink2;
			//this.acknowledge_tf.text =  _xml.xacknowledge;
			//this.info3_tf.text =  _xml.xinfo3;			
			
			//this.link3_tf.text =  _xml.xlink3;
			//this.logo1_tf.text =  _xml.xlogo1;
			//this.logo2_tf.text =  _xml.xlogo2;
			//this.version2_tf.text =  _xml.xversion2;			
			this.register_tf.text =  _xml.xregister;
			//var request:URLRequest = new URLRequest("data/about.html"); 
			


			
		}							
		private function linkEvent( txtEvt :TextEvent ):void 
		{
//trace("EVENT=============================="+txtEvt.text);
			var functionArr:Array = HelperFunctions.extractFunctionName( txtEvt.text );
			//var functionArr:Array = extractFunctionName( txtEvt.text );
			var functionName:String = functionArr[0];
			var args:String =  functionArr[1];
			 switch( functionName ) 
			 {
				 
					case "gotoWebPage" :
				  this.gotoWebPage(args);
				  break;
				  default :
				  trace("function not found");
			 }
		}			
		private function gotoWebPage( str:String ):void	
		{													
			//trace(str);
			if(str!=null)	
			{	
				//var lessonitem:LessonItem = getLessonPerId( id );
				//pdfFile = lessonitem.pdf_url;
				var request:URLRequest = new URLRequest(str);
       			navigateToURL(request, '_blank');
			}				
		}
		/*******************************************************************
		 * FUNCTIONS:  SET UP ALL BUTTONS AND TEXTFIELDS  
		  *******************************************************************/
		private function setup():void
		{			
			
			this.close_button.buttonMode = true; 
			this.close_button.mouseChildren = false;
			this.close_button.useHandCursor = true; 
			
			this.close_button.addEventListener(MouseEvent.MOUSE_OVER, onCloseOver); 
			this.close_button.addEventListener(MouseEvent.MOUSE_OUT, onCloseOut); 
			this.close_button.addEventListener(MouseEvent.CLICK, onCloseClick); 
			
			this.nav_back_button.addEventListener(MouseEvent.MOUSE_OVER, onNavBackOver); 
			this.nav_back_button.addEventListener(MouseEvent.MOUSE_OUT, onNavBackOut); 
			this.nav_back_button.addEventListener(MouseEvent.CLICK, gotoLastFrm);

			this.nav_home_button.addEventListener(MouseEvent.MOUSE_OVER, onNavHomeOver);
			this.nav_home_button.addEventListener(MouseEvent.MOUSE_OUT, onNavHomeOut);
			this.nav_home_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoHomeFrm); 

			this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_OVER, onNavConceptsOver);
			this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_OUT, onNavConceptsOut); 
			this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoConceptsFrm);

			this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_OVER, onNavLessonsOver); 
			this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_OUT, onNavLessonsOut);
			this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoSearchFrm); 
		}
		
		///////////// html page //////////////////
		/*public function pdfread() {
			// constructor code
				if(HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK) {
					trace("PDF content can be displayed");
				}else{
					trace("PDF cannot be displayed. Error code:", HTMLLoader.pdfCapability);
				}
				
				
			//var aboutpath = Object(parent).getDpath();
				
			var aboutgohtml:String = mypdffinal+ "_VE4DATA/"+mypdf;
				var url:URLRequest = new URLRequest(aboutgohtml);
				
				//hxw of the content
				htmlLoader.width = hwidth;
				htmlLoader.height = hheight;
				
				htmlLoader.load(url);
				htmlLoader.addEventListener(Event.COMPLETE, completeLDHandler);  
				//wrapping into UIComponent
				var holder:MovieClip = new MovieClip();
				
				holder.addChild(htmlLoader);
				
				//change x and y to position
				
				holder.x=position[0]
				holder.y=position[1]
				
				addChild(holder); //add it to any container

		}
		private function completeLDHandler(event:Event):void {  
  			//htmlLoader.window.alert(htmlLoader.window.document.getElementById("testLink").innerHTML);  
 		   //testLink = htmlLoader.window.document.getElementById("testLink");  
		   //trace(testLink);
    	   htmlLoader.window.addEventListener("click", clickHandler);  
		}  
  
		private function clickHandler(e:*):void {  
 			 //htmlLoader.window.alert("You have clicked "); 
			 //var dwtemp = htmlLoader.window.document.getElementById("testLink");
			 //trace ("dwtemp "+dwtemp);
			///trace(htmlLoader.window.document.getElementById("testLink").innerHTML);
			// var dwpath = htmlLoader.window.gohere;
			 var myURL:URLRequest = new URLRequest(htmlLoader.window.gohere);
			 trace (myURL);
			// trace("testLink "+testLink);
				 //var dwtemplink = toString(testLink);
			 navigateToURL(myURL, "_blank");
			 trace("You clicked it!");  
		} 
		*/
		/*******************************************************************
		 * FUNCTIONS:  BUTTONS ROLL OVER & OUT 
		  *******************************************************************/
		  private function onCloseOver(evt:MouseEvent):void
		{
			this.close_button.gotoAndStop(2);
		}
		private function onCloseOut(evt:MouseEvent):void
		{			
				this.close_button.gotoAndStop(1);									
		}
		private function onNavBackOver(evt:MouseEvent):void
		{
			this.back_icon_roll.gotoAndStop(2);
		}
		private function onNavBackOut(evt:MouseEvent):void
		{
			this.back_icon_roll.gotoAndStop(1);
		}
		private function onNavHomeOver(evt:MouseEvent):void
		{
			this.house_mc.gotoAndStop(2);
		}
		private function onNavHomeOut(evt:MouseEvent):void
		{
			this.house_mc.gotoAndStop(1);
		}
		private function onNavConceptsOver(evt:MouseEvent):void
		{
			this.nav_concepts_roll.gotoAndStop(2);
		}
		private function onNavConceptsOut(evt:MouseEvent):void
		{
			this.nav_concepts_roll.gotoAndStop(1);
		}
		private function onNavLessonsOver(evt:MouseEvent):void
		{
			this.nav_lessons_roll.gotoAndStop(2);
		}
		private function onNavLessonsOut(evt:MouseEvent):void
		{
			this.nav_lessons_roll.gotoAndStop(1);
		}
		
 
	} // Main class
 
} //end package