Newer
Older
CEE_VE50 / com / digitec / cee / EulaCEE.as
@cwolsen cwolsen on 19 Jun 2019 4 KB Initial Import
/******************************************
 * @author Maria A. Zamora
 * @company Digitec Interactive Inc.
 * @version 0.1
 * @date 12/14/2010
 * 
 * This is the EulaCEE class for the CEE application
 * CS5 version of com.digitec.cee.EulaCEE
 *  
*******************************************/
package com.digitec.cee
{
	import flash.display.MovieClip;
	//import flash.display.Stage;			
	import flash.events.*;			
	import flash.display.Loader;			
	import flash.display.LoaderInfo;			
	//import flash.errors.IllegalOperationError;
	import fl.controls.Button;	
	import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.TextEvent;
    import flash.text.TextField;
  //  import fl.events.ComponentEvent;
    import fl.controls.TextArea;
    import flash.net.SharedObject;
	
	public class EulaCEE extends MovieClip 
	{						
		private var _xmlPath:String;										
		//private var textArea:TextArea;										
		private var textArea:TextArea;
		private var agree_btn:Button;
		private var disagree_btn:Button;
		private var shareObj:SharedObject;		
		 
		 public function EulaCEE()		
		 {								 	
			setup();
			setupListeners();						
		}
		
		/*******************************************************************
	 	* FUNCTION:  TO INITIALIZE APPLICATION
		*******************************************************************/		
		private function init(e:Event):void		
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);						
			
			 loadXML();			
		}		
	
		/*******************************************************************
	 	* FUNCTION:  TO LOAD TEXT FROM A XML FILE
		*******************************************************************/		
		private function loadXML():void
		{			
		var vidpicpath = Object(parent).getDpath();
			_xmlPath = vidpicpath+ "_VE50DATA/"+MainConstants.XMLPATH + MainConstants.XMLEULA;
			var xmlLoaderobj:XMLLoader=new XMLLoader();
			xmlLoaderobj.loadXML(_xmlPath, 'xml0');			
			xmlLoaderobj.addEventListener(CustomEvent.XMLLoaded, XMLLoaded);			
			function XMLLoaded(evt:CustomEvent)
			{				
				if(evt.XMLRef=='xml0')
				{					
					var _xml:XML = new XML(evt.XMLData);										
					//_xml.ignoreWhite = true;															
					textArea.htmlText = _xml.fulltext;															
				}				
			}			
		}					
		
	
				
		/*******************************************************************
		 * FUNCTION:  SET UP ALL LISTENERS
		  *******************************************************************/
		private function setupListeners():void
		{
			//addEventListener(Event.ADDED_TO_STAGE, init);															
			
			//this.agree_btn.addEventListener(MouseEvent.CLICK, onAgreeDown); 

			//this.disagree_btn.addEventListener(MouseEvent.CLICK, onDisagreeDown);			
		}
		
		/*******************************************************************
		 * FUNCTIONS:  SET UP ALL BUTTONS AND TEXTFIELDS  
		  *******************************************************************/
		private function setup():void
		{			
			textArea = new TextArea();
			textArea.setSize(718, 440);
			textArea.move(42, 101);
			textArea.editable = false;
			textArea.enabled = true;
			//textArea.textField.color = #EEEEEE;
			textArea.condenseWhite = true; //remove white spaces
			addChild(textArea);						
			
			agree_btn = new Button();
			//agree_btn.label.text = 
			agree_btn.label = "I agree to these terms";
			agree_btn.setSize(141, 22);
			agree_btn.move(535, 561);
			agree_btn.enabled = true;
			agree_btn.emphasized = true;
			agree_btn.selected = false;
			agree_btn.toggle = true;
			agree_btn.setStyle( "icon", check); 
			agree_btn.buttonMode = true; 
			agree_btn.addEventListener(MouseEvent.CLICK, clickAgree);
			addChild(agree_btn);						
			
			disagree_btn = new Button();
			disagree_btn.label = "I disagree";
			disagree_btn.setSize(89, 22);
			disagree_btn.move(685, 561);
			disagree_btn.enabled = true;
			disagree_btn.emphasized = true;
			disagree_btn.selected = true;
			disagree_btn.toggle = true;
			disagree_btn.setStyle( "icon", xcheck); 
			disagree_btn.buttonMode = true; 
			disagree_btn.addEventListener(MouseEvent.CLICK, clickDisagree);
			addChild(disagree_btn);						
						
			
			//this.concepts_button.buttonMode = true;
			//this.concepts_button.mouseChildren = false;
			//this.concepts_button.useHandCursor = true; 
			addEventListener(Event.ADDED_TO_STAGE, init);															

		}
		
	
		/*******************************************************************
		 * FUNCTIONS:  BUTTONS ROLL OVER & OUT 
		  *******************************************************************/
		 private function clickAgree(event:MouseEvent):void
		 {   			
			//SET A SHAREOBJECT IN CLIENT
			shareObj = SharedObject.getLocal("ceeCookie", "/");
			shareObj.data.returnClient = true;
			shareObj.flush();
			//write a ShareObj
			//dont display this dialog again
			//run cd
			Object(parent).removeChild(this);
		}
		
		 private function clickDisagree(event:MouseEvent):void
		 {					
			Object(parent).closeApplication();	  			
		}

		
		 
	} // Main class
 
} //end package