 	 *
 	 *  @param moduleFactory The IFlexModuleFactory requesting the TextField.
 	 *
-	 *	@return A TLFTextField created in the context
+	 *	@return A FTETextField created in the context
 	 *  of <code>moduleFactory</code>.
 	 *  
 	 *  @langversion 3.0

			
	/**
	 *  @private
	 *  Cache of TLFTextFields. Limit of one per module factory.
	 *  In this Dictionary, each key is a weak reference
	 *  to an IFlexModuleFactory and each value is a Dictionary
	 *  with a single entry (a TLFTextField as a weak key).
	 */
	private var tlfTextFields:Dictionary = new Dictionary(true);
			
	//--------------------------------------------------------------------------
	//


	/**
	 *  @private
	 *  Creates an instance of FTETextField
	 *  in the context of the specified module factory.
	 * 
	 *  @param moduleFactory The IFlexModuleFactory requesting the TextField.
	 *  May not be <code>null</code>.
	 *
	 *	@return A FTETextField created in the context
	 *  of <code>moduleFactory</code>.
	 *  The return value is loosely typed as Object
	 *  to avoid linking in FTETextField (and therefore much of TLF).
	 *  
	 *  @langversion 3.0
	 *  @playerversion Flash 9
	 *  @playerversion AIR 1.1
	 *  @productversion Flex 4
	 */
	public function createFTETextField(moduleFactory:IFlexModuleFactory):Object
	{
		// Check to see if we already have a text field for this module factory.
		var fteTextField:Object = null;
		var fteTextFieldDictionary:Dictionary = fteTextFields[moduleFactory];

		if (fteTextFieldDictionary)
		{
			for (var iter:Object in fteTextFieldDictionary)
			{
				fteTextField = iter;
				break;
			}
		}
		if (!fteTextField)
		{
			if (moduleFactory)
			{
				fteTextField = moduleFactory.create(
					"mx.core.FTETextField");
                fteTextField.textLineCreator = moduleFactory;
			}			
			
			// The dictionary could be empty, but not null because entries in the dictionary
			// could be garbage collected.
			if (!fteTextFieldDictionary)
				fteTextFieldDictionary = new Dictionary(true);
			fteTextFieldDictionary[fteTextField] = 1;
			fteTextFields[moduleFactory] = fteTextFieldDictionary;
		}

		return fteTextField;
	}
}

