Transferred from the Adobe Open Source Subversion Repository

Revision: 9546
Author:   gosmith@adobe.com
Date:     2009-08-24T21:48:20.737982Z

Log Message:
-----------
Integrated build 71 of TLF's mainline (not "1.0") code.

QE notes: This is the TLF build from 8/12 that you tested in a cyclone build
Doc notes: None
Bugs: None
Reviewer: None
Tests run: ant checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/compose/TextFlowLine.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/formats/TabStopFormatInc.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/IConfiguration.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_conversion/src/flashx/textLayout/conversion/TextConverter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/EditClasses.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/formats/TabStopFormat.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_textField/src/flashx/textLayout/controls/TLFTextField.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/operations/InsertInlineGraphicOperation.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/operations/ApplyLinkOperation.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/compose/BaseCompose.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/compose/StandardFlowComposer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_conversion/src/flashx/textLayout/conversion/HtmlImporter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/ReleaseNotes.txt</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/factory/TextLineFactoryBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/BackgroundManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/tlf.properties</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/formats/TextLayoutFormatInc.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/formats/TextLayoutFormatValueHolder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/edit/SelectionManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/InlineGraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/edit/EditManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/edit/TextFlowEdit.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/formats/TextLayoutFormat.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/container/ContainerController.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/formats/ITabStopFormat.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/BuildInfo.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/edit/ISelectionManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/formats/ITextLayoutFormat.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/debug/Debugging.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_conversion/src/flashx/textLayout/conversion/BaseTextLayoutImporter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/SubParagraphGroupElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/factory/StringTextLineFactory.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/Configuration.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/TCYElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/FlowLeafElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_conversion/src/flashx/textLayout/conversion/TextLayoutImporter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/edit/TextClipboard.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/factory/TextFlowTextLineFactory.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/textLayout_core/src/flashx/textLayout/elements/TextFlow.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1277874 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/mx/core/FTETextField.as
+++ frameworks/projects/spark/src/mx/core/FTETextField.as
@@ -7,14 +7,8 @@
 //  NOTICE: Adobe permits you to use, modify, and distribute this file
 //  in accordance with the terms of the license agreement accompanying it.
 //
