 
     /**
      *  @private
+     *  Storage for the content property.
      */
     protected var _content:Object;
     
+	/**
+	 *  @private
+	 */
+	private var contentChanged:Boolean = false;
+	
     /**
      *  @private
      *  This metadata tells the MXML compiler to disable some of its default

        return _embeddedFontRegistry;
    }

    //--------------------------------------------------------------------------
    //
    //  Constructor

    [RichTextContent]
        
    /**
     *  This write-only property is for internal use by the MXML compiler.
     *  Please use the <code>textFlow</code> property to set
     *  rich text content.
     */
    public function set content(value:Object):void
    {
    	// Treat setting the 'content' to null
    	// as if 'text' were being set to the empty String
    	// (which is the default state).
    	if (value == null)
    	{
    		text = "";
    		return;
    	}
    	
    	if (value == _content)
    		return;
    	
        _content = value;
        contentChanged = true;
        
		// If more than one of 'text', 'textFlow', and 'content' is set,
		// the last one set wins.
		textChanged = false;
        textFlowChanged = false;
        
		// The other two are now invalid and must be recalculated when needed.
		_text = null;
		_textFlow = null;
		        
		factory = staticTextFlowFactory;
		
		invalidateTextLines();
		invalidateProperties();
		invalidateSize();
		invalidateDisplayList();
    }
    
	//----------------------------------
	//  textFlow
	//----------------------------------
	
	/**
	 *  @private
	 *  Storage for the textFlow property.
	 */
	private var _textFlow:TextFlow;
	
	/**
	 *  @private
	 */
	private var textFlowChanged:Boolean = false;
	
	/**
	 *  The TextFlow displayed by this component.
	 * 
	 *  <p>A TextFlow is the most important class
	 *  in the Text Layout Framework.
	 *  It is the root of a tree of FlowElements
	 *  representing rich text content.</p>
	 * 
	 *  @default
	 */
	public function get textFlow():TextFlow
	{
		// We might not have a valid _textFlow for two reasons:
		// either because the 'text' was set (which is the state
		// after construction) or because the 'content' was set.
		if (!_textFlow)
		{
			if (_content != null)
				_textFlow = createTextFlowFromContent(_content);
			else
				_textFlow = staticPlainTextImporter.importToFlow(_text);
		}
		
		return _textFlow;
	}
	
	/**
	 *  @private
	 */
	public function set textFlow(value:TextFlow):void
	{
		// Treat setting the 'textFlow' to null
		// as if 'text' were being set to the empty String
		// (which is the default state).
		if (value == null)
		{
			text = "";
			return;
		}
		
		if (value == _textFlow)
			return;
			
		_textFlow = value;
		textFlowChanged = true;
		
		// If more than one of 'text', 'textFlow', and 'content' is set,
		// the last one set wins.
		textChanged = false;
		contentChanged = false;
		
		// The other two are now invalid and must be recalculated when needed.
		_text = null
		_content = null;
		
		factory = staticTextFlowFactory;

		invalidateTextLines();
		invalidateProperties();
		invalidateSize();
		invalidateDisplayList();
	}
	
    //--------------------------------------------------------------------------
    //
    //  Overridden methods: GraphicElement
    //
    //--------------------------------------------------------------------------
    
	/**
	 *  @private
	 */
	override protected function commitProperties():void
    {
    	super.commitProperties();
    	
    	// Only one of textChanged, textFlowChanged, and contentChanged
    	// will be true; the other two will be false because each setter
    	// guarantees this.
    	if (textChanged)
    	{
			// If the text has linebreaks (CR, LF, or CF+LF)
			// create a multi-paragraph TextFlow from it
			// and use the TextFlowTextLineFactory to render it.
			// Otherwise the StringTextLineFactory will put
			// all of the lines into a single paragraph
			// and FTE performance will degrade on a large paragraph.
			if (_text.indexOf("\n") != -1 || _text.indexOf("\r") != -1)
			{
				_textFlow = staticPlainTextImporter.importToFlow(_text);
				factory = staticTextFlowFactory;
			}
			textChanged = false;
    	}
    	else if (textFlowChanged)
    	{
    		// Nothing to do at commitProperties() time.
    		textFlowChanged = false;
    	}
    	else if (contentChanged)
    	{
			_textFlow = createTextFlowFromContent(_content);
			contentChanged = false;
    	}
    	
    	// At this point we know which TextLineFactory we're going to use
    	// and we know the _text or _textFlow that it will compose.

		var oldEmbeddedFontContext:IFlexModuleFactory = embeddedFontContext;
		
		// If the CSS styles for this component specify an embedded font,
		// embeddedFontContext will be set to the module factory that
		// should create TextLines (since they must be created in the
		// SWF where the embedded font is.)
		// Otherwise, this will be null.
		embeddedFontContext = getEmbeddedFontContext();
		
		if (embeddedFontContext != oldEmbeddedFontContext)
		{
			staticTextFlowFactory.textLineCreator =
				ITextLineCreator(embeddedFontContext)
			staticStringFactory.textLineCreator = 
				ITextLineCreator(embeddedFontContext)
		}
				
		// If the styles have changed, hostFormat will have
		// been set to null to indicate that it is invalid.
		// In that case, create a new one.
		if (!hostFormat)
		{
			hostFormat = new CSSTextLayoutFormat(this);
			// Note: CSSTextLayoutFormat has special processing
			// for the fontLookup style. If it is "auto",
			// the fontLookup format is set to either
			// "device" or "embedded" depending on whether
			// embeddedFontContext is null or non-null.
		}
		
		if (_textFlow)
		{
			// We might have a new TextFlow, or a new hostFormat,
			// so attach the latter to the former.
			_textFlow.hostFormat = hostFormat;
		
			if (_textFlow.flowComposer)
			{
				_textFlow.flowComposer.textLineCreator = 
					staticTextFlowFactory.textLineCreator;
			}
		}
	}
    
    /**
     *  @private
     */
    override public function stylesInitialized():void
    {
        super.stylesInitialized();

		// The old hostFormat is invalid
		// and a new one must be created.
		hostFormat = null;
    }

    /**
     *  @private
