﻿// Copyright 2007. Adobe Systems Incorporated. All Rights Reserved.
package com.adobe.captivate.events 
{
	import flash.events.Event;

	/**
	 * The CPVariableCreatedEvent class describes the event object passed to the event listener when a captivate variable is created
	 */
	public class CPVariableCreatedEvent extends CaptivateEvent 
	{
	/**
		*  The <code>CPVariableCreatedEvent.CPVARIABLECREATEDEVENT</code> constant defines the value of the
		*  <code>type</code> property of the event object for an <code>CPMoviePauseEvent</code> event.
		*  <p>The properties of the event object have the following values:</p>
		*  <table class="innertable">
		*     <tr><th>Property</th><th>Value</th></tr>
		*     <tr><td><code>bubbles</code></td><td><code>true</code></td></tr>
		*     <tr><td><code>variableName</code></td><td>Name of the variable being changed</td></tr>
		*     <tr><td><code>value</code></td><td>The value of the variable being created</td></tr>
		*	  </table>
		*  @eventType CPVariableCreatedEvent	
		*/
		public static const CPVARIABLECREATEDEVENT:String = "CPVariableCreatedEvent";
		/**
		* @private
		*/
		private var m_Value:Object;
		/**
		* @private
		*/
		private var m_VariableName:String;
		
		public function CPVariableCreatedEvent(captivateVersion:String="",aVarName:String="",aValue:Object=null) 
		{
			super(CPVariableCreatedEvent.CPVARIABLECREATEDEVENT,captivateVersion,false);
			m_VariableName = aVarName;
			m_Value = aValue;
		}
		/**
		* @private
		*/
		public override function clone():Event
		{
			return new CPVariableCreatedEvent(captivateVersion,variableName,value);
		}
		/**
		* The name of the variable being changed
		*/
		public function get variableName():String
		{
			return m_VariableName;
		}
		
		/**
		* The value of the variable
		*/
		public function get value():Object
		{
			return m_Value;
		}				
		/**
		* @private
		*/
		public override function toString():String
		{
			return formatToString("CPVariableCreatedEvent","type","bubbles","cancelable","eventPhase","captivateVersion","variableName","value");
		}
	}
}