-//////////////////////////////////////////////////////////////////////////////////
-//
-//ADOBE SYSTEMS INCORPORATED
-//Copyright 2009 Adobe Systems Incorporated
-//All Rights Reserved.
-//
-//in accordance with the terms of the license agreement accompanying it.
-//
+////////////////////////////////////////////////////////////////////////////////
+
 package flashx.textLayout.controls
 {

@@ -31,32 +25,52 @@
 import flash.text.TextFormat;
 import flash.text.TextFormatAlign;
 import flash.text.TextLineMetrics;
+import flash.text.engine.FontLookup;
 import flash.text.engine.FontPosture;
 import flash.text.engine.FontWeight;
 import flash.text.engine.Kerning;
+import flash.text.engine.SpaceJustifier;
+import flash.text.engine.TextBlock;
+import flash.text.engine.TextElement;
 import flash.text.engine.TextLine;

+import flashx.textLayout.compose.ITextLineCreator;
+import flashx.textLayout.conversion.ITextExporter;
 import flashx.textLayout.conversion.ITextImporter;
 import flashx.textLayout.conversion.TextConverter;
-import flashx.textLayout.debug.assert;
-import flashx.textLayout.compose.ITextLineCreator;
-import flashx.textLayout.factory.StringTextLineFactory;
+import flashx.textLayout.elements.TextFlow;
+import flashx.textLayout.factory.TextFlowTextLineFactory;
 import flashx.textLayout.formats.LineBreak;
 import flashx.textLayout.formats.TextDecoration;
-import flashx.textLayout.formats.TextLayoutFormatValueHolder;
+import flashx.textLayout.formats.TextLayoutFormat;

 /**
  *  TLFTextField is a Sprite which displays text by using the new
  *  Text Layout Framework to implement the old TextField API.
- * @playerversion Flash 10
- * @playerversion AIR 1.5
- * @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @langversion 3.0
  */
 public class TLFTextField extends Sprite
 {
     // Current slot count: 32
     // (1 for every type except 2 for Number)

+	//--------------------------------------------------------------------------
+	//
+	//  Class initialization
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private static function initClass():void
+	{
+	}
+
+	initClass();
+
     //--------------------------------------------------------------------------
     //
     //  Class constants
@@ -95,9 +109,9 @@
 	private static const FLAG_WORD_WRAP_CHANGED:uint = 1 << 18;

 	/**
-	 * @private
-	 * Masks for bits inside the 'flags' var
-	 * tracking misc boolean variables.
+	 *  @private
+	 *  Masks for bits inside the 'flags' var
+	 *  tracking misc boolean variables.
 	 */
 	private static const FLAG_SCROLL_RECT_IS_SET:uint = 1 << 19;
 	private static const FLAG_VALIDATE_IN_PROGRESS:uint = 1 << 20;
@@ -124,19 +138,132 @@
     /**
      *  @private
      */
-    private static var textImporter:ITextImporter =
+    private static var plainTextImporter:ITextImporter =
     	TextConverter.getImporter(TextConverter.PLAIN_TEXT_FORMAT);

-    /**
-     *  @private
-     */
-    private static var htmlTextImporter:ITextImporter =
-    	TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT);
-    	// TLF needs TEXT_FIELD_HTML_FORMAT
-
-    private static var factory:StringTextLineFactory = new StringTextLineFactory();
+	/**
+	 *  @private
+	 */
+	private static var plainTextExporter:ITextExporter =
+		TextConverter.getExporter(TextConverter.PLAIN_TEXT_FORMAT);
+
+		/**
+	 *  @private
+	 */
+	private static var htmlImporter:ITextImporter =
+		TextConverter.getImporter(TextConverter.HTML_FORMAT);
+
+	/**
+	 *  @private
+	 */
+	private static var htmlExporter:ITextExporter =
+		TextConverter.getExporter(TextConverter.HTML_FORMAT);
+
+	/**
+	 *  @private
+	 */
+    private static var factory:TextFlowTextLineFactory =
+    	new TextFlowTextLineFactory();

-    //--------------------------------------------------------------------------
+	// We can re-use single instances of a few FTE classes over and over,
+	// since they just serve as a factory for the TextLines that we care about.
+
+	/**
+	 *  @private
+	 */
+	private static var staticTextBlock:TextBlock = new TextBlock();
+
+	/**
+	 *  @private
+	 */
+	private static var staticTextElement:TextElement = new TextElement();
+
+	/**
+	 *  @private
+	 */
+	private static var staticSpaceJustifier:SpaceJustifier =
+		new SpaceJustifier();
+
+	/**
+	 *  @private
+	 *  A reference to the recreateTextLine() method in staticTextBlock,
+	 *  if it exists. This method was added in player 10.1.
+	 *  It allows better performance by making it possible to reuse
+	 *  existing TextLines instead of having to create new ones.
+	 */
+	private static var recreateTextLine:Function =
+		"recreateTextLine" in staticTextBlock ?
+		staticTextBlock["recreateTextLine"] :
+		null;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private static function rint(x:Number):Number
+	{
+		var i:Number = Math.round(x);
+		if (i - 0.5 == x && i & 1)
+			--i;
+		return i;
+	}
+
+	/**
+	 *  @private
+	 */
+	private static function createDefaultTextFormat():TextFormat
+	{
+		// TODO: is font value platform-dependent???
+		var ret:TextFormat = new TextFormat("Times New Roman", 12, 0x000000, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0);
+		ret.blockIndent = 0;
+		ret.bullet = false;
+		ret.kerning = false;
+		ret.leading = 0;
+		ret.letterSpacing = 0;
+		ret.tabStops = []; // does not work. Flash apparently detects when an empty array is assigned to tabStops and assigns null instead.
+		return ret;
+	}
+
+	/**
+	 *  @private TODO
+	 */
+	private static function createTextFormatCopy(obj:TextFormat):TextFormat
+	{
+		var ret:TextFormat = new TextFormat(obj.font, obj.size, obj.color, obj.bold, obj.italic, obj.underline, obj.url, obj.target, obj.align, obj.leftMargin, obj.rightMargin, obj.indent);
+		ret.blockIndent = obj.blockIndent;
+		ret.bullet = obj.bullet;
+		ret.kerning = obj.kerning;
+		ret.leading = obj.leading;
+		ret.letterSpacing = obj.letterSpacing;
+		ret.tabStops = obj.tabStops;
+		return ret;
+	}
+
+	/**
+	 *  @private TODO
+	 */
+	private static function intToHexColor(color:Object):String
+	{
+		if (color == null)
+			return "000000";
+		var colorInt:int = int(color);
+		var s:String = new String();
+		var hexCode:Array = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" ];
+		for (var i:int = 0; i < 6; ++i)
+		{
+			var c:int = colorInt & 15;
+			s = hexCode[c] + s;
+			colorInt >>= 4;
+		}
+		return s;
+	}
+
+	//--------------------------------------------------------------------------
     //
     //  Constructor
     //
@@ -144,13 +271,14 @@

 	/**
 	 *  Constructor.
-	 * @playerversion Flash 10
-	 * @playerversion AIR 1.5
-	 * @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @langversion 3.0
 	 */
 	public function TLFTextField()
 	{
 		super();
+
 		addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
 	}

@@ -178,13 +306,11 @@
     /**
      *  @private
      */
-    private var hostContainerFormat:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder();
-    private var hostParagraphFormat:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder();
-    private var hostCharacterFormat:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder();
-
-    /**
-    * @private
-    */
+    private var hostFormat:TextLayoutFormat = new TextLayoutFormat();
+
+    /**
+     *  @private
+     */
     private var _textLineCreator:ITextLineCreator;

     //--------------------------------------------------------------------------
@@ -192,7 +318,6 @@
     //  Overridden properties: DisplayObject
     //
     //--------------------------------------------------------------------------
-

     //----------------------------------
     //  height
@@ -307,9 +432,9 @@

     /**
      *  @copy flash.text.TextField#alwaysShowSelection
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get alwaysShowSelection():Boolean
     {
@@ -342,9 +467,9 @@

     /**
      *  @copy flash.text.TextField#antiAliasType
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get antiAliasType():String
     {
@@ -386,9 +511,9 @@

     /**
      *  @copy flash.text.TextField#autoSize
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get autoSize():String
     {
@@ -414,7 +539,7 @@

     	_autoSize = value;

-    	if ( _autoSize != TextFieldAutoSize.NONE )
+    	if (_autoSize != TextFieldAutoSize.NONE)
     		_maxScrollH = 0;

     	// The border and background may need to be redrawn,
@@ -438,9 +563,9 @@

     /**
      *  @copy flash.text.TextField#background
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get background():Boolean
     {
@@ -476,9 +601,9 @@

     /**
      *  @copy flash.text.TextField#backgroundColor
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get backgroundColor():uint
     {
@@ -510,9 +635,9 @@

     /**
      *  @copy flash.text.TextField#border
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get border():Boolean
     {
@@ -549,9 +674,9 @@

     /**
      *  @copy flash.text.TextField#borderColor
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get borderColor():uint
     {
@@ -588,9 +713,9 @@

     /**
      *  @copy flash.text.TextField#bottomScrollV
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get bottomScrollV():int
     {
@@ -606,9 +731,9 @@

     /**
      *  @copy flash.text.TextField#caretIndex
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get caretIndex():int
     {
@@ -622,9 +747,9 @@

     /**
      *  @copy flash.text.TextField#condenseWhite
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get condenseWhite():Boolean
     {
@@ -649,41 +774,17 @@
     //----------------------------------
     //  defaultTextFormat
     //----------------------------------
-    static private function createDefaultTextFormat( ): TextFormat
-    {
-      	// TODO: is font value platform-dependent???
-	  	var ret:TextFormat = new TextFormat("Times New Roman", 12, 0x000000, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0);
-		ret.blockIndent = 0;
-		ret.bullet = false;
-		ret.kerning = false;
-		ret.leading = 0;
-		ret.letterSpacing = 0;
-		ret.tabStops = new Array(); // does not work. Flash apparently detects when an empty array is assigned to tabStops and assigns null instead.
-		return ret;
-    }
-
-    static private function createTextFormatCopy( obj:TextFormat ): TextFormat
-    {
-    	var ret:TextFormat = new TextFormat(obj.font,obj.size,obj.color,obj.bold,obj.italic,obj.underline,obj.url,obj.target,obj.align,obj.leftMargin,obj.rightMargin,obj.indent);
-		ret.blockIndent = obj.blockIndent;
-		ret.bullet = obj.bullet;
-		ret.kerning = obj.kerning;
-		ret.leading = obj.leading;
-		ret.letterSpacing = obj.letterSpacing;
-		ret.tabStops = obj.tabStops;
-		return ret;
-    }
-
-    /**
-     *  @private
-     */
-    private var _defaultTextFormat:TextFormat = createDefaultTextFormat( );
+
+    /**
+     *  @private
+     */
+    private var _defaultTextFormat:TextFormat = createDefaultTextFormat();

     /**
      *  @copy flash.text.TextField#defaultTextFormat
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get defaultTextFormat():TextFormat
     {
@@ -702,7 +803,7 @@
     	if (value == _defaultTextFormat)
     		return;

-    	_defaultTextFormat = createTextFormatCopy( value );
+    	_defaultTextFormat = createTextFormatCopy(value);

     	setFlag(FLAG_DEFAULT_TEXT_FORMAT_CHANGED);

@@ -722,9 +823,9 @@

     /**
      *  @copy flash.text.TextField#displayAsPassword
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get displayAsPassword():Boolean
     {
@@ -763,9 +864,9 @@

     /**
      *  @copy flash.text.TextField#embedFonts
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get embedFonts():Boolean
     {
@@ -804,9 +905,9 @@

     /**
      *  @copy flash.text.TextField#gridFitType
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get gridFitType():String
     {
@@ -849,20 +950,20 @@

     /**
      *  @copy flash.text.TextField#htmlText
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get htmlText():String
     {
     	if (_htmlText == null)
     	{
 			var htmlPreText:String;
-			if ( _text.length && _text.charCodeAt( _text.length - 1 ) == 13 )
+			if (_text.length && _text.charCodeAt(_text.length - 1) == 13)
 				htmlPreText = _text.substr(0, _text.length - 1); // trim at most 1 trailing CR
 			else
 				htmlPreText = _text;
-			var lines:Array =  htmlPreText.split( /\r/ );
+			var lines:Array =  htmlPreText.split(/\r/);

 			// TODO: is font value platform-dependent???
 			var htmlFont:String = _defaultTextFormat.font ? _defaultTextFormat.font : "Times New Roman";
@@ -898,8 +999,8 @@
     		// but that's not what TextField does.
     	}

-    	if (value == htmlText)
-    		return;
+//    	if (value == htmlText)
+//    		return;

     	_htmlText = value;

@@ -931,9 +1032,9 @@

     /**
      *  @copy flash.text.TextField#length
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get length():int
     {
@@ -951,9 +1052,9 @@

     /**
      *  @copy flash.text.TextField#maxChars
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get maxChars():int
     {
@@ -989,13 +1090,13 @@

     /**
      *  @copy flash.text.TextField#maxScrollH
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get maxScrollH():int
     {
-    	if ( _autoSize == TextFieldAutoSize.NONE )
+    	if (_autoSize == TextFieldAutoSize.NONE)
     		validateNow();

     	return _maxScrollH;
@@ -1012,9 +1113,9 @@

     /**
      *  @copy flash.text.TextField#maxScrollV
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get maxScrollV():int
     {
@@ -1029,9 +1130,9 @@

     /**
      *  @copy flash.text.TextField#mouseWheelEnabled
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get mouseWheelEnabled():Boolean
     {
@@ -1059,9 +1160,9 @@

      /**
      *  @copy flash.text.TextField#multiline
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get multiline():Boolean
     {
@@ -1094,9 +1195,9 @@

     /**
      *  @copy flash.text.TextField#numLines
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get numLines():int
     {
@@ -1116,9 +1217,9 @@

     /**
      *  @copy flash.text.TextField#restrict
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get restrict():String
     {
@@ -1151,9 +1252,9 @@

     /**
      *  @copy flash.text.TextField#scrollH
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get scrollH():int
     {
@@ -1194,9 +1295,9 @@

     /**
      *  @copy flash.text.TextField#scrollV
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get scrollV():int
     {
@@ -1232,9 +1333,9 @@

     /**
      *  @copy flash.text.TextField#selectable
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get selectable():Boolean
     {
@@ -1265,9 +1366,9 @@

     /**
      *  @copy flash.text.TextField#selectionBeginIndex
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get selectionBeginIndex():int
     {
@@ -1283,9 +1384,9 @@

     /**
      *  @copy flash.text.TextField#selectionEndIndex
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get selectionEndIndex():int
     {
@@ -1306,9 +1407,9 @@

     /**
      *  @copy flash.text.TextField#sharpness
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get sharpness():Number
     {
@@ -1351,9 +1452,9 @@

     /**
      *  @copy flash.text.TextField#styleSheet
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get styleSheet():StyleSheet
     {
@@ -1386,26 +1487,6 @@
     	// scrollH/scrollV/bottomScrollV?
     }

-    /**
-     *  @private
-     */
-    static private function intToHexColor( color:Object ):String
-    {
-    	if ( color == null )
-    		return "000000";
-    	var colorInt:int = int(color);
-    	var s:String = new String();
-    	var hexCode:Array = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
-    	for (var i:int = 0; i < 6; ++i)
-    	{
-    		var c:int = colorInt & 15;
-    		s = hexCode[c] + s;
-    		colorInt >>= 4;
-    	}
-    	return s;
-    }
-
-
     //----------------------------------
     //  text
     //----------------------------------
@@ -1417,9 +1498,9 @@

     /**
      *  @copy flash.text.TextField#text
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get text():String
     {
@@ -1435,7 +1516,7 @@
     	if (value == null)
     		throw new TypeError("Parameter text must be non-null.");

-    	var noNewlineText:String = value.replace( /\n/g, "\r" );
+    	var noNewlineText:String = value.replace(/\n/g, "\r");

     	if (noNewlineText == _text)
     		return;
@@ -1446,8 +1527,6 @@

     	// signals that htmlText needs to be regenerated
     	_htmlText = null;
-
-

     	setFlag(FLAG_TEXT_CHANGED |
     			FLAG_GRAPHICS_INVALID |
@@ -1478,9 +1557,9 @@

     /**
      *  @copy flash.text.TextField#textColor
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get textColor():uint
     {
@@ -1519,9 +1598,9 @@

     /**
      *  @copy flash.text.TextField#textHeight
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get textHeight():Number
     {
@@ -1541,9 +1620,9 @@

     /**
      *  @copy flash.text.TextField#textWidth
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get textWidth():Number
     {
@@ -1563,9 +1642,9 @@

     /**
      *  @copy flash.text.TextField#thickness
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get thickness():Number
     {
@@ -1605,9 +1684,9 @@

     /**
      *  @copy flash.text.TextField#type
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get type():String
     {
@@ -1653,9 +1732,9 @@
     }
     /**
      *  @copy flash.text.TextField#useRichTextClipboard
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function set useRichTextClipboard(value:Boolean):void
     {
@@ -1675,9 +1754,9 @@

     /**
      *  @copy flash.text.TextField#wordWrap
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get wordWrap():Boolean
     {
@@ -1711,9 +1790,9 @@
     /**
 	 * Gets and sets the ITextLineCreator instance to be used for creating TextLines.  Override this if you need lines to be created in a different
 	 * SWF context than the one containing the TLF code.  The framework will supply a default implementation of ITextLineCreator if none is supplied by the caller.
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function get textLineCreator():ITextLineCreator
     {
@@ -1732,9 +1811,9 @@

     /**
      *  @copy flash.text.TextField#appendText()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function appendText(newText:String):void
     {
@@ -1743,9 +1822,9 @@

     /**
      *  @copy flash.text.TextField#getCharBoundaries()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getCharBoundaries(charIndex:int):Rectangle
     {
@@ -1754,9 +1833,9 @@

     /**
      *  @copy flash.text.TextField#getCharIndexAtPoint()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getCharIndexAtPoint(x:Number, y:Number):int
     {
@@ -1765,9 +1844,9 @@

     /**
      *  @copy flash.text.TextField#getFirstCharInParagraph()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getFirstCharInParagraph(charIndex:int):int
     {
@@ -1776,9 +1855,9 @@

     /**
      *  @copy flash.text.TextField#getLineIndexAtPoint()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getLineIndexAtPoint(x:Number, y:Number):int
     {
@@ -1787,9 +1866,9 @@

     /**
      *  @copy flash.text.TextField#getLineIndexOfChar()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getLineIndexOfChar(charIndex:int):int
     {
@@ -1798,9 +1877,9 @@

     /**
      *  @copy flash.text.TextField#getLineLength()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getLineLength(lineIndex:int):int
     {
@@ -1809,34 +1888,34 @@

     /**
      *  @copy flash.text.TextField#getLineMetrics()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getLineMetrics(lineIndex:int):TextLineMetrics
     {
     	validateNow();

-    	if ( lineIndex < 0 || lineIndex >= numChildren )
-    		throw new RangeError( "The supplied index is out of bounds" ); // matching TextField behavior
-
-    	var textLine:TextLine = TextLine( getChildAt( lineIndex ) );
+    	if (lineIndex < 0 || lineIndex >= numChildren)
+    		throw new RangeError("The supplied index is out of bounds"); // matching TextField behavior
+
+    	var textLine:TextLine = TextLine(getChildAt(lineIndex));
     	var height:Number;
     	if (lineIndex == this.numChildren - 1)
     	 	height = Number(_defaultTextFormat.size) + 2; /// how to correctly determine "height" here?
     	else
     	{
-	    	var nextTextLine:TextLine = TextLine( getChildAt( lineIndex + 1 ) );
+	    	var nextTextLine:TextLine = TextLine(getChildAt(lineIndex + 1));
     		height = nextTextLine.y - textLine.y;
     	}
-    	return new TextLineMetrics( textLine.x, textLine.width, height, textLine.ascent, textLine.descent, height - textLine.ascent - textLine.descent );
+    	return new TextLineMetrics(textLine.x, textLine.width, height, textLine.ascent, textLine.descent, height - textLine.ascent - textLine.descent);
     }

     /**
      *  @copy flash.text.TextField#getLineOffset()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getLineOffset(lineIndex:int):int
     {
@@ -1845,9 +1924,9 @@

     /**
      *  @copy flash.text.TextField#getLineText()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getLineText(lineIndex:int):String
     {
@@ -1856,9 +1935,9 @@

     /**
      *  @copy flash.text.TextField#getParagraphLength()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getParagraphLength(charIndex:int):int
     {
@@ -1867,9 +1946,9 @@

     /**
      *  @copy flash.text.TextField#getTextFormat()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getTextFormat(beginIndex:int = -1, endIndex:int = -1):TextFormat
     {
@@ -1878,9 +1957,9 @@

     /**
      *  @copy flash.text.TextField#replaceSelectedText()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function replaceSelectedText(value:String):void
     {
@@ -1889,22 +1968,22 @@

     /**
      *  @copy flash.text.TextField#replaceText()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function replaceText(beginIndex:int, endIndex:int,
     							newText:String):void
     {
-    	if ( beginIndex <= endIndex )
-    		text = text.substring( 0, beginIndex ) + newText + text.substring( endIndex );
+    	if (beginIndex <= endIndex)
+    		text = text.substring(0, beginIndex) + newText + text.substring(endIndex);
     }

     /**
      *  @copy flash.text.TextField#setSelection()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function setSelection(beginIndex:int, endIndex:int):void
     {
@@ -1913,9 +1992,9 @@

     /**
      *  @copy flash.text.TextField#setTextFormat()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function setTextFormat(format:TextFormat,
                            		  beginIndex:int = -1,
@@ -1928,9 +2007,9 @@

     /**
      *  @copy flash.text.TextField#getImageReference()
-     * @playerversion Flash 10
-     * @playerversion AIR 1.5
-     * @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @langversion 3.0
      */
     public function getImageReference(id:String):DisplayObject
     {
@@ -1947,18 +2026,24 @@
      *  @private
      */
     private function testFlag(mask:uint):Boolean
-    { return (flags & mask) != 0; }
+    {
+    	return (flags & mask) != 0;
+    }

     /**
      *  @private
      */
     private function setFlag(mask:uint):void
-    { flags |= mask; }
+    {
+    	flags |= mask;
+    }

     private function clearFlag(mask:uint):void
-    { flags &= ~mask; }
-
-    private function setFlagToValue(mask:uint,value:Boolean):void
+    {
+    	flags &= ~mask;
+    }
+
+    private function setFlagToValue(mask:uint, value:Boolean):void
     {
     	if (value)
     		flags |= mask;
@@ -1973,18 +2058,11 @@
      */
     private function invalidate():void
     {
-		CONFIG::debug { assert( !testFlag(FLAG_VALIDATE_IN_PROGRESS), "invalidating during validateNow()"); }
+		//TODO
+		//CONFIG::debug { assert(!testFlag(FLAG_VALIDATE_IN_PROGRESS), "invalidating during validateNow()"); }

     	if (stage)
     		stage.invalidate();
-    }
-
-    static private function rint(x:Number):Number
-    {
-    	var i:Number = Math.round(x);
-    	if ( i - 0.5 == x && i & 1 )
-    		--i;
-    	return i;
     }

     /**
@@ -1996,8 +2074,12 @@
      */
     private function validateNow():void
     {
-    	if ( !testFlag( ALL_INVALIDATION_FLAGS ) || testFlag( FLAG_VALIDATE_IN_PROGRESS) )
+    	if (!testFlag(ALL_INVALIDATION_FLAGS) ||
+    		testFlag(FLAG_VALIDATE_IN_PROGRESS))
+    	{
     		return;
+    	}
+
     	setFlag(FLAG_VALIDATE_IN_PROGRESS);

     	// Determine the TLF formats based on the TextField's defaultTextFormat.
@@ -2005,16 +2087,16 @@
     	{
 			textFormatToTLFFormats();

-			hostContainerFormat.lineBreak = LineBreak.EXPLICIT;
-			hostContainerFormat.paddingLeft = 2;
-			hostContainerFormat.paddingTop = 4;
-			hostContainerFormat.paddingRight = 2;
-			hostContainerFormat.paddingBottom = 2;
+			hostFormat.lineBreak = LineBreak.EXPLICIT;
+			hostFormat.paddingLeft = 2;
+			hostFormat.paddingTop = 4;
+			hostFormat.paddingRight = 2;
+			hostFormat.paddingBottom = 2;
    		}

     	if (testFlag(FLAG_WORD_WRAP_CHANGED))
     	{
-    		hostContainerFormat.lineBreak =
+    		hostFormat.lineBreak =
     			wordWrap ? LineBreak.TO_FIT : LineBreak.EXPLICIT;
     	}

@@ -2052,7 +2134,7 @@
     		}
     	}

-    	clearFlag(ALL_INVALIDATION_FLAGS|FLAG_VALIDATE_IN_PROGRESS);
+    	clearFlag(ALL_INVALIDATION_FLAGS | FLAG_VALIDATE_IN_PROGRESS);
     }

     /**
@@ -2060,36 +2142,81 @@
      */
     private function textFormatToTLFFormats():void
     {
-    	hostParagraphFormat.textAlign = _defaultTextFormat.align ? _defaultTextFormat.align : TextFormatAlign.LEFT;;
-    	hostParagraphFormat.textAlignLast = hostParagraphFormat.textAlign;
+    	hostFormat.textAlign =
+    		_defaultTextFormat.align ?
+    		_defaultTextFormat.align :
+    		TextFormatAlign.LEFT;
+
+    	hostFormat.textAlignLast = hostFormat.textAlign;
+
     	//_defaultTextFormat.blockIndent
-    	hostCharacterFormat.fontWeight = _defaultTextFormat.bold ?
-    								 FontWeight.BOLD :
-    								 FontWeight.NORMAL;
+
+    	hostFormat.fontWeight =
+    		_defaultTextFormat.bold ?
+    		FontWeight.BOLD :
+    		FontWeight.NORMAL;
+
     	//_defaultTextFormat.bullet
-    	hostCharacterFormat.color = _defaultTextFormat.color ? _defaultTextFormat.color : 0;
+
+    	hostFormat.color =
+    		_defaultTextFormat.color ?
+    		_defaultTextFormat.color :
+    		0;
+
     	// TODO: is font value platform-dependent???
-    	hostCharacterFormat.fontFamily = _defaultTextFormat.font ? _defaultTextFormat.font : "Times New Roman";
+    	hostFormat.fontFamily =
+    		_defaultTextFormat.font ?
+    		_defaultTextFormat.font :
+    		"Times New Roman";
+
     	//_defaultTextFormat.indent;
-    	hostCharacterFormat.fontStyle = _defaultTextFormat.italic ?
-    								FontPosture.ITALIC :
-    								FontPosture.NORMAL;
-    	hostCharacterFormat.kerning = _defaultTextFormat.kerning ?
-    							  Kerning.ON :
-    							  Kerning.OFF;
-    	hostCharacterFormat.fontLookup = testFlag(FLAG_EMBED_FONTS) ?
-    								flash.text.engine.FontLookup.EMBEDDED_CFF :
-    								flash.text.engine.FontLookup.DEVICE;
+
+    	hostFormat.fontStyle =
+    		_defaultTextFormat.italic ?
+    		FontPosture.ITALIC :
+    		FontPosture.NORMAL;
+
+    	hostFormat.kerning =
+    		_defaultTextFormat.kerning ?
+    		Kerning.ON :
+    		Kerning.OFF;
+
+    	hostFormat.fontLookup =
+    		testFlag(FLAG_EMBED_FONTS) ?
+    		FontLookup.EMBEDDED_CFF :
+    		FontLookup.DEVICE;
+
     	//_defaultTextFormat.leading
-    	hostParagraphFormat.paragraphStartIndent = _defaultTextFormat.leftMargin ? _defaultTextFormat.leftMargin : 0;
-    	hostCharacterFormat.trackingRight = _defaultTextFormat.letterSpacing? _defaultTextFormat.letterSpacing : 0;
-    	hostParagraphFormat.paragraphEndIndent = _defaultTextFormat.rightMargin ? _defaultTextFormat.rightMargin : 0;
-    	hostCharacterFormat.fontSize = _defaultTextFormat.size ? _defaultTextFormat.size : 12;
-    	hostParagraphFormat.tabStops = _defaultTextFormat.tabStops;
+
+    	hostFormat.paragraphStartIndent =
+    		_defaultTextFormat.leftMargin ?
+    		_defaultTextFormat.leftMargin :
+    		0;
+
+    	hostFormat.trackingRight =
+    		_defaultTextFormat.letterSpacing ?
+    		_defaultTextFormat.letterSpacing :
+    		0;
+
+    	hostFormat.paragraphEndIndent =
+    		_defaultTextFormat.rightMargin ?
+    		_defaultTextFormat.rightMargin :
+    		0;
+
+    	hostFormat.fontSize =
+    		_defaultTextFormat.size ?
+    		_defaultTextFormat.size :
+    		12;
+
+    	hostFormat.tabStops = _defaultTextFormat.tabStops;
+
     	//_defaultTextFormat.target
-    	hostCharacterFormat.textDecoration = _defaultTextFormat.underline ?
-    									 TextDecoration.UNDERLINE :
-    									 TextDecoration.NONE;
+
+    	hostFormat.textDecoration =
+    		_defaultTextFormat.underline ?
+    		TextDecoration.UNDERLINE :
+    		TextDecoration.NONE;
+
     	//textFormat.url
     }

@@ -2110,30 +2237,34 @@

     	_bottomScrollV = 0;

-    	factory.text = _text;
+    	var textFlow:TextFlow = htmlImporter.importToFlow(_htmlText);
+    	trace(r);
+    	textFlow.hostFormat = hostFormat;
+
     	factory.compositionBounds = r;
-    	factory.spanFormat = hostCharacterFormat;
-    	factory.paragraphFormat = hostParagraphFormat;
-    	factory.textFlowFormat = hostContainerFormat;
     	factory.textLineCreator = _textLineCreator;
-    	factory.createTextLines(textLineFactoryCallback);
+    	factory.createTextLines(textLineFactoryCallback, textFlow);

     	if (_bottomScrollV == 0)
     	{
     		_bottomScrollV = 1;
 			_maxScrollV = 1;
     	}
-    	else
+    	else
+    	{
     		_maxScrollV = 1 + (_numLines - _bottomScrollV);
-
-		// NOTE: It is understood that  the Flash TextField clipping of text clips to a margin rect INSET from the TextField's boundary
-		// and that we currently (intentionally) do not match this behavior as a speed/memory optimization.
+    	}
+
+		// NOTE: It is understood that the Flash TextField clipping of text
+		// clips to a margin rect INSET from the TextField's boundary
+		// and that we currently (intentionally) do not match this behavior
+		// as a speed/memory optimization.

 		// Compute bounds of text content
-		var textBounds:Rectangle = new Rectangle(0,0,0,0);
-		if ( numChildren )
+		var textBounds:Rectangle = new Rectangle(0, 0, 0, 0);
+		if (numChildren)
 		{
-			var textLine : TextLine = TextLine(getChildAt(0));
+			var textLine:TextLine = TextLine(getChildAt(0));
 			textBounds.x = textLine.x;
 			textBounds.y = 0; // textLine.y - textLine.textHeight; Not quite right?
 			textBounds.width = textLine.textWidth;
@@ -2141,20 +2272,20 @@
 			for (var i:int = 1; i < numChildren; ++i)
 			{
 				textLine = TextLine(getChildAt(i));
-				var r2:Rectangle = new Rectangle( textLine.x, textLine.y - textLine.textHeight, textLine.textWidth, textLine.textHeight );
-				textBounds = textBounds.union( r2 );
+				var r2:Rectangle = new Rectangle(textLine.x, textLine.y - textLine.textHeight, textLine.textWidth, textLine.textHeight);
+				textBounds = textBounds.union(r2);
 			}
-			if ( !textBounds.isEmpty() )
-				textBounds = textBounds.union( new Rectangle(textBounds.x, 0, textBounds.y, textBounds.bottom) );
+			if (!textBounds.isEmpty())
+				textBounds = textBounds.union(new Rectangle(textBounds.x, 0, textBounds.y, textBounds.bottom));
 		}

     	_textWidth = textBounds.width;
     	_textHeight = textBounds.height + textBounds.y;

-    	if ( _autoSize == TextFieldAutoSize.NONE )
+    	if (_autoSize == TextFieldAutoSize.NONE)
     	{
-	    	_maxScrollH = _textWidth + hostContainerFormat.paddingLeft + hostContainerFormat.paddingRight - width;
-	    	if ( _maxScrollH < 0 )
+	    	_maxScrollH = _textWidth + hostFormat.paddingLeft + hostFormat.paddingRight - width;
+	    	if (_maxScrollH < 0)
 	    		_maxScrollH = 0;
 	    }
 	    else
@@ -2164,23 +2295,23 @@
     		var origWidth:Number = _width;
     		var origHeight:Number = _height;
     		_height = Math.ceil(_textHeight) + 4; // + 4 for standard margin size (possibly revisit this in the future)
-    		if ( !wordWrap )
+    		if (!wordWrap)
     		{
 	    		_width = Math.ceil(_textWidth) + 3; // + 3 for standard margin size (possibly revisit this in the future)

 	    		// adjust x for CENTER and RIGHT cases
-	    		if ( _autoSize == TextFieldAutoSize.RIGHT )
+	    		if (_autoSize == TextFieldAutoSize.RIGHT)
 	    			x += origWidth - _width;
-	    		else if ( _autoSize == TextFieldAutoSize.CENTER )
+	    		else if (_autoSize == TextFieldAutoSize.CENTER)
 	    			x += (origWidth - _width) / 2;
 	    	}
-    		if ( _height != origHeight || _width != origWidth || x != origX )
-				setFlag( FLAG_GRAPHICS_INVALID );
+    		if (_height != origHeight || _width != origWidth || x != origX)
+				setFlag(FLAG_GRAPHICS_INVALID);
     	}

-    	//trace( "textBounds = ("+textBounds.x + "," + textBounds.y + "," + textBounds.right + "," + textBounds.bottom + ")");
-    	//trace( "     r = ("+r.x + "," + r.y + "," + r.right + "," + r.bottom + ")");
+    	//trace("textBounds = ("+textBounds.x + "," + textBounds.y + "," + textBounds.right + "," + textBounds.bottom + ")");
+    	//trace("     r = ("+r.x + "," + r.y + "," + r.right + "," + r.bottom + ")");
     	if (textBounds.left < r.left ||
     	    textBounds.top < r.top ||
     	    textBounds.right > r.right ||
@@ -2192,14 +2323,14 @@
     			r.width += 1;
     			r.height += 1;
     		}
-    		//trace( "clipping to w = " + r.width + ", h = " + r.height );
+    		//trace("clipping to w = " + r.width + ", h = " + r.height);
             scrollRect = r;
     		setFlag(FLAG_SCROLL_RECT_IS_SET );
     	}
     	else
     	{
-    		//trace( "not clipping" );
-			if ( testFlag(FLAG_SCROLL_RECT_IS_SET) )
+    		//trace("not clipping");
+			if (testFlag(FLAG_SCROLL_RECT_IS_SET))
 			{
 	    		scrollRect = null;
 	    		clearFlag(FLAG_SCROLL_RECT_IS_SET);
@@ -2231,7 +2362,7 @@
     	{
     		var textLine:TextLine = TextLine(displayObject);
 	    	addChild(displayObject);
-    		if ( textLine.y <= _height || _autoSize != TextFieldAutoSize.NONE )
+    		if (textLine.y <= _height || _autoSize != TextFieldAutoSize.NONE)
 		    	++_bottomScrollV;
     		else
     			displayObject.visible = false; // hide it
@@ -2250,7 +2381,8 @@
      */
     private function addedToStageHandler(event:Event):void
     {
-    	// having renderHandler attached only while on the stage gives a performance improvement.
+    	// Having renderHandler() attached only while on the stage
+    	// gives a performance improvement.
      	removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
 	   	addEventListener(Event.RENDER, renderHandler);
     	addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);
@@ -2277,3 +2409,4 @@
 }

 }
+


Transferred from the Adobe Open Source Subversion Repository

Revision: 8044
Author:   chaase@adobe.com
Date:     2009-06-22T17:01:54.701660Z

Log Message:
-----------
Final (!) PARB changes for effects.
- renamed ArrayInterpolator to MultiValueInterpolator (and enhanced behavior to handle Vectors as well as Arrays).
- Created new AnimateTransform3D subclass of AnimateTransform (to hold 3D-specific properties/defaults), and moved Move3D, Rotate3D, Scale3D to subclass from this new class.

QE Notes: Change to default value of applyLocalProjection (matches former default on 3D effects, but not default on AnimateTransform).
Doc Notes: None
Bugs: None
Reviewer: Hans
Tests: checkintests, effects cyclone from QE

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/SimpleMotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Move3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Animate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Scale3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/Animation.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransform3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/MotionPath.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/ArrayInterpolator.as" copyfrom-rev="7917" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/MultiValueInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Rotate3D.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/ArrayInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateTransformInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransform.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1283647 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/effects/Move3D.as
+++ frameworks/projects/spark/src/spark/effects/Move3D.as
@@ -14,6 +14,7 @@
 import mx.core.mx_internal;
 import mx.effects.IEffectInstance;

+import spark.effects.animation.MotionPath;
 import spark.effects.supportClasses.AnimateTransformInstance;

 use namespace mx_internal;
@@ -48,7 +49,6 @@
  *  <mx:Move3D
  *    <b>Properties</b>
  *    id="ID"
- *    applyChangesPostLayout="true"
  *    zBy="no default"
  *    zFrom="no default"
  *    zTo="no default"
@@ -62,7 +62,7 @@
  *  @playerversion AIR 1.5
  *  @productversion Flex 4
  */
-public class Move3D extends Move
+public class Move3D extends AnimateTransform3D
 {
     include "../core/Version.as";

@@ -84,27 +84,122 @@
         instanceClass = AnimateTransformInstance;
     }

-    //----------------------------------
-    //  applyChangesPostLayout
-    //----------------------------------
-    [Inspectable(category="General")]
-    /**
-     *  @copy AnimateTransform#applyChangesPostLayout
-     *  The default value for this property is true for 3D effects,
-     *  because the Flex layout system ignores 3D transformation properties.
-     *
-     *  @default true
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    override public function get applyChangesPostLayout():Boolean
-    {
-        return super.applyChangesPostLayout;
-    }
-
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  xBy
+    //----------------------------------
+
+    [Inspectable(category="General", defaultValue="NaN")]
+
+    /**
+     *  Number of pixels by which to modify the x position of the target.
+     *  Values may be negative.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public var xBy:Number;
+
+    //----------------------------------
+    //  xFrom
+    //----------------------------------
+
+    [Inspectable(category="General", defaultValue="NaN")]
+
+    /**
+     *  Initial x position of the target, in pixels.
+     *  If omitted, Flex uses either the value in the starting view state,
+     *  if the effect is playing in a transition, or the current
+     *  value of the target.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public var xFrom:Number;
+
+    //----------------------------------
+    //  xTo
+    //----------------------------------
+
+    [Inspectable(category="General", defaultValue="NaN")]
+
+    /**
+     *  Final x, in pixels.
+     *  If omitted, Flex uses either the value in the starting state,
+     *  if the effect is playing in a state transition, or the current
+     *  value of the target.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public var xTo:Number;
+
+    //----------------------------------
+    //  yBy
+    //----------------------------------
+
+    [Inspectable(category="General", defaultValue="NaN")]
+
+    /**
+     *  Number of pixels by which to modify the y position of the target.
+     *  Values can be negative.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public var yBy:Number;
+
+    //----------------------------------
+    //  yFrom
+    //----------------------------------
+
+    [Inspectable(category="General", defaultValue="NaN")]
+
+    /**
+     *  Initial y position of the target, in pixels.
+     *  If omitted, Flex uses either the value in the start view state,
+     *  if the effect is playing in a transition, or the current
+     *  value of the target.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public var yFrom:Number;
+
+    //----------------------------------
+    //  yTo
+    //----------------------------------
+
+    [Inspectable(category="General", defaultValue="NaN")]
+
+    /**
+     *  Final y position of the target, in pixels.
+     *  If omitted, Flex uses either the value in the end view state,
+     *  if the effect is playing in a transition, or the current
+     *  value of the target.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public var yTo:Number;
+
     //----------------------------------
     //  zBy
     //----------------------------------
@@ -164,6 +259,15 @@
     //
     //--------------------------------------------------------------------------

+    /**
+     * @private
+     */
+    override public function createInstance(target:Object = null):IEffectInstance
+    {
+        motionPaths = new Vector.<MotionPath>();
+        return super.createInstance(target);
+    }
+
     /**
      * @private
      */
@@ -171,10 +275,14 @@
     {
         if (!applyChangesPostLayout)
         {
+            addMotionPath("translationX", xFrom, xTo, xBy);
+            addMotionPath("translationY", yFrom, yTo, yBy);
             addMotionPath("translationZ", zFrom, zTo, zBy);
         }
         else
         {
+            addPostLayoutMotionPath("postLayoutTranslationX", xFrom, xTo, xBy);
+            addPostLayoutMotionPath("postLayoutTranslationY", yFrom, yTo, yBy);
             addPostLayoutMotionPath("postLayoutTranslationZ", zFrom, zTo, zBy);
         }
         super.initInstance(instance);


Fix solution lights not showing properly.


Transferred from the Adobe Open Source Subversion Repository

Revision: 23246
Author:   cframpto@adobe.com
Date:     2011-12-20T17:40:08.069454Z

Log Message:
-----------
Rollback 23243.  If comment followed header it was stripped as well.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1267703 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/containers/Panel.as
+++ frameworks/projects/mx/src/mx/containers/Panel.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2004-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////

 package mx.containers
 {


Branch merge

Branch merge

--- as3/xobjas3/src/com/rpath/xobj/XObjXMLDecoder.as
+++ as3/xobjas3/src/com/rpath/xobj/XObjXMLDecoder.as
@@ -430,12 +430,12 @@
         // then FLUSH the array/collection to ensure uniqueness of results
         if (isRootNode || !XObjUtils.isByReference(result))
         {
-            if (isArray)
+            if (isArray && (result as Array).length > 0)
             {
                 trace("flushing array");
                 (result as Array).splice(0);
             }
-            else if (isCollection)
+            else if (isCollection && (result as IList).length > 0)
             {
                 trace("flushing collection");
                 (result as IList).removeAll();


add initComplete event sort of like creationComplete in current Flex SDK

--- frameworks/as/src/org/apache/flex/core/ViewBase.as
+++ frameworks/as/src/org/apache/flex/core/ViewBase.as
@@ -22,6 +22,7 @@
 	import org.apache.flex.events.Event;
 	import org.apache.flex.utils.MXMLDataInterpreter;

+	[Event(name="initComplete", type="org.apache.flex.events.Event")]
 	[DefaultProperty("mxmlContent")]
 	public class ViewBase extends UIBase
 	{
@@ -40,6 +41,8 @@

 			MXMLDataInterpreter.generateMXMLProperties(this, MXMLProperties);
 			MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
+
+			dispatchEvent(new Event("initComplete"))
 		}

 		public function get MXMLDescriptor():Array


Transferred from the Adobe Open Source Subversion Repository

Revision: 5099
Author:   gauravj@adobe.com
Date:     2009-02-27T03:43:02.639229Z

Log Message:
-----------
Update action script files with asdoc version tags.

QE Notes: None.
Doc Notes: Please review and update as necessary.
tests: checkintests

Modified Paths:
--------------
147 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1274679 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/rpc/src/mx/utils/HexEncoder.as
+++ frameworks/projects/rpc/src/mx/utils/HexEncoder.as
@@ -152,6 +152,11 @@
     /*
         '0', '1', '2', '3', '4', '5', '6', '7',
         '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     private static const UPPER_CHAR_CODES:Array =
     [
@@ -162,6 +167,11 @@
     /*
         '0', '1', '2', '3', '4', '5', '6', '7',
         '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     private static const LOWER_CHAR_CODES:Array =
     [


patch from makc - https://github.com/yonatan/volumetrics/pull/1

--- src/org/zozuar/volumetrics/EffectContainer.as
+++ src/org/zozuar/volumetrics/EffectContainer.as
@@ -65,9 +65,11 @@
         protected var _bufferSize:uint = 0x8000;
         protected var _bufferWidth:uint;
         protected var _bufferHeight:uint;
+        protected var _bufferRect:Rectangle = new Rectangle;
         protected var _viewportWidth:uint;
         protected var _viewportHeight:uint;
         protected var _mtx:Matrix = new Matrix;
+        protected var _zero:Point = new Point;

         /**
         * Creates a new effect container.
@@ -126,6 +128,8 @@
             _bufferBmd         = new BitmapData(_bufferWidth, _bufferHeight, false, 0);
             _occlusionLoResBmd = new BitmapData(_bufferWidth, _bufferHeight, true, 0);
             _occlusionLoResBmp = new Bitmap(_occlusionLoResBmd);
+            _bufferRect.height = _bufferHeight;
+            _bufferRect.width  = _bufferWidth;
         }

         /**
@@ -149,7 +153,7 @@
             _mtx.translate(-tx, -ty);
             _mtx.scale(s, s);
             _mtx.translate(tx, ty);
-            _applyEffect(_baseBmd, _bufferBmd, _mtx, passes);
+            _applyEffect(_baseBmd, _bufferRect, _bufferBmd, _mtx, passes);
             _lightBmp.bitmapData = _baseBmd;
             _lightBmp.width = _viewportWidth;
             _lightBmp.height = _viewportHeight;
@@ -162,7 +166,7 @@
         protected function _drawLoResEmission():void {
             _copyMatrix(_emission.transform.matrix, _mtx);
             _mtx.scale(_bufferWidth / _viewportWidth, _bufferHeight / _viewportHeight);
-            _baseBmd.fillRect(_baseBmd.rect, 0);
+            _baseBmd.fillRect(_bufferRect, 0);
             _baseBmd.draw(_emission, _mtx, colorIntegrity ? null : _ct);
         }

@@ -170,7 +174,7 @@
         * Draws a scaled-down occlusion on _occlusionLoResBmd and erases it from _baseBmd.
         */
         protected function _eraseLoResOcclusion():void {
-            _occlusionLoResBmd.fillRect(_occlusionLoResBmd.rect, 0);
+            _occlusionLoResBmd.fillRect(_bufferRect, 0);
             _copyMatrix(_occlusion.transform.matrix, _mtx);
             _mtx.scale(_bufferWidth / _viewportWidth, _bufferHeight / _viewportHeight);
             _occlusionLoResBmd.draw(_occlusion, _mtx);
@@ -196,19 +200,20 @@
         * bitmaps and its mtx argument.
         *
         * @param bmd The BitmapData to apply the effect on.
+        * @param rect BitmapData rectangle.
         * @param buffer Another BitmapData object for temporary storage. Must be the same size as bmd.
         * @param mtx Effect matrix.
         * @param passes Number of passes to make.
         */
-        protected function _applyEffect(bmd:BitmapData, buffer:BitmapData, mtx:Matrix, passes:uint):void {
+        protected function _applyEffect(bmd:BitmapData, rect:Rectangle, buffer:BitmapData, mtx:Matrix, passes:uint):void {
             while(passes--) {
-                if(colorIntegrity) bmd.colorTransform(bmd.rect, _halve);
-                buffer.copyPixels(bmd, bmd.rect, bmd.rect.topLeft);
+                if(colorIntegrity) bmd.colorTransform(rect, _halve);
+                buffer.copyPixels(bmd, rect, _zero);
                 bmd.draw(buffer, mtx, null, BlendMode.ADD, null, true);
                 mtx.concat(mtx);
             }
-            if(colorIntegrity) bmd.colorTransform(bmd.rect, _ct);
-            if(blur) bmd.applyFilter(bmd, bmd.rect, bmd.rect.topLeft, _blurFilter);
+            if(colorIntegrity) bmd.colorTransform(rect, _ct);
+            if(blur) bmd.applyFilter(bmd, rect, _zero, _blurFilter);
         }

         /**


Add tags menu for editUIElement

Add tags menu for editUIElement

--- bin/Data/Scripts/Editor/EditorInspectorWindow.as
+++ bin/Data/Scripts/Editor/EditorInspectorWindow.as
@@ -702,26 +702,47 @@
 void HandleTagsSelect(StringHash eventType, VariantMap& eventData)
 {
     UIElement@ tagSelect = eventData["Element"].GetPtr();
-
-    if (editNode !is null)
-    {
-        Array<UIElement@> actions;
-        String Indicator = "* ";
-
+    Array<UIElement@> actions;
+    String Indicator = "* ";
+    // In first priority changes to UIElement
+    if (editUIElement !is null)
+    {
+        // 1. Add established tags from current editable UIElement to menu
+        Array<String> elementTags = editUIElement.tags;
+        for (int i =0; i < elementTags.length; i++)
+        {
+            bool isHasTag = editUIElement.HasTag(elementTags[i]);
+            String taggedIndicator = (isHasTag ? Indicator : "");
+            actions.Push(CreateContextMenuItem(taggedIndicator + elementTags[i], "HandleTagsMenuSelection", elementTags[i]));
+        }
+
+        // 2. Add default tags
+        Array<String> stdTags = defaultTags.Split(';');
+        for (int i=0; i < stdTags.length; i++)
+        {
+            bool isHasTag = editUIElement.HasTag(stdTags[i]);
+            // Add this tag into menu if only Node not tadded with it yet, otherwise it showed on step 1.
+            if (!isHasTag)
+            {
+                String taggedIndicator = (isHasTag ? Indicator : "");
+                actions.Push(CreateContextMenuItem(taggedIndicator + stdTags[i], "HandleTagsMenuSelection", stdTags[i]));
+            }
+        }
+    }
+    else if (editNode !is null)
+    {
         // 1. Add established tags from Node to menu
         Array<String> nodeTags = editNode.tags;
-
         for (int i =0; i < nodeTags.length; i++)
         {
             bool isHasTag = editNode.HasTag(nodeTags[i]);
             String taggedIndicator = (isHasTag ? Indicator : "");
             actions.Push(CreateContextMenuItem(taggedIndicator + nodeTags[i], "HandleTagsMenuSelection", nodeTags[i]));
         }
-
-        Array<String> sceneTags = editorScene.tags;
-
+
+        Array<String> sceneTags = editorScene.tags;
         // 2. Add tags from Scene.tags (In this scenario Scene.tags used as storage for frequently used tags in current Scene only)
-        for (int i =0; i < sceneTags.length; i++)
+        for (int i =0; i < sceneTags.length; i++)
         {
             bool isHasTag = editNode.HasTag(sceneTags[i]);
             String taggedIndicator = (isHasTag ? Indicator : "");
@@ -730,68 +751,78 @@

         // 3. Add default tags
         Array<String> stdTags = defaultTags.Split(';');
-        for (int i=0; i<stdTags.length; i++)
+        for (int i=0; i<stdTags.length; i++)
         {
             bool isHasTag = editNode.HasTag(stdTags[i]);
             // Add this tag into menu if only Node not tadded with it yet, otherwise it showed on step 1.
-            if (!isHasTag)
+            if (!isHasTag)
             {
                 String taggedIndicator = (isHasTag ? Indicator : "");
                 actions.Push(CreateContextMenuItem(taggedIndicator + stdTags[i], "HandleTagsMenuSelection", stdTags[i]));
             }
         }
-
+    }
+
+    // if any action has been added, add also Reset and Cancel and show menu
+    if (actions.length > 0)
+    {
         actions.Push(CreateContextMenuItem("Reset", "HandleTagsMenuSelection", "Reset"));
         actions.Push(CreateContextMenuItem("Cancel", "HandleTagsMenuSelectionDivisor"));
+        ActivateContextMenu(actions);
+    }
+
+}
+void HandleTagsMenuSelectionDivisor()
+{
+    //do nothing
+}
+void HandleTagsMenuSelection()
+{
+    Menu@ menu = GetEventSender();
+    if (menu is null)
+        return;
+
+    String menuSelectedTag = menu.name;
+
+    // In first priority changes to UIElement
+    if (editUIElement !is null)
+    {
+        if (menuSelectedTag == "Reset")
+        {
+            editUIElement.RemoveAllTags();
+            UpdateAttributeInspector();
+            return;
+        }

-        if (actions.length > 0)
-        {
-            ActivateContextMenu(actions);
-        }
-    }
-}
-void HandleTagsMenuSelectionDivisor()
-{
-    //do nothing
-}
-void HandleTagsMenuSelection()
-{
-    if (editNode !is null)
-    {
-        Menu@ menu = GetEventSender();
-        if (menu is null)
-            return;
-
-        String menuSelectedTag = menu.name;
-        bool isThisDeleteOp = input.keyDown[KEY_LALT];
-
+        if (!editUIElement.HasTag(menuSelectedTag))
+        {
+            editUIElement.AddTag(menuSelectedTag.Trimmed());
+        }
+        else
+        {
+            editUIElement.RemoveTag(menuSelectedTag.Trimmed());
+        }
+    }
+    else if (editNode !is null)
+    {
         if (menuSelectedTag == "Reset")
         {
             editNode.RemoveAllTags();
             UpdateAttributeInspector();
             return;
         }
-
-        if (isThisDeleteOp)
-        {
-            if (editNode.HasTag(menuSelectedTag))
-            {
-                editNode.RemoveTag(menuSelectedTag.Trimmed());
-            }
+
+        if (!editNode.HasTag(menuSelectedTag))
+        {
+            editNode.AddTag(menuSelectedTag.Trimmed());
         }
         else
         {
-            if (!editNode.HasTag(menuSelectedTag))
-            {
-                editNode.AddTag(menuSelectedTag.Trimmed());
-            }
-            else
-            {
-                editNode.RemoveTag(menuSelectedTag.Trimmed());
-            }
-        }
-        UpdateAttributeInspector();
-    }
+            editNode.RemoveTag(menuSelectedTag.Trimmed());
+        }
+    }
+
+    UpdateAttributeInspector();
 }

 /// Handle reset to default event, sent when reset icon in the icon-panel is clicked.


Whitespace tinkering.

Whitespace tinkering.


Added explicit import.

Added explicit import.

--- flash/org/windmill/TestCase.as
+++ flash/org/windmill/TestCase.as
@@ -17,10 +17,12 @@
 package org.windmill {
   import flash.display.Sprite;
   import flash.display.Stage;
+  import org.windmill.Windmill;
   import org.windmill.WMAssert;
   import org.windmill.WMWait;
   import org.windmill.astest.ASTest;
   public class TestCase extends Sprite {
+    public var windmill:* = Windmill;
     public var asserts:* = WMAssert;
     public var waits:* = WMWait;
     public var controller:* = ASTest.wrappedControllerMethods;


Simplified and improved DataSourceTreeNode using ColumnTreeNode.

Change-Id: Ib8f6e2ab3eb3efbee11d5bc37d63002ce2fb947e

--- WeaveData/src/weave/data/hierarchy/DataSourceTreeNode.as
+++ WeaveData/src/weave/data/hierarchy/DataSourceTreeNode.as
@@ -18,90 +18,61 @@
 */
 package weave.data.hierarchy
 {
-    import flash.utils.Dictionary;
-
     import weave.api.core.ILinkableHashMap;
     import weave.api.core.ILinkableObject;
     import weave.api.data.ColumnMetadata;
     import weave.api.data.IAttributeColumn;
     import weave.api.data.IDataSource;
-    import weave.api.data.IWeaveTreeNode;
-    import weave.api.detectLinkableObjectChange;
     import weave.api.registerLinkableChild;
     import weave.data.AttributeColumns.CSVColumn;
     import weave.data.AttributeColumns.EquationColumn;

-	[RemoteClass]
-    public class DataSourceTreeNode implements IWeaveTreeNode, ILinkableObject
+    public class DataSourceTreeNode extends ColumnTreeNode implements ILinkableObject
     {
+		public static const GLOBAL_COLUMN_METADATA_NAME:String = 'name';
+
 		public function DataSourceTreeNode()
 		{
-			registerLinkableChild(this, WeaveAPI.globalHashMap.childListCallbacks);
-		}
-
-		private var _dataSourceToNode:Dictionary = new Dictionary(true);
-
-		// the node can re-use the same children array
-		private const _childNodes:Array = [];
-
-		public function equals(other:IWeaveTreeNode):Boolean
-		{
-			return other is DataSourceTreeNode;
-		}
-
-		public function getLabel():String
-		{
-			return lang("Data Sources");
-		}
-
-		public function isBranch():Boolean
-		{
-			return true;
-		}
-
-		public function hasChildBranches():Boolean
-		{
-			return true;
-		}
-
-		public function getChildren():Array
-		{
-			// data sources
-			var dataSources:Array = WeaveAPI.globalHashMap.getObjects(IDataSource);
-			for (var i:int = 0; i < dataSources.length; i++)
-			{
-				var ds:IDataSource = dataSources[i];
-
-				if (!_dataSourceToNode[ds])
-					registerLinkableChild(this, ds);
-
-				if (detectLinkableObjectChange(getChildren, ds))
-					_dataSourceToNode[ds] = ds.getHierarchyRoot();
-
-				_childNodes[i] = _dataSourceToNode[ds];
-			}
-			_childNodes.length = dataSources.length;
-
-			// global columns
-			var _root:ILinkableHashMap = WeaveAPI.globalHashMap;
-			var eqCols:Array = _root.getObjects(EquationColumn).concat(_root.getObjects(CSVColumn));
-			if (eqCols.length)
-			{
-				var eqCategory:XML = <category title={ lang("Equations") }/>;
-				for each (var col:IAttributeColumn in eqCols)
-					eqCategory.appendChild(<attribute name={ _root.getName(col) } title={ col.getMetadata(ColumnMetadata.TITLE) }/>);
-				_globalColumnNode.xml = eqCategory;
-				_childNodes.push(_globalColumnNode);
-			}
-
-			return _childNodes;
-		}
-
-		private var _globalColumnNode:XMLEntityNode = new XMLEntityNode();
-
-		public function dispose():void
-		{
-			_childNodes.length = 0;
+			var rootNode:DataSourceTreeNode = this;
+			var root:ILinkableHashMap = WeaveAPI.globalHashMap;
+			registerLinkableChild(this, root.childListCallbacks);
+			super({
+				source: rootNode,
+				label: lang('Data Sources'),
+				isBranch: true,
+				hasChildBranches: true,
+				children: function():Array {
+					var nodes:Array = root.getObjects(IDataSource).map(
+						function(ds:IDataSource, ..._):* {
+							registerLinkableChild(rootNode, ds);
+							return ds.getHierarchyRoot();
+						}
+					);
+					var columns:Array = root.getObjects(EquationColumn).concat(root.getObjects(CSVColumn));
+					if (columns.length)
+						nodes.push({
+							source: root.childListCallbacks,
+							label: lang("Equations"),
+							isBranch: true,
+							hasChildBranches: false,
+							children: columns.map(
+								function(column:IAttributeColumn, ..._):* {
+									registerLinkableChild(rootNode, column);
+									var meta:Object = {};
+									meta[GLOBAL_COLUMN_METADATA_NAME] = root.getName(column);
+									return {
+										source: column,
+										label: function():String {
+											return column.getMetadata(ColumnMetadata.TITLE);
+										},
+										columnMetadata: meta
+									};
+								}
+							)
+						});
+					return nodes;
+				}
+			});
 		}
     }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 19980
Author:   chiedozi@adobe.com
Date:     2011-01-27T19:46:02.128372Z

Log Message:
-----------
TabbedViewNavigator now disables the TabBar when a child navigator is changing views
TabbedViewNavigator now enforces its tabBar skinpart to have its requireSelection property be true
Removed an unnecessary  validateNow from TabbedViewNavigator
Resolved some TODOs and FIXMEs

QE notes:
Doc notes:
Bugs:
Reviewer: Jason San Jose
Tests run:
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigator.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/managers/PersistenceManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorApplicationBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/NavigationStack.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ViewNavigator.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1264542 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as
+++ frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as
@@ -8,7 +8,7 @@
 //  in accordance with the terms of the license agreement accompanying it.
 //
 ////////////////////////////////////////////////////////////////////////////////
-// TODO (chiedozi): Make private talk to QE
+
 package spark.components.supportClasses
 {
 import flash.utils.IDataInput;


Now invalidating parent after child entity creation

--- WeaveAdmin/src/weave/services/Admin.as
+++ WeaveAdmin/src/weave/services/Admin.as
@@ -354,11 +354,13 @@
 			service.addHook(
 				service.newEntity,
 				null,
-				function(event:ResultEvent, token:Object):void
+				function(event:ResultEvent, user0_pass1_type2_meta3_parent4_index5:Array):void
 				{
 					var id:int = int(event.result);
 					focusEntityId = id;
 					entityCache.invalidate(id);
+					var parentId:int = user0_pass1_type2_meta3_parent4_index5[4];
+					entityCache.invalidate(parentId);
 				}
 			);


Updated StackedAreaLayout to set axis scales on each invocation

git-svn-id: 6aa7ccb0a2048310a30f08a72aaff4ca39d980ed@202 91848ab2-c4ae-4e4f-8e6a-6a52ea0dccc3

--- flare/src/flare/vis/operator/layout/StackedAreaLayout.as
+++ flare/src/flare/vis/operator/layout/StackedAreaLayout.as
@@ -1,6 +1,5 @@
 package flare.vis.operator.layout
 {
-	import flare.animate.Transitioner;
 	import flare.scale.LinearScale;
 	import flare.scale.OrdinalScale;
 	import flare.scale.QuantitativeScale;
@@ -38,6 +37,7 @@
 		private var _threshold:Number = 1.0;

 		private var _scale:QuantitativeScale = new LinearScale(0,0,10,true);
+		private var _colScale:Scale;

 		/** Array containing the column names. */
 		public function get columns():Array { return _columns; }
@@ -45,6 +45,7 @@
 			_columns = Arrays.copy(cols);
 			_peaks = new Array(cols.length);
 			_poly = new Array(cols.length);
+			_colScale = getScale(_columns);
 		}

 		/** Flag indicating if the visualization should be normalized. */
@@ -90,36 +91,9 @@
 		 */
 		public function StackedAreaLayout(cols:Array=null, padding:Number=0.05)
 		{
-			if(cols != null){
-				_columns =  Arrays.copy(cols);
-				_peaks = new Array(cols.length);
-				_poly = new Array(cols.length);
-			}
 			layoutType = CARTESIAN;
-
+			if (cols != null) this.columns = cols;
 			this.padding = padding;
-		}
-
-		/** @inheritDoc */
-		public override function setup():void
-		{
-			initializeAxes();
-		}
-
-		/**
-		 * Initializes the axes prior to layout.
-		 */
-		protected function initializeAxes():void
-		{
-			if (!_initAxes || visualization==null) return;
-
-			var axes:CartesianAxes = super.xyAxes;
-			var axis1:Axis = _horiz ? axes.xAxis : axes.yAxis;
-			var axis2:Axis = _horiz ? axes.yAxis : axes.xAxis;
-
-			axis1.axisScale = _scale;
-			axis2.showLines = false;
-			axis2.axisScale = getScale(_columns);
 		}

 		private static function getScale(cols:Array):Scale
@@ -133,6 +107,30 @@
 				case Stats.OBJECT:
 				default:
 					return new OrdinalScale(stats.distinctValues, true, false);
+			}
+		}
+
+		/** @inheritDoc */
+		public override function setup():void
+		{
+			if (!_initAxes || visualization==null) return;
+			initializeAxes();
+			(_horiz ? xyAxes.yAxis : xyAxes.xAxis).showLines = false;
+		}
+
+		/**
+		 * Initializes the axes prior to layout.
+		 */
+		protected function initializeAxes():void
+		{
+			if (!_initAxes || visualization==null) return;
+			var axes:CartesianAxes = xyAxes;
+			if (_horiz) {
+				axes.xAxis.axisScale = _scale;
+				axes.yAxis.axisScale = _colScale;
+			} else {
+				axes.xAxis.axisScale = _colScale;
+				axes.yAxis.axisScale = _scale;
 			}
 		}

@@ -156,6 +154,7 @@

 			// perform first walk to get the data distribution
 	        _scale.dataMax = peaks();
+	        initializeAxes();

 	        // initialize current polygon
 	        var axes:CartesianAxes = super.xyAxes;


Transferred from the Adobe Open Source Subversion Repository

Revision: 15675
Author:   klin@adobe.com
Date:     2010-04-23T22:00:42.744815Z

Log Message:
-----------
Merge from 4.x to trunk.

Fix for http://bugs.adobe.com/jira/browse/SDK-26267. Embedded assets were depending on AdvancedLayoutFeatures and other framework classes. This caused a simple AS-only swf size to be quite large, and even fail to build in an AS-only project in FB. The fixes are:

-Softlink FlexVersion using hasDefinition/getDefinition. This gets rid of the dependency on the ResourceManager, which fixes the compile error in FB.
-Introduce a new interface, IAssetLayoutFeatures, which contains a subset of the API from AdvancedLayoutFeatures only used by the asset classes. AdvancedLayoutFeatures implements this interface. The interface also removes the API dependency on TransformOffsets.
-We can then softlink AdvancedLayoutFeatures and MatrixUtil to remove that dependency.
-Use the hardcoded string "ltr" instead of the constant LayoutDirection.LTR to remove the dependency on LayoutDirection.

All of these fixes bring swf size down to near the original (around 2k more in the reference case).

QE notes: No
Doc notes: No
Bugs: SDK-26267
Reviewer: Alex, Carol
Tests run: checkintests, Mirroring
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" copyfrom-path="/flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/core/IAssetLayoutFeatures.as" copyfrom-rev="15674" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/IAssetLayoutFeatures.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/SpriteAsset.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/BitmapAsset.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/AdvancedLayoutFeatures.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1259722 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/core/SpriteAsset.as
+++ frameworks/projects/framework/src/mx/core/SpriteAsset.as
@@ -14,10 +14,8 @@

 import flash.display.DisplayObjectContainer;
 import flash.events.Event;
-import flash.geom.Matrix;
-
-import mx.core.AdvancedLayoutFeatures;
-import mx.utils.MatrixUtil;
+import flash.geom.Point;
+import flash.system.ApplicationDomain;

 /**
  *  SpriteAsset is a subclass of the flash.display.Sprite class which
@@ -100,6 +98,11 @@
 {
     include "../core/Version.as";

+    // Softlink FlexVersion and MatrixUtil to remove dependencies of embeds on
+    // framework classes. This helps to reduce swf size in AS-only projects.
+    private static var FlexVersionClass:Class;
+    private static var MatrixUtilClass:Class;
+
     //--------------------------------------------------------------------------
     //
     //  Constructor
@@ -122,7 +125,14 @@
         _measuredWidth = width;
         _measuredHeight = height;

-        if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
+        if (FlexVersionClass == null)
+        {
+            var appDomain:ApplicationDomain = ApplicationDomain.currentDomain;
+            if (appDomain.hasDefinition("mx.core::FlexVersion"))
+                FlexVersionClass = Class(appDomain.getDefinition("mx.core::FlexVersion"));
+        }
+
+        if (FlexVersionClass && FlexVersionClass["compatibilityVersion"] >= FlexVersionClass["VERSION_4_0"])
             this.addEventListener(Event.ADDED, addedHandler);
     }

@@ -132,7 +142,10 @@
     //
     //--------------------------------------------------------------------------

-    private var layoutFeatures:AdvancedLayoutFeatures;
+    // Softlink AdvancedLayoutFeatures to remove dependencies of embeds on
+    // framework classes. This helps to reduce swf size in AS-only projects.
+    private var layoutFeaturesClass:Class;
+    private var layoutFeatures:IAssetLayoutFeatures;

     //--------------------------------------------------------------------------
     //
@@ -244,9 +257,15 @@
      */
     override public function get width():Number
     {
+        if (layoutFeatures == null)
+            return super.width;
+
         // Return bounding box width in mirroring case
-        return (layoutFeatures == null) ? super.width :
-               MatrixUtil.transformSize(layoutFeatures.layoutWidth, _height, transform.matrix).x;
+        var p:Point;
+        if (MatrixUtilClass != null)
+            p = MatrixUtilClass["transformSize"](layoutFeatures.layoutWidth, _height, transform.matrix);
+
+        return p ? p.x : super.width;
     }

     /**
@@ -283,9 +302,16 @@
      */
     override public function get height():Number
     {
+
+        if (layoutFeatures == null)
+            return super.height;
+
         // Return bounding box height in mirroring case
-        return (layoutFeatures == null) ? super.height :
-               MatrixUtil.transformSize(layoutFeatures.layoutWidth, _height, transform.matrix).y;
+        var p:Point;
+        if (MatrixUtilClass != null)
+            p = MatrixUtilClass["transformSize"](layoutFeatures.layoutWidth, _height, transform.matrix);
+
+        return p ? p.y : super.height;
     }

     /**
@@ -528,7 +554,9 @@
     //  layoutDirection
     //----------------------------------

-    private var _layoutDirection:String = LayoutDirection.LTR;
+    // Use "ltr" instead of LayoutDirection.LTR to avoid depending
+    // on that framework class.
+    private var _layoutDirection:String = "ltr";

     [Inspectable(category="General", enumeration="ltr,rtl")]

@@ -660,8 +688,11 @@
                 if (mirror && layoutFeatures == null)
                 {
                     initAdvancedLayoutFeatures();
-                    layoutFeatures.mirror = mirror;
-                    validateTransformMatrix();
+                    if (layoutFeatures != null)
+                    {
+                        layoutFeatures.mirror = mirror;
+                        validateTransformMatrix();
+                    }
                 }
                 else if (!mirror && layoutFeatures)
                 {
@@ -721,20 +752,39 @@
      */
     private function initAdvancedLayoutFeatures():void
     {
-        var features:AdvancedLayoutFeatures = new AdvancedLayoutFeatures();
-
-        features.layoutScaleX = scaleX;
-        features.layoutScaleY = scaleY;
-        features.layoutScaleZ = scaleZ;
-        features.layoutRotationX = rotationX;
-        features.layoutRotationY = rotationY;
-        features.layoutRotationZ = rotation;
-        features.layoutX = x;
-        features.layoutY = y;
-        features.layoutZ = z;
-        features.layoutWidth = width;  // for the mirror transform
-        _height = height;  // for backing storage
-        layoutFeatures = features;
+        // Get AdvancedLayoutFeatures if it exists.
+        if (layoutFeaturesClass == null)
+        {
+            var appDomain:ApplicationDomain = ApplicationDomain.currentDomain;
+
+            if (appDomain.hasDefinition("mx.core::AdvancedLayoutFeatures"))
+                layoutFeaturesClass = Class(appDomain.getDefinition("mx.core::AdvancedLayoutFeatures"));
+
+            // Get MatrixUtil class if it exists
+            if (MatrixUtilClass == null)
+            {
+                if (appDomain.hasDefinition("mx.utils::MatrixUtil"))
+                    MatrixUtilClass = Class(appDomain.getDefinition("mx.utils::MatrixUtil"));
+            }
+        }
+
+        if (layoutFeaturesClass != null)
+        {
+            var features:IAssetLayoutFeatures = new layoutFeaturesClass();
+
+            features.layoutScaleX = scaleX;
+            features.layoutScaleY = scaleY;
+            features.layoutScaleZ = scaleZ;
+            features.layoutRotationX = rotationX;
+            features.layoutRotationY = rotationY;
+            features.layoutRotationZ = rotation;
+            features.layoutX = x;
+            features.layoutY = y;
+            features.layoutZ = z;
+            features.layoutWidth = width;  // for the mirror transform
+            _height = height;  // for backing storage
+            layoutFeatures = features;
+        }
     }

     /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 11751
Author:   clucier@adobe.com
Date:     2009-11-12T22:28:38.657563Z

Log Message:
-----------
Setting a transform matrix would always invalidate and cause an update.  If you were setting a transform matrix in upateDisplayList, you'd end up in a continuous update loop.  Added logic to early exit (and not invalidate) when the newly set matrix is identical to the existing.

QE notes: None
Doc notes: None
Bugs: SDK-22807
Reviewer: Evtim
Tests run: Checkin
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/core/SpriteVisualElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/GraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/MatrixUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1259918 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/core/UIComponent.as
+++ frameworks/projects/framework/src/mx/core/UIComponent.as
@@ -12200,11 +12200,14 @@
      */
     public function setLayoutMatrix(value:Matrix, invalidateLayout:Boolean):void
     {
+        var previousMatrix:Matrix = _layoutFeatures ?
+            _layoutFeatures.layoutMatrix : super.transform.matrix;
+
         // validateMatrix when switching between 2D/3D, works around player bug
         // see sdk-23421
         var was3D:Boolean = is3D;
-
         _hasComplexLayoutMatrix = true;
+
         if (_layoutFeatures == null)
         {
             // flash will make a copy of this on assignment.
@@ -12218,6 +12221,16 @@
             invalidateTransform();
         }

+        // Early exit if possible. We don't want to invalidate unnecessarily.
+        // We need to do the check here, after our new value has been applied
+        // because our matrix components are rounded upon being applied to a
+        // DisplayObject.
+        if (MatrixUtil.isEqual(previousMatrix, _layoutFeatures ?
+            _layoutFeatures.layoutMatrix : super.transform.matrix))
+        {
+            return;
+        }
+
         invalidateProperties();

         if (invalidateLayout)
@@ -12238,6 +12251,10 @@
      */
     public function setLayoutMatrix3D(value:Matrix3D, invalidateLayout:Boolean):void
     {
+        // Early exit if possible. We don't want to invalidate unnecessarily.
+        if (_layoutFeatures && MatrixUtil.isEqual3D(_layoutFeatures.layoutMatrix3D, value))
+            return;
+
         // validateMatrix when switching between 2D/3D, works around player bug
         // see sdk-23421
         var was3D:Boolean = is3D;