Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

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

--- frameworks/projects/mx/src/mx/controls/MenuBar.as
+++ frameworks/projects/mx/src/mx/controls/MenuBar.as
@@ -0,0 +1,1987 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2003-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.controls
+{
+
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.FocusEvent;
+import flash.events.KeyboardEvent;
+import flash.events.MouseEvent;
+import flash.geom.Point;
+import flash.geom.Rectangle;
+import flash.ui.Keyboard;
+import flash.xml.XMLNode;
+import mx.collections.ArrayCollection;
+import mx.collections.ICollectionView;
+import mx.collections.XMLListCollection;
+import mx.collections.errors.ItemPendingError;
+import mx.containers.ApplicationControlBar;
+import mx.controls.menuClasses.IMenuBarItemRenderer;
+import mx.controls.menuClasses.IMenuDataDescriptor;
+import mx.controls.menuClasses.MenuBarItem;
+import mx.controls.treeClasses.DefaultDataDescriptor;
+import mx.core.ClassFactory;
+import mx.core.EventPriority;
+import mx.core.FlexVersion;
+import mx.core.IFactory;
+import mx.core.IFlexDisplayObject;
+import mx.core.IUIComponent;
+import mx.core.mx_internal;
+import mx.core.UIComponent;
+import mx.core.UIComponentGlobals;
+import mx.events.CollectionEvent;
+import mx.events.CollectionEventKind;
+import mx.events.FlexEvent;
+import mx.events.MenuEvent;
+import mx.managers.IFocusManagerComponent;
+import mx.managers.ISystemManager;
+import mx.styles.CSSStyleDeclaration;
+import mx.styles.ISimpleStyleClient;
+import mx.styles.StyleManager;
+import mx.styles.StyleProxy;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when selection changes as a result of user
+ *  interaction.
+ *  This event is also dispatched when the user changes
+ *  the current menu selection in a pop-up submenu.
+ *  When the event occurs on the menu bar,
+ *  the menu property of the MenuEvent object is null.
+ *  When it occurs in a pop-up submenu, the menu property
+ *  contains a reference to the Menu object that represents the
+ *  the pop-up submenu.
+ *
+ *  @eventType mx.events.MenuEvent.CHANGE
+ */
+[Event(name="change", type="mx.events.MenuEvent")]
+
+/**
+ *  Dispatched when the user selects an item in a pop-up submenu.
+ *
+ *  @eventType mx.events.MenuEvent.ITEM_CLICK
+ */
+[Event(name="itemClick", type="mx.events.MenuEvent")]
+
+/**
+ *  Dispatched when a pop-up submenu closes.
+ *
+ *  @eventType mx.events.MenuEvent.MENU_HIDE
+ */
+[Event(name="menuHide", type="mx.events.MenuEvent")]
+
+/**
+ *  Dispatched when a pop-up submenu opens, or the
+ *  user selects a menu bar item with no drop-down menu.
+ *
+ *  @eventType mx.events.MenuEvent.MENU_SHOW
+ */
+[Event(name="menuShow", type="mx.events.MenuEvent")]
+
+/**
+ *  Dispatched when the mouse pointer rolls out of a menu item.
+ *
+ *  @eventType mx.events.MenuEvent.ITEM_ROLL_OUT
+ */
+[Event(name="itemRollOut", type="mx.events.MenuEvent")]
+
+/**
+ *  Dispatched when the mouse pointer rolls over a menu item.
+ *
+ *  @eventType mx.events.MenuEvent.ITEM_ROLL_OVER
+ */
+[Event(name="itemRollOver", type="mx.events.MenuEvent")]
+
+//--------------------------------------
+//  Styles
+//--------------------------------------
+
+include "../styles/metadata/FocusStyles.as"
+include "../styles/metadata/LeadingStyle.as"
+include "../styles/metadata/SkinStyles.as"
+include "../styles/metadata/TextStyles.as"
+
+/**
+ *  Alpha level of the color defined by the backgroundColor
+ *  property.
+ *  Valid values range from 0.0 to 1.0.
+ *  @default 1.0
+ */
+[Style(name="backgroundAlpha", type="Number", inherit="no", deprecatedReplacement="menuStyleName", deprecatedSince="3.0")]
+
+/**
+ *  Background color of the component.
+ *  The default value is undefined, which means it is not
+ *  set and the component has a transparent background.
+ *
+ *
The default skins of most Flex controls are partially transparent.
+ *  As a result, the background color of a container partially "bleeds through"
+ *  to controls that are in that container.
+ *  You can avoid this by setting the alpha values of the control's
+ *  fillAlphas property to 1, as the following example shows:
+ *

+ *

+ *  <mx:Container backgroundColor="0x66CC66"/>
+ *      <mx:ControlName ... fillAlphas="[1,1]"/>
+ *  </mx:Container>
+ *

+ */
+[Style(name="backgroundColor", type="uint", format="Color", inherit="no", deprecatedReplacement="menuStyleName", deprecatedSince="3.0")]
+
+/**
+ *  The background skin of the MenuBar control.
+ *
+ *  @default mx.skins.halo.MenuBarBackgroundSkin
+ */
+[Style(name="backgroundSkin", type="Class", inherit="no")]
+
+/**
+ *  The default skin for a MenuBar item
+ *
+ *  @default mx.skins.halo.ActivatorSkin
+ */
+[Style(name="itemSkin", type="Class", inherit="no", states="up, over, down")]
+
+/**
+ *  The skin when a MenuBar item is not selected.
+ *
+ *  @default mx.skins.halo.ActivatorSkin
+ */
+[Style(name="itemUpSkin", type="Class", inherit="no")]
+
+/**
+ *  The skin when focus is over a MenuBar item either.
+ *
+ *  @default mx.skins.halo.ActivatorSkin
+ */
+[Style(name="itemOverSkin", type="Class", inherit="no")]
+
+/**
+ *  The skin when a MenuBar item is selected.
+ *
+ *  @default mx.skins.halo.ActivatorSkin
+ */
+[Style(name="itemDownSkin", type="Class", inherit="no")]
+
+/**
+ *  Name of the CSSStyleDeclaration that specifies the styles for
+ *  the Menu controls displayed by this MenuBar control.
+ *  By default, the Menu controls use the MenuBar control's
+ *  inheritable styles.
+ *
+ *
You can use this class selector to set the values of all the style properties
+ *  of the Menu class, including backgroundAlpha and backgroundColor.

+ *
+ *  @default undefined
+ */
+[Style(name="menuStyleName", type="String", inherit="no")]
+
+
+/**
+ *  @copy mx.controls.Menu#style:rollOverColor
+ */
+[Style(name="rollOverColor", type="uint", format="Color", inherit="yes")]
+
+/**
+ *  @copy mx.controls.Menu#style:selectionColor
+ */
+[Style(name="selectionColor", type="uint", format="Color", inherit="yes")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+[AccessibilityClass(implementation="mx.accessibility.MenuBarAccImpl")]
+
+[DefaultBindingProperty(destination="dataProvider")]
+
+[DefaultProperty("dataProvider")]
+
+[DefaultTriggerEvent("change")]
+
+[IconFile("MenuBar.png")]
+
+[RequiresDataBinding(true)]
+
+/**
+ *  A MenuBar control defines a horizontal, top-level menu bar that contains
+ *  one or menu items. Clicking on a top-level menu item opens a pop-up submenu
+ *  that is an instance of the Menu control.
+ *
+ *
The top-level menu bar of the MenuBar control is generally always visible.
+ *  It is not intended for use as a pop-up menu. The individual submenus
+ *  pop up as the user selects them with the mouse or keyboard. Open submenus
+ *  disappear when a menu item is selected, or if the menu is dismissed by the
+ *  user clicking outside the menu.

+ *
+ *
For information and an example on the attributes that you can use
+ *  in the data provider for the MenuBar control, see the Menu control.

+ *
+ *
The MenuBar control has the following sizing characteristics:
+ *

+ *

+ *

+ *           Characteristic
+ *           Description
+ *

+ *

+ *           Default size
+ *           The width is determined from the menu text, with a
+ *               minimum value of 27 pixels for the width. The default
+ *               value for the height is 22 pixels.
+ *

+ *

+ *
+ *  @mxml
+ *

+ *  The <mx:MenuBar&gt tag inherits all of the tag attributes of its superclass, and
+ *  adds the following tag attributes:
+ *

+ *
+ *

+ *  <mx:MenuBar
+ *    Properties
+ *    dataDescriptor="mx.controls.treeClasses.DefaultDataDescriptor"
+ *    dataProvider="undefined"
+ *    iconField="icon"
+ *    labelField="label"
+ *    labelFunction="undefined"
+ *    menuBarItemRenderer="mx.controls.menuClasses.MenuBarItem"
+ *    menuBarItems="[]"
+ *    menus="[]"
+ *    selectedIndex="-1"
+ *    showRoot="true"
+ *
+ *    Styles
+ *    backgroundSkin="mx.skins.halo.MenuBarBackgroundSkin"
+ *    borderColor="0xAAB3B3"
+ *    color="0x0B333C"
+ *    cornerRadius="0"
+ *    disabledColor="0xAAB3B3"
+ *    fillAlphas="[0.6,0.4]"
+ *    fillColors="[0xFFFFFF, 0xCCCCCC]"
+ *    focusAlpha="0.5"
+ *    focusRoundedCorners="tl tr bl br"
+ *    fontAntiAliasType="advanced|normal"
+ *    fontFamily="Verdana"
+ *    fontGridFitType="pixel|none|subpixel"
+ *    fontSharpness="0"
+ *    fontSize="10"
+ *    fontStyle="normal|italic"
+ *    fontThickness="0"
+ *    fontWeight="normal|bold"
+ *    highlightAlphas="[0.3,0.0]"
+ *    itemDownSkin="mx.skins.halo.ActivatorSkin"
+ *    itemOverSkin="mx.skins.halo.ActivatorSkin"
+ *    itemUpSkin="mx.skins.halo.ActivatorSkin"
+ *    leading="2"
+ *    menuStyleName="No default"
+ *    rollOverColor="0xB2E1FF"
+ *    selectionColor="0x7FCEFF"
+ *    textAlign="left"
+ *    textDecoration="none"
+ *    textIndent="0"
+ *
+ *    Events
+ *    itemClick="No default"
+ *    itemRollOut="No default"
+ *    itemRollOver="No default"
+ *    menuHide="No default"
+ *    menuShow="No default"
+ *  />
+ *

+ *

+ *
+ *  @see mx.controls.Menu
+ *  @see mx.controls.PopUpMenuButton
+ *  @see mx.controls.menuClasses.IMenuBarItemRenderer
+ *  @see mx.controls.menuClasses.MenuBarItem
+ *  @see mx.controls.menuClasses.IMenuDataDescriptor
+ *  @see mx.controls.treeClasses.DefaultDataDescriptor
+ *
+ *  @includeExample examples/MenuBarExample.mxml
+ *
+ */
+public class MenuBar extends UIComponent implements IFocusManagerComponent
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class constants
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private static const MARGIN_WIDTH:int = 10;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class mixins
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Placeholder for mixin by MenuBarAccImpl.
+     */
+    mx_internal static var createAccessibilityImplementation:Function;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor
+     */
+    public function MenuBar()
+    {
+        super();
+        menuBarItemRenderer = new ClassFactory(MenuBarItem);
+        tabChildren = false;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Storage variable for the original dataProvider
+     */
+    mx_internal var _rootModel:ICollectionView;
+
+    /**
+     *  @private
+     */
+    private var isDown:Boolean;
+
+    /**
+     *  @private
+     */
+    private var inKeyDown:Boolean = false;
+
+    /**
+     *  @private
+     */
+    private var background:IFlexDisplayObject;
+
+    /**
+     *  @private
+     *  This menu bar could be inside an ApplicationControlBar (ACB).
+     */
+    private var isInsideACB:Boolean = false;
+
+    /**
+     *  @private
+     */
+    private var supposedToLoseFocus:Boolean = false;
+
+    /**
+     *  @private
+     */
+    private var dataProviderChanged:Boolean = false;
+
+    /**
+     *  @private
+     */
+    private var iconFieldChanged:Boolean = false;
+
+        /**
+     *  @private
+     */
+    private var menuBarItemRendererChanged:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  baselinePosition
+    //----------------------------------
+
+    /**
+     *  @private
+     *  The baselinePosition of a MenuBar is calculated
+     *  for its first MenuBarItem.
+     */
+    override public function get baselinePosition():Number
+    {
+        if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
+            return super.baselinePosition;
+
+        if (!validateBaselinePosition())
+            return NaN;
+
+        if (menuBarItems.length == 0)
+            return super.baselinePosition;
+
+        var menuBarItem0:IUIComponent = menuBarItems[0] as IUIComponent;
+        if (!menuBarItem0)
+            return super.baselinePosition;
+
+        validateNow();
+
+        return menuBarItem0.y + menuBarItem0.baselinePosition;
+    }
+
+    //--------------------------------------------------------------------------
+    // enabled
+    //--------------------------------------------------------------------------
+
+    [Inspectable(category="General", enumeration="true,false", defaultValue="true")]
+
+    /**
+     *  @private
+     */
+    override public function set enabled(value:Boolean):void
+    {
+        super.enabled = value;
+
+        if (menuBarItems)
+        {
+            var n:int = menuBarItems.length;
+            for (var i:int = 0; i < n; i++)
+            {
+                menuBarItems[i].enabled = value;
+            }
+        }
+    }
+
+    //----------------------------------
+    //  showInAutomationHierarchy
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    override public function set showInAutomationHierarchy(value:Boolean):void
+    {
+        //do not allow value changes
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  dataDescriptor
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    mx_internal var _dataDescriptor:IMenuDataDescriptor =
+        new DefaultDataDescriptor();
+
+    [Inspectable(category="Data")]
+
+    /**
+     *  The object that accesses and manipulates data in the data provider.
+     *  The MenuBar control delegates to the data descriptor for information
+     *  about its data. This data is then used to parse and move about the
+     *  data source. The data descriptor defined for the MenuBar is used for
+     *  all child menus and submenus.
+     *
+     *
When you specify this property as an attribute in MXML, you must
+     *  use a reference to the data descriptor, not the string name of the
+     *  descriptor. Use the following format for setting the property:

+     *
+     *
<mx:MenuBar id="menubar" dataDescriptor="{new MyCustomDataDescriptor()}"/>

+     *
+     *
Alternatively, you can specify the property in MXML as a nested
+     *  subtag, as the following example shows:

+     *
+     *
<mx:MenuBar>
+     *  <mx:dataDescriptor>
+     *     <myCustomDataDescriptor>
+     *  </mx:dataDescriptor>
+     *  ...

+     *
+     *
The default value is an internal instance of the
+     *  DefaultDataDescriptor class.

+     */
+    public function get dataDescriptor():IMenuDataDescriptor
+    {
+        return IMenuDataDescriptor(_dataDescriptor);
+    }
+
+    /**
+     *  @private
+     */
+    public function set dataDescriptor(value:IMenuDataDescriptor):void
+    {
+        _dataDescriptor = value;
+
+        //force all the menus to be re-created with the new dataDescriptor
+        menus = [];
+    }
+
+    //----------------------------------
+    //  dataProvider
+    //----------------------------------
+
+    [Bindable("collectionChange")]
+    [Inspectable(category="Data")]
+
+    /**
+     *  The hierarchy of objects that are displayed as MenuBar items and menus.
+     *  The top-level children all become MenuBar items, and their children
+     *  become the items in the menus and submenus.
+     *
+     *  The MenuBar control handles the source data object as follows:
+     *

+     *

+     *
A String containing valid XML text is converted to an XML object.

+     *
An XMLNode is converted to an XML object.

+     *
An XMLList is converted to an XMLListCollection.

+     *
Any object that implements the ICollectionView interface is cast to
+     *  an ICollectionView.

+     *
An Array is converted to an ArrayCollection.

+     *
Any other type object is wrapped in an Array with the object as its sole
+     *  entry.

+     *

+     *

+     *
+     *  @default "undefined"
+     */
+    public function get dataProvider():Object
+    {
+        if (_rootModel)
+        {
+            return _rootModel;
+        }
+        else return null;
+    }
+
+    /**
+     *  @private
+     */
+    public function set dataProvider(value:Object):void
+    {
+        if (_rootModel)
+        {
+            _rootModel.removeEventListener(CollectionEvent.COLLECTION_CHANGE,
+                                           collectionChangeHandler);
+        }
+
+        // handle strings and xml
+        if (typeof(value)=="string")
+            value = new XML(value);
+        else if (value is XMLNode)
+            value = new XML(XMLNode(value).toString());
+        else if (value is XMLList)
+            value = new XMLListCollection(value as XMLList);
+
+        if (value is XML)
+        {
+            _hasRoot = true;
+            var xl:XMLList = new XMLList();
+            xl += value;
+            _rootModel = new XMLListCollection(xl);
+        }
+        //if already a collection dont make new one
+        else if (value is ICollectionView)
+        {
+            _rootModel = ICollectionView(value);
+            if (_rootModel.length == 1)
+                _hasRoot = true;
+        }
+        else if (value is Array)
+        {
+            _rootModel = new ArrayCollection(value as Array);
+        }
+        //all other types get wrapped in an ArrayCollection
+        else if (value is Object)
+        {
+            _hasRoot = true;
+            // convert to an array containing this one item
+            var tmp:Array = [];
+            tmp.push(value);
+            _rootModel = new ArrayCollection(tmp);
+        }
+        else
+        {
+            _rootModel = new ArrayCollection();
+        }
+        //add listeners as weak references
+        _rootModel.addEventListener(CollectionEvent.COLLECTION_CHANGE,
+                                    collectionChangeHandler, false, 0, true);
+        //flag for processing in commitProps
+        dataProviderChanged = true;
+        invalidateProperties();
+
+        var event:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+        event.kind = CollectionEventKind.RESET;
+        collectionChangeHandler(event);
+        dispatchEvent(event);
+    }
+
+    //----------------------------------
+    //  hasRoot
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Flag to indicate if the model has a root
+     */
+    mx_internal var _hasRoot:Boolean = false;
+
+    /**
+     *  @copy mx.controls.Menu#hasRoot
+     */
+    public function get hasRoot():Boolean
+    {
+        return _hasRoot;
+    }
+
+    //----------------------------------
+    //  iconField
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for iconField property.
+     */
+    private var _iconField:String = "icon";
+
+    [Bindable("iconFieldChanged")]
+    [Inspectable(category="Other", defaultValue="icon")]
+
+    /**
+     *  The name of the field in the data provider that determines the
+     *  icon to display for each menu item. By default, the MenuBar does not
+     *  try to display icons along with the text in a menu item. By specifying
+     *  an icon field, you can define a graphic that is created
+     *  and displayed as an icon for a menu item.
+     *
+     *
The MenuItemRenderer examines
+     *  the data provider for a property of the name defined
+     *  by the iconField property.  If the value of the property is a Class, it
+     *  instantiates that class and expects it to be an instance of
+     *  IFlexDisplayObject. If the value of the property is a String, it
+     *  looks to see if a Class exists with that name in the application, and if
+     *  it cannot find one, it looks for a property on the document
+     *  with that name and expects that property to map to a Class.

+     *
+     *  @default "icon"
+     */
+    public function get iconField():String
+    {
+        return _iconField;
+    }
+
+    /**
+     *  @private
+     */
+    public function set iconField(value:String):void
+    {
+        if (_iconField != value)
+        {
+            iconFieldChanged = true;
+            _iconField = value;
+            invalidateProperties();
+            dispatchEvent(new Event("iconFieldChanged"));
+        }
+    }
+
+    //----------------------------------
+    //  labelField
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _labelField:String = "label";
+
+    [Bindable("labelFieldChanged")]
+    [Inspectable(category="Data", defaultValue="label")]
+
+    /**
+     *  The name of the field in the data provider that determines the
+     *  text to display for each menu item. If the data provider is an Array of
+     *  Strings, Flex uses each string value as the label. If the data
+     *  provider is an E4X XML object, you must set this property explicitly.
+     *  For example, use @label to specify the label attribute in an E4X XML Object
+     *  as the text to display for each menu item.
+     *
+     *  Setting the labelFunction property overrides this property.
+     *
+     *  @default "label"
+     */
+    public function get labelField():String
+    {
+        return _labelField;
+    }
+
+    /**
+     *  @private
+     */
+    public function set labelField(value:String):void
+    {
+        if (_labelField != value)
+        {
+            _labelField = value;
+            dispatchEvent(new Event("labelFieldChanged"));
+        }
+    }
+
+    //----------------------------------
+    //  labelFunction
+    //----------------------------------
+
+    [Inspectable(category="Data")]
+
+    /**
+     *  The function that determines the text to display for each menu item.
+     *  The label function must find the appropriate field or fields in the
+     *  data provider and return a displayable string.
+     *
+     *  If you omit this property, Flex uses the contents of the field or
+     *  attribute specified by the labelField property.
+     *  If you specify this property, Flex ignores any labelField
+     *  property value.
+     *
+     *  The labelFunction property is good for handling formatting
+     *  and localization.
+     *
+     *
The label function must take a single argument which is the item
+     *  in the data provider and return a String.

+     *

+     *  myLabelFunction(item:Object):String

+     *
+     *  @default "undefined"
+     */
+    public var labelFunction:Function;
+
+    //----------------------------------
+    //  menuBarItemRenderer
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the menuBarItemRenderer property.
+     */
+    private var _menuBarItemRenderer:IFactory;
+
+    [Bindable("menuBarItemRendererChanged")]
+    [Inspectable(category="Data")]
+
+     /**
+     *  The item renderer used by the MenuBar control for
+     *  the top-level menu bar of the MenuBar control.
+     *
+     *
You can define an item renderer for the pop-up submenus
+     *  of the MenuBar control.
+     *  Because each pop-up submenu is an instance of the Menu control,
+     *  you use the class MenuItemRenderer to define an item renderer
+     *  for the pop-up submenus.
+     *  To set the item renderer for a pop-up submenu, access the Menu object using
+     *  the menus property.

+     *
+     *  @default "mx.controls.menuClasses.MenuBarItem"
+     *
+     *  @see mx.controls.menuClasses.MenuBarItem
+     */
+    public function get menuBarItemRenderer():IFactory
+    {
+        return _menuBarItemRenderer;
+    }
+
+    /**
+     * @private
+     */
+    public function set menuBarItemRenderer(value:IFactory):void
+    {
+        if (_menuBarItemRenderer != value)
+        {
+            _menuBarItemRenderer = value;
+
+            menuBarItemRendererChanged = true;
+            invalidateProperties();
+            dispatchEvent(new Event("menuBarItemRendererChanged"));
+        }
+    }
+
+    //----------------------------------
+    //  menuBarItems
+    //----------------------------------
+
+    /**
+     *  An Array that contains the MenuBarItem objects that render
+     *  each item in the top-level menu bar of a MenuBar control. By default,
+     *  this property contains instances of the MenuBarItem class.
+     *
+     *  Items should not be added directly to the menuBarItems array. To
+     *  add new menubar items, add them directly to the MenuBar control's
+     *  data provider.
+     *
+     *  @default [ ]
+     *
+     *  @see mx.controls.menuClasses.MenuBarItem
+     */
+    public var menuBarItems:Array = [];
+
+    //----------------------------------
+    //  menuBarItemStyleFilters
+    //----------------------------------
+
+    /**
+     *  The set of styles to pass from the MenuBar to the menuBar items.
+     *  @see mx.styles.StyleProxy
+     *  @review
+     */
+    protected function get menuBarItemStyleFilters():Object
+    {
+        return _menuBarItemStyleFilters;
+    }
+
+    private static var _menuBarItemStyleFilters:Object = null;
+
+    //----------------------------------
+    //  menus
+    //----------------------------------
+
+    /**
+     *  An Array containing the Menu objects corresponding to the
+     *  pop-up submenus of this MenuBar control.
+     *  Each MenuBar item can have a corresponding Menu object in the Array,
+     *  even if the item does not have a pop-up submenu.
+     *  Flex does not initially populate the menus array;
+     *  instead, it creates the menus dynamically, as needed.
+     *
+     *  Items should not be added directly to the menus Array. To
+     *  add new drop-down menus, add directly to the MenuBar
+     *  control's data provider.
+     *
+     *  @default [ ]
+     */
+    public var menus:Array = [];
+
+    //----------------------------------
+    //  selectedIndex
+    //----------------------------------
+
+    /**
+     *  @private
+     *  The index of the currently open menu item, or -1 if none is open.
+     */
+    private var openMenuIndex:int = -1;
+
+    [Bindable("valueCommit")]
+    [Inspectable(category="General", defaultValue="-1")]
+
+    /**
+     *  The index in the MenuBar control of the currently open Menu
+     *  or the last opened Menu if none are currently open.
+     *
+     *  @default -1
+     */
+    public function get selectedIndex():int
+    {
+        return openMenuIndex;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectedIndex(value:int):void
+    {
+        openMenuIndex = value;
+        dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
+    }
+
+    //----------------------------------
+    //  showRoot
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage variable for showRoot flag.
+     */
+    mx_internal var _showRoot:Boolean = true;
+
+    /**
+     *  @private
+     */
+    mx_internal var showRootChanged:Boolean = false;
+
+    [Inspectable(category="Data", enumeration="true,false", defaultValue="false")]
+
+    /**
+     *  A Boolean flag that specifies whether to display the data provider's
+     *  root node.
+     *
+     *  If the data provider has a root node, and the showRoot property
+     *  is set to false, the items on the MenuBar control correspond to
+     *  the immediate descendants of the root node.
+     *
+     *  This flag has no effect on data providers without root nodes,
+     *  like Lists and Arrays.
+     *
+     *  @default true
+     *  @see #hasRoot
+     */
+    public function get showRoot():Boolean
+    {
+        return _showRoot;
+    }
+
+    /**
+     *  @private
+     */
+    public function set showRoot(value:Boolean):void
+    {
+        if (_showRoot != value)
+        {
+            showRootChanged = true;
+            _showRoot = value;
+            invalidateProperties();
+        }
+    }
+
+    //------------------------------------------------------------------------
+    //
+    //  Overridden methods
+    //
+    //------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function initializeAccessibility():void
+    {
+        if (MenuBar.createAccessibilityImplementation != null)
+            MenuBar.createAccessibilityImplementation(this);
+    }
+
+
+    /**
+     *  @private
+     */
+    override protected function createChildren():void
+    {
+        super.createChildren();
+
+        // Check if this MenuBar is inside an ACB.
+        for (var p:Object = parent; p; p = p.parent)
+        {
+            if (p is ApplicationControlBar)
+            {
+                isInsideACB = true;
+                break;
+            }
+        }
+
+        updateBackground();
+    }
+
+    /**
+     *  Updates the MenuBar control's background skin.
+     *
+     *  This method is called when MenuBar children are created or when
+     *  any styles on the MenuBar changes.
+     */
+    protected function updateBackground():void
+    {
+        if (isInsideACB)
+        {
+            // draw translucent menubar
+            setStyle("translucent", true);
+        }
+        else
+        {
+            // Remove existing background
+            if (background)
+            {
+                removeChild(DisplayObject(background));
+                background = null;
+            }
+
+            var backgroundSkinClass:Class = getStyle("backgroundSkin");
+            background = new backgroundSkinClass();
+            if (background is ISimpleStyleClient)
+                ISimpleStyleClient(background).styleName = this;
+            addChildAt(DisplayObject(background), 0);
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override protected function commitProperties():void
+    {
+        var i:int;
+
+        if (showRootChanged)
+        {
+            if (!_hasRoot)
+                showRootChanged = false;
+        }
+
+        if (dataProviderChanged || showRootChanged)
+        {
+            var tmpCollection:ICollectionView;
+
+            //reset flags
+            dataProviderChanged = false;
+            showRootChanged = false;
+
+            // are we swallowing the root?
+            if (_rootModel && !_showRoot && _hasRoot)
+            {
+                var rootItem:* = _rootModel.createCursor().current;
+                if (rootItem != null &&
+                    _dataDescriptor.isBranch(rootItem, _rootModel) &&
+                    _dataDescriptor.hasChildren(rootItem, _rootModel))
+                {
+                    // then get rootItem children
+                    tmpCollection =
+                        _dataDescriptor.getChildren(rootItem, _rootModel);
+                }
+            }
+            //make top level items
+            removeAll();
+            if (_rootModel)
+            {
+                if (!tmpCollection)
+                    tmpCollection = _rootModel;
+                // not really a default handler, but we need to
+                // be later than the wrapper
+                tmpCollection.addEventListener(CollectionEvent.COLLECTION_CHANGE,
+                                                  collectionChangeHandler,
+                                                  false,
+                                                  EventPriority.DEFAULT_HANDLER, true);
+
+                var collectionLength:int = tmpCollection.length;
+                for (i = 0; i < collectionLength; i++)
+                {
+                    try
+                    {
+                        insertMenuBarItem(i, tmpCollection[i]);
+                    }
+                    catch(e:ItemPendingError)
+                    {
+                        //we probably dont need to actively recover from here
+                    }
+                }
+            }
+        }
+
+        if (iconFieldChanged || menuBarItemRendererChanged)
+        {
+            //reset flag
+            iconFieldChanged = false;
+            menuBarItemRendererChanged = false;
+
+            removeAll();
+            if (_rootModel)
+            {
+                if (!tmpCollection)
+                    tmpCollection = _rootModel;
+
+                for (i = 0; i < tmpCollection.length; i++)
+                {
+                    try
+                    {
+                        insertMenuBarItem(i, tmpCollection[i]);
+                    }
+                    catch(e:ItemPendingError)
+                    {
+                        //we probably dont need to actively recover from here
+                    }
+                }
+            }
+        }
+
+        super.commitProperties();
+    }
+
+    /**
+     *  Calculates the preferred width and height of the MenuBar based on the
+     *  default widths of the MenuBar items.
+     */
+    override protected function measure():void
+    {
+        super.measure();
+
+        var len:int = menuBarItems.length;
+
+        measuredWidth = 0;
+
+        // measured height is at least 22
+        measuredHeight = DEFAULT_MEASURED_MIN_HEIGHT;
+        for (var i:int = 0; i < len; i++)
+        {
+            measuredWidth += menuBarItems[i].getExplicitOrMeasuredWidth();
+            measuredHeight = Math.max(
+                    measuredHeight, menuBarItems[i].getExplicitOrMeasuredHeight());
+        }
+
+        if (len > 0)
+            measuredWidth += 2 * MARGIN_WIDTH;
+        else // else give it a default width, MARGIN_WIDTH = 10.
+            measuredWidth = DEFAULT_MEASURED_MIN_WIDTH; // setting it slightly more than the width
+
+        measuredMinWidth = measuredWidth;
+        measuredMinHeight = measuredHeight;
+    }
+
+    /**
+     *  @private
+     *  Sizes and positions the items on the MenuBar.
+     */
+    override protected function updateDisplayList(unscaledWidth:Number,
+                                                  unscaledHeight:Number):void
+    {
+        super.updateDisplayList(unscaledWidth, unscaledHeight);
+
+        var lastX:Number = MARGIN_WIDTH;
+        var lastW:Number = 0;
+        var len:int = menuBarItems.length;
+
+        var clipContent:Boolean = false;
+        var hideItems:Boolean = (unscaledWidth == 0 || unscaledHeight == 0);
+
+        for (var i:int = 0; i < len; i++)
+        {
+            var item:IMenuBarItemRenderer = menuBarItems[i];
+
+            item.setActualSize(item.getExplicitOrMeasuredWidth(), unscaledHeight);
+            item.visible = !hideItems;
+
+            lastX = item.x = lastX+lastW;
+            lastW = item.width;
+
+            if (!hideItems &&
+                (item.getExplicitOrMeasuredHeight() > unscaledHeight ||
+                 (lastX + lastW) > unscaledWidth))
+            {
+                clipContent = true;
+            }
+        }
+
+        if (background)
+        {
+            background.setActualSize(unscaledWidth, unscaledHeight);
+            background.visible = !hideItems;
+        }
+
+        // Set a scroll rect to handle clipping.
+        scrollRect = clipContent ? new Rectangle(0, 0,
+                unscaledWidth, unscaledHeight) : null;
+    }
+
+    //------------------------------------------------------------------------
+    //  Focus handling
+    //------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function focusInHandler(event:FocusEvent):void
+    {
+        super.focusInHandler(event);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function focusOutHandler(event:FocusEvent):void
+    {
+        super.focusOutHandler(event);
+
+        if (supposedToLoseFocus)
+            getMenuAt(openMenuIndex).hide();
+
+        supposedToLoseFocus = false;
+    }
+
+    //------------------------------------------------------------------------
+    //  Support for setStyle
+    //------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override public function styleChanged(styleProp:String):void
+    {
+        var i:int;
+        super.styleChanged(styleProp);
+
+        var n:int = menuBarItems.length;
+        for (i = 0; i < n; i++)
+        {
+            getMenuAt(i).styleChanged(styleProp);
+        }
+
+        if (!styleProp || styleProp == "" || styleProp == "backgroundSkin")
+        {
+            updateBackground();
+        }
+
+        if (styleProp == null ||
+            styleProp == "styleName" ||
+            styleProp == "menuStyleName")
+        {
+            var menuStyleName:String = getStyle("menuStyleName");
+            var m:Menu;
+            if (menuStyleName)
+            {
+                if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
+                {
+                    var styleDecl:CSSStyleDeclaration =
+                        StyleManager.getStyleDeclaration("." + menuStyleName);
+
+                    if (styleDecl)
+                    {
+                        for (i = 0; i < menus.length; i++)
+                        {
+                            m = menus[i];
+                            m.styleDeclaration = styleDecl;
+                            m.regenerateStyleCache(true);
+                        }
+                    }
+                 }
+                 else
+                 {
+                    for (i = 0; i < menus.length; i++)
+                    {
+                        m = menus[i];
+                        m.styleName = menuStyleName;
+                    }
+                 }
+            }
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override public function notifyStyleChangeInChildren(
+                                styleProp:String,
+                                recursive:Boolean):void
+    {
+        super.notifyStyleChangeInChildren(styleProp, recursive);
+
+        var n:int = menuBarItems.length;
+        for (var i:int = 0; i < n; i++)
+        {
+            getMenuAt(i).notifyStyleChangeInChildren(styleProp, recursive);
+        }
+    }
+
+    //------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function collectionChangeHandler(event:Event):void
+    {
+        //trace("[MenuBar] caught Model changed");
+        if (event is CollectionEvent)
+        {
+            var ce:CollectionEvent = CollectionEvent(event);
+            if (ce.kind == CollectionEventKind.ADD)
+            {
+                dataProviderChanged = true;
+                invalidateProperties();
+                //trace("[MenuBar] add event");
+            }
+            else if (ce.kind == CollectionEventKind.REMOVE)
+            {
+                dataProviderChanged = true;
+                invalidateProperties();
+                //trace("[MenuBar] remove event at:", ce.location);
+            }
+            else if (ce.kind == CollectionEventKind.REFRESH)
+            {
+                dataProviderChanged = true;
+                dataProvider = dataProvider; //start over
+                invalidateProperties();
+                invalidateSize();
+                //trace("[MenuBar] refresh event");
+            }
+            else if (ce.kind == CollectionEventKind.RESET)
+            {
+                dataProviderChanged = true;
+                invalidateProperties();
+                invalidateSize();
+                //trace("[MenuBar] reset event");
+            }
+            else if (ce.kind == CollectionEventKind.UPDATE)
+            {
+                //As long as there are no open menus, we can
+                //handle the update. Otherwise we create new
+                //menubar items and submenus in commitProperties
+                //and run the risk of orphaning the already open
+                //menu.
+                if (openMenuIndex == -1)
+                {
+                    dataProviderChanged = true;
+                    invalidateProperties();
+                }
+            }
+        }
+
+        //bItemsSizeChanged = true;
+        invalidateDisplayList();
+    }
+
+    /**
+     *  @private
+     */
+    private function eventHandler(event:Event):void
+    {
+        //these events come from the menu's themselves.
+        //we'll redispatch all of them.
+        if (event is MenuEvent)
+        {
+            var t:String = event.type;
+
+            if (event.type == MenuEvent.MENU_HIDE &&
+                MenuEvent(event).menu == menus[openMenuIndex])
+            {
+                menuBarItems[openMenuIndex].menuBarItemState = "itemUpSkin";
+                openMenuIndex = -1;
+                dispatchEvent(event as MenuEvent);
+            }
+            else
+                dispatchEvent(event);
+        }
+    }
+
+    /**
+     *  @private
+     *
+     *  Adds a menu to the MenuBar control at the specified location.
+     *  An index of 0 inserts the menu at the leftmost spot in the MenuBar.
+     *
+     *  @param index Index where the menu should be inserted.
+     *  @param arg1 May be either:a String, which is the item's label; or an xmlNode.
+     *  @param arg2 May be: undefined; a menu; or an xml/xmlNode.
+     */
+    private function addMenuAt(index:int, arg1:Object, arg2:Object = null):void
+    {
+        if (!dataProvider)
+            dataProvider = {};
+
+        var newMenu:Menu;
+        var mdp:Object;
+        var newItem:Object = arg1;
+
+        insertMenuBarItem(index, mdp);
+    }
+
+    /**
+     *  @copy mx.controls.listClasses.ListBase#itemToLabel()
+     */
+    public function itemToLabel(data:Object):String
+    {
+        if (data == null)
+            return " ";
+
+        if (labelFunction != null)
+            return labelFunction(data);
+
+        if (data is XML)
+        {
+            try
+            {
+                if (data[labelField].length() != 0)
+                    data = data[labelField];
+
+                //if (XMLList(data.@label).length() != 0)
+                //{
+                //  data = data.@label;
+                //}
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        else if (data is Object)
+        {
+            try
+            {
+                if (data[labelField] != null)
+                    data = data[labelField];
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        else if (data is String)
+            return String(data);
+
+        try
+        {
+            return data.toString();
+        }
+        catch(e:Error)
+        {
+        }
+
+        return " ";
+    }
+
+     /**
+     *  Returns the class for an icon, if any, for a data item,
+     *  based on the iconField property.
+     *  The field in the item can return a string as long as that
+     *  string represents the name of a class in the application.
+     *  The field in the item can also be a string that is the name
+     *  of a variable in the document that holds the class for
+     *  the icon.
+     *
+     *  @param data The item from which to extract the icon class
+     *  @return The icon for the item, as a class reference or
+     *  null if none.
+     */
+    public function itemToIcon(data:Object):Class
+    {
+        if (data == null)
+        {
+            return null;
+        }
+        var iconClass:Class;
+        var icon:*;
+
+        if (data is XML)
+        {
+            try
+            {
+                if (data[iconField].length() != 0)
+                {
+                   icon = String(data[iconField]);
+                   if (icon != null)
+                   {
+                       iconClass =
+                            Class(systemManager.getDefinitionByName(icon));
+                       if (iconClass)
+                           return iconClass;
+
+                       return document[icon];
+                   }
+                }
+            }
+            catch(e:Error)
+            {
+            }
+        }
+
+        else if (data is Object)
+        {
+            try
+            {
+                if (data[iconField] != null)
+                {
+                    if (data[iconField] is Class)
+                    {
+                        return data[iconField];
+                    }
+                    if (data[iconField] is String)
+                    {
+                        iconClass = Class(systemManager.getDefinitionByName(
+                                                data[iconField]));
+                        if (iconClass)
+                        {
+                            return iconClass;
+                        }
+                        return document[data[iconField]];
+                    }
+                }
+            }
+            catch(e:Error)
+            {
+            }
+        }
+
+        return null;
+    }
+
+    //--------------------------------------------------------------------------
+    // Activator list management
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function insertMenuBarItem(index:int, mdp:Object):void
+    {
+        if (dataProviderChanged)
+        {
+            commitProperties();
+            return;
+        }
+
+        var item:IMenuBarItemRenderer = menuBarItemRenderer.newInstance();
+        item.styleName = new StyleProxy(this, menuBarItemStyleFilters);
+        item.visible = false;
+        item.enabled = enabled && _dataDescriptor.isEnabled(mdp) != false;
+        item.data = mdp;
+        item.menuBar = this;
+        item.menuBarItemIndex = index;
+        addChild(DisplayObject(item));
+        menuBarItems.splice(index, 0, item);
+
+        invalidateSize();
+        invalidateDisplayList();
+
+        item.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
+        item.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
+        item.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+        item.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
+    }
+
+    /**
+     *  Returns a reference to the Menu object at the specified MenuBar item index,
+     *  where 0 is the Menu contained at the leftmost MenuBar item index.
+     *
+     *  @param index Index of the Menu instance to return.
+     *
+     *  @return Reference to the Menu contained at the specified index.
+     */
+    public function getMenuAt(index:int):Menu
+    {
+        if (dataProviderChanged)
+            commitProperties();
+
+        var item:IMenuBarItemRenderer = menuBarItems[index];
+
+        var mdp:Object = item.data;
+        var menu:Menu = menus[index];
+
+        if (menu == null)
+        {
+            menu = new Menu();
+            menu.showRoot = false;
+
+            if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
+                menu.styleName = this;
+
+            var menuStyleName:Object = getStyle("menuStyleName");
+            if (menuStyleName)
+            {
+                if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
+                {
+                    var styleDecl:CSSStyleDeclaration =
+                        StyleManager.getStyleDeclaration("." + menuStyleName);
+                    if (styleDecl)
+                        menu.styleDeclaration = styleDecl;
+                }
+                else
+                {
+                    menu.styleName = menuStyleName;
+                }
+            }
+
+            menu.sourceMenuBar = this;
+            menu.owner = this;
+            menu.addEventListener("menuHide", eventHandler);
+            menu.addEventListener("itemRollOver", eventHandler);
+            menu.addEventListener("itemRollOut", eventHandler);
+            menu.addEventListener("menuShow", eventHandler);
+            menu.addEventListener("itemClick", eventHandler);
+            menu.addEventListener("change", eventHandler);
+            menu.iconField = _iconField;
+            menu.labelField = _labelField;
+            menu.labelFunction = labelFunction;
+            menu.dataDescriptor = _dataDescriptor;
+            menu.invalidateSize();
+
+            menus[index] = menu;
+            menu.sourceMenuBarItem = item; // menu needs this for a hitTest when clicking outside menu area
+            Menu.popUpMenu(menu, this, mdp);
+        }
+
+        return menu;
+    }
+
+    /**
+     *  @private
+     *  Show a menuBarItem's menu
+     */
+    private function showMenu(index:Number):void
+    {
+        selectedIndex = index;
+        var item:IMenuBarItemRenderer = menuBarItems[index];
+
+        // The getMenuAt function will create the Menu if it doesn't
+        // already exist.
+        var menu:Menu = getMenuAt(index);
+        var sm:ISystemManager = systemManager;
+        var screen:Rectangle = sm.screen;
+
+        UIComponentGlobals.layoutManager.validateClient(menu, true);
+
+        // popups go on the root of the swf which if loaded, is not
+        // necessarily at 0,0 in global coordinates
+        var pt:Point = new Point(0, 0);
+        pt = DisplayObject(item).localToGlobal(pt);
+        // check to see if we'll go offscreen
+        if (pt.y + item.height + 1 + menu.getExplicitOrMeasuredHeight() > screen.height + screen.y)
+            pt.y -= menu.getExplicitOrMeasuredHeight();
+        else
+            pt.y += item.height + 1;
+        if (pt.x + menu.getExplicitOrMeasuredWidth() > screen.width + screen.x)
+            pt.x = screen.x + screen.width - menu.getExplicitOrMeasuredWidth();
+        pt = DisplayObject(sm.topLevelSystemManager).globalToLocal(pt);
+
+        // If inside an ACB, slight offset looks much better.
+        if (isInsideACB)
+            pt.y += 2;
+
+        menu.show(pt.x, pt.y);
+    }
+
+    /**
+     *  @private
+     */
+    private function removeMenuBarItemAt(index:int):void
+    {
+        if (dataProviderChanged)
+            commitProperties();
+
+        var item:IMenuBarItemRenderer = menuBarItems[index];
+
+        if (item)
+        {
+            removeChild(DisplayObject(item));
+            menuBarItems.splice(index, 1);
+            invalidateSize();
+            invalidateDisplayList();
+        }
+    }
+
+
+    /**
+     *  @private
+     */
+    private function removeAll():void
+    {
+        if (dataProviderChanged)
+            commitProperties();
+
+        while (menuBarItems.length > 0)
+        {
+            var item:IMenuBarItemRenderer = menuBarItems[0];
+            removeChild(DisplayObject(item));
+            menuBarItems.splice(0, 1);
+        }
+
+        menus = [];
+
+        invalidateSize();
+        invalidateDisplayList();
+    }
+
+    //--------------------------------------------------------------------------
+    // Mouse Event Handlers
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function mouseOverHandler(event:MouseEvent):void
+    {
+        var item:IMenuBarItemRenderer = IMenuBarItemRenderer(event.target);
+        var index:int = item.menuBarItemIndex;
+        var requiresEvent:Boolean = false;
+        var m:Menu = getMenuAt(index);
+        var evt:MenuEvent;
+        if (item.enabled)
+        {
+            if (openMenuIndex != -1 || inKeyDown)
+            {
+                var oldIndex:Number = openMenuIndex;
+                if (oldIndex != index)
+                {
+                    // Deactivate the old
+                    isDown = false;
+                    if (oldIndex != -1)
+                    {
+                        var oldItem:IMenuBarItemRenderer = menuBarItems[oldIndex];
+                        oldItem.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_UP));
+                        oldItem.menuBarItemState = "itemUpSkin";
+
+                        //we've effectively rolled out of this item, dispatch the
+                        //correct itemRollOut event
+                        evt = new MenuEvent(MenuEvent.ITEM_ROLL_OUT);
+                        evt.menuBar = this;
+                        evt.index = oldIndex;
+                        evt.label = itemToLabel(oldItem.data);
+                        evt.item = oldItem.data;
+                        evt.itemRenderer = oldItem;
+                        dispatchEvent(evt);
+                    }
+
+                    // Activate the new
+                    item.menuBarItemState = "itemDownSkin";
+                    var dp:ICollectionView = ICollectionView(m.dataProvider);
+
+                    //Show only those menus that have children to show
+                    if (m.dataDescriptor.isBranch(item.data, item.data) &&
+                        m.dataDescriptor.hasChildren(item.data, item.data))
+                    {
+                        showMenu(index);
+                    }
+                    // we still want to dispatch a menuShow event for top-level menuitems with
+                    // no children and update the selectedIndex property
+                    else if (m)
+                    {
+                        selectedIndex = index;
+
+                        evt = new MenuEvent(MenuEvent.MENU_SHOW);
+                        evt.menuBar = this;
+                        evt.menu = m;
+                        dispatchEvent(evt);
+
+                        item.menuBarItemState = "itemOverSkin";
+                    }
+                    isDown = true;
+
+                    if (m.dataDescriptor.getType(item.data) != "separator")
+                    {
+                        requiresEvent = true;
+                        //fire the change event
+                        evt = new MenuEvent(MenuEvent.CHANGE);
+                        evt.index = index;
+                        evt.menuBar = this;
+                        evt.label = itemToLabel(item.data);
+                        evt.item = item.data;
+                        evt.itemRenderer = item;
+                        dispatchEvent(evt);
+                    }
+
+                }
+                else
+                {
+                    var mm:Menu = getMenuAt(index);
+                    mm.deleteDependentSubMenus();
+                    mm.setFocus();
+                }
+            }
+            else
+            {
+                item.menuBarItemState = "itemOverSkin";
+                isDown = false;
+                if (m.dataDescriptor.getType(item.data) != "separator")
+                    requiresEvent = true;
+            }
+            inKeyDown = false;
+
+            if (requiresEvent)
+            {
+                // Fire the appropriate rollover event
+                evt = new MenuEvent(MenuEvent.ITEM_ROLL_OVER);
+                evt.index = index;
+                evt.menuBar = this;
+                evt.label = itemToLabel(item.data);
+                evt.item = item.data;
+                evt.itemRenderer = item;
+                dispatchEvent(evt);
+            }
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function mouseDownHandler(event:MouseEvent):void
+    {
+        var item:IMenuBarItemRenderer = IMenuBarItemRenderer(event.target);
+        var index:int = item.menuBarItemIndex;
+        var m:Menu = getMenuAt(index);
+
+        if (item.enabled)
+        {
+            item.menuBarItemState = "itemDownSkin";
+
+            if (!isDown)
+            {
+                m.supposedToLoseFocus = true;
+
+                var dp:ICollectionView = ICollectionView(m.dataProvider)
+                //Show only those menus that have children to show
+                if (m.dataDescriptor.isBranch(item.data, item.data) &&
+                    m.dataDescriptor.hasChildren(item.data, item.data))
+                {
+                    showMenu(index);
+                }
+
+                // we still want to dispatch a menuShow event for top-level menuitems with no children
+                // and update the selectedIndex property
+                else if (m)
+                {
+                    selectedIndex = index;
+
+                    var evt:MenuEvent = new MenuEvent(MenuEvent.MENU_SHOW);
+                    evt.menuBar = this;
+                    evt.menu = m;
+                    dispatchEvent(evt);
+                }
+
+                isDown = true;
+            }
+            else
+            {
+                isDown = false;
+            }
+
+            if (m.dataDescriptor.getType(item.data) != "separator")
+            {
+                //fire the change event
+                var menuEvent:MenuEvent = new MenuEvent(MenuEvent.CHANGE);
+                menuEvent.index = index;
+                menuEvent.menuBar = this;
+                menuEvent.label = itemToLabel(item.data);
+                menuEvent.item = item.data;
+                menuEvent.itemRenderer = item;
+                dispatchEvent(menuEvent);
+            }
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function mouseUpHandler(event:MouseEvent):void
+    {
+        var item:IMenuBarItemRenderer = IMenuBarItemRenderer(event.target);
+        var index:int = item.menuBarItemIndex;
+
+        if (item.enabled && !isDown)
+        {
+            getMenuAt(index).hideAllMenus();
+            item.menuBarItemState = "itemOverSkin";
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function mouseOutHandler(event:MouseEvent):void
+    {
+        var item:IMenuBarItemRenderer = IMenuBarItemRenderer(event.target);
+        var index:int = item.menuBarItemIndex;
+        var m:Menu = getMenuAt(index);
+
+        if (item.enabled && openMenuIndex != index)
+        {
+            menuBarItems[index].menuBarItemState = "itemUpSkin";
+        }
+        // Fire the appropriate rollout event
+        if (item.data &&
+            (m.dataDescriptor.getType(item.data) != "separator"))
+        {
+            var menuEvent:MenuEvent = new MenuEvent(MenuEvent.ITEM_ROLL_OUT);
+            menuEvent.index = index;
+            menuEvent.menuBar = this;
+            menuEvent.label = itemToLabel(item.data);
+            menuEvent.item = item.data;
+            menuEvent.itemRenderer = item;
+            dispatchEvent(menuEvent);
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    // Keyboard Navigation Handlers
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function keyDownHandler(event:KeyboardEvent):void
+    {
+        var barLen:int = menuBarItems.length;
+
+        if (event.keyCode == Keyboard.RIGHT || event.keyCode == Keyboard.LEFT)
+        {
+            inKeyDown = true;
+            var nextIndex:int = openMenuIndex;
+            var found:Boolean = false;
+            var count:int = 0;
+            while (!found && count < barLen)
+            {
+                count++;
+                nextIndex = (event.keyCode == Keyboard.RIGHT) ? nextIndex + 1 : nextIndex - 1;
+
+                if (nextIndex>=barLen)
+                    nextIndex = 0;
+                else if (nextIndex < 0)
+                    nextIndex = barLen - 1;
+
+                if (menuBarItems[nextIndex].enabled)
+                    found = true;
+            }
+
+            // trigger next item in the bar
+            if (count <= barLen && found)
+                menuBarItems[nextIndex].dispatchEvent(new MouseEvent(MouseEvent.MOUSE_OVER));
+
+            event.stopPropagation();
+        }
+
+        // Handle Keyboard.DOWN Navigation
+        if (event.keyCode == Keyboard.DOWN)
+        {
+            if (openMenuIndex != -1)
+            {
+                var menu:Menu = getMenuAt(openMenuIndex);
+                menu.selectedIndex = 0;
+                supposedToLoseFocus = true;
+                var dp:ICollectionView = ICollectionView(menu.dataProvider);
+                var item:IMenuBarItemRenderer = menu.sourceMenuBarItem;
+
+                //focus only those menus that have children to show
+                if (menu.dataDescriptor.isBranch(item.data, item.data) &&
+                    menu.dataDescriptor.hasChildren(item.data, item.data))
+                {
+                    menu.setFocus();
+                }
+            }
+            event.stopPropagation();
+        }
+
+        // Handle Keyboard.ENTER/ESCAPE Commands
+        if ((event.keyCode == Keyboard.ENTER) || (event.keyCode == Keyboard.ESCAPE))
+        {
+            if (openMenuIndex != -1)
+                getMenuAt(openMenuIndex).hide();
+            event.stopPropagation();
+        }
+    }
+
+}
+
+}


Update BossClick.as

Update BossClick.as

I updated how BossClick attempts to avoid pop-up blockers.  Instead of looking for various browsers by name, BossClick now looks for the Flash "player type" to see if it is ActiveX or Mac.  If the "player type" is ActiveX, BossClick opens the clickThrough link in a window by making a Javascript call from the browser instead of using the inherit Flash method of opening a browser window.

--- source/com/thebannerboss/utils/BossClick.as
+++ source/com/thebannerboss/utils/BossClick.as
@@ -1,4 +1,4 @@
-/**
+/**
  * BossClick.as
  * @author Christopher Long at The Banner Boss - @clong
  * @description Creates and adds an invisible hitArea over the entirety
@@ -17,6 +17,7 @@
 	import flash.net.URLRequest;
 	import flash.net.navigateToURL;
 	import flash.external.ExternalInterface;
+	import flash.system.Capabilities;

 	public class BossClick extends Sprite{

@@ -61,56 +62,21 @@
 			if (! url) {
 				trace("BossClick : clickTag button pressed.");
 			}else{
-				openWindow( url );
+				//Try to avoid pop-blockers by using ExternalInterface call to load url
+				if(Capabilities.playerType == "ActiveX" && Capabilities.os != "Mac" && ExternalInterface.available)
+				{
+					ExternalInterface.call("window.open", url, "_blank", "");
+				}
+				else
+				{
+					navigateToURL(new URLRequest(url), "_blank");
+				}
 			}
 		}
-
-		private function getBrowserName():String {
-			var browser:String;
-			//Uses external interface to reach out to browser and grab browser useragent info.
-			var browserAgent:String = ExternalInterface.call("function getBrowser(){return navigator.userAgent;}");
-			//Determines brand of browser using a find index. If not found indexOf returns (-1).
-			if (browserAgent != null && browserAgent.indexOf("Firefox")>= 0) {
-				browser = "Firefox";
-			} else if (browserAgent != null && browserAgent.indexOf("Safari")>= 0) {
-				browser = "Safari";
-			} else if (browserAgent != null && browserAgent.indexOf("MSIE")>= 0) {
-				browser = "IE";
-			} else if (browserAgent != null && browserAgent.indexOf("Opera")>= 0) {
-				browser = "Opera";
-			} else {
-				browser = "Undefined";
-			}
-			return (browser);
-		}
+

 		//Try to avoid pop-blockers by using ExternalInterface call to load url
-		private function openWindow(url:String, target:String = '_blank', features:String=""):void {
-			var WINDOW_OPEN_FUNCTION:String = "window.open";
-			var myURL:URLRequest = new URLRequest(url);
-			var browserName:String = getBrowserName();
-			switch (browserName) {
-					//If browser is Firefox, use ExternalInterface to call out to browser
-					//and launch window via browser's window.open method.
-				case "Firefox" :
-					ExternalInterface.call(WINDOW_OPEN_FUNCTION, url, target, features);
-					break;
-					//If IE,
-				case "IE" :
-					ExternalInterface.call("function setWMWindow() {window.open('" + url + "', '"+target+"', '"+features+"');}");
-					break;
-					// If Safari or Opera or any other;
-				case "Safari" :
-					navigateToURL(myURL, target);
-					break;
-				case "Opera" :
-					navigateToURL(myURL, target);
-					break;
-				default :
-					navigateToURL(myURL, target);
-					break;
-			}
-		}
+
 		//CLICKTAG MANNIPULATION END ---!!!!!!

 		//BORDER BEGIN ---!!!!!!


Movie.hasLabel function

Movie.hasLabel function

--- runtime/src/main/as/flump/display/Movie.as
+++ runtime/src/main/as/flump/display/Movie.as
@@ -73,6 +73,11 @@
     /** @return true if the movie is currently playing. */
     public function get isPlaying () :Boolean { return _playing; }

+    /** @return true if the movie contains the given label. */
+    public function hasLabel (label :String) :Boolean {
+        return getFrameForLabel(label) >= 0;
+    }
+
     /** Plays the movie from its current frame. The movie will loop forever.  */
     public function loop () :Movie {
         _playing = true;
@@ -169,10 +174,23 @@
         if (position is int) return int(position);
         if (!(position is String)) throw new Error("Movie position must be an int frame or String label");
         const label :String = String(position);
+        var frame :int = getFrameForLabel(label);
+        if (frame < 0) {
+            throw new Error("No such label '" + label + "'");
+        }
+        return frame;
+    }
+
+    /**
+     * @private
+     *
+     * Returns the frame index for the given label, or -1 if the label doesn't exist.
+     */
+    protected function getFrameForLabel (label :String) :int {
         for (var ii :int = 0; ii < _labels.length; ii++) {
             if (_labels[ii] != null && _labels[ii].indexOf(label) != -1) return ii;
         }
-        throw new Error("No such label '" + label + "'");
+        return -1;
     }

     /**


Add the possibility to set the diffuse color from BasicStyle.DIFFUSE_COLOR before searching for them into vertex attributes

--- src/aerys/minko/render/effect/basic/BasicEffect.as
+++ src/aerys/minko/render/effect/basic/BasicEffect.as
@@ -81,6 +81,8 @@

 			if (styleIsSet(BasicStyle.DIFFUSE_MAP))
 				diffuse = sampleTexture(BasicStyle.DIFFUSE_MAP, interpolate(vertexUV));
+			else if (styleIsSet(BasicStyle.DIFFUSE_COLOR))
+				diffuse = getStyleParameter(4, BasicStyle.DIFFUSE_COLOR);
 			else
 				diffuse = combine(interpolate(vertexRGBColor).rgb, 1.);


rm HSettings.enabled

rm HSettings.enabled

--- src/org/hola/HSettings.as
+++ src/org/hola/HSettings.as
@@ -8,7 +8,6 @@
     public class HSettings {
         private static var _inited : Boolean = false;
         private static var _use_worker : Boolean = false;
-        public static var enabled : Boolean = false;
         public static var hls_mode : Boolean = false;
         public static var managed : Boolean = false;
         public static var fetch_bin_chunk_size : Number = 128*1024;
@@ -37,7 +36,6 @@
             {
                 switch (k)
                 {
-                    case "enabled": enabled = !!s[k]; break;
                     case "hls_mode": hls_mode = !!s[k]; break;
                     case "managed": managed = !!s[k]; break;
                     case "fetch_bin_chunk_size":
@@ -48,7 +46,6 @@
                 }
             }
             return {
-                enabled: enabled,
                 hls_mode: hls_mode,
                 managed: managed,
                 fetch_bin_chunk_size: fetch_bin_chunk_size,


handle stateGroups

handle stateGroups

--- frameworks/as/projects/FlexJSUI/src/mx/states/State.as
+++ frameworks/as/projects/FlexJSUI/src/mx/states/State.as
@@ -60,6 +60,17 @@
 		public var name:String;

         /**
+         *  Comma-delimited list of state groups of the state.
+         *  It is not an array so don't use square brackets [].
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 9
+         *  @playerversion AIR 1.1
+         *  @productversion Flex 3
+         */
+        public var stateGroups:String;
+
+        /**
          *  The array of overrides.  This is normally set by the compiler.
          *
          *  @langversion 3.0


Transferred from the Adobe Open Source Subversion Repository

Revision: 10797
Author:   gruehle@adobe.com
Date:     2009-10-01T23:51:26.639390Z

Log Message:
-----------
Redo fix for SDK-23544. Instead of trying to hack in a theme-specific fix, just remove the borderStyle exclusion from ControlBar.

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/halo/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/ControlBar.as</path>

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

--- frameworks/projects/mx/src/mx/containers/ControlBar.as
+++ frameworks/projects/mx/src/mx/containers/ControlBar.as
@@ -37,7 +37,6 @@
 [Exclude(name="backgroundColor", kind="style")]
 [Exclude(name="borderColor", kind="style")]
 [Exclude(name="borderSides", kind="style")]
-[Exclude(name="borderStyle", kind="style")]
 [Exclude(name="borderThickness", kind="style")]
 [Exclude(name="dropShadowColor", kind="style")]
 [Exclude(name="dropShadowEnabled", kind="style")]
@@ -138,22 +137,6 @@
     public function ControlBar()
     {
         super();
-
-        // ControlBar defaults to direction="horizontal", but can be changed
-        // later if desired
-        direction = BoxDirection.HORIZONTAL;
-
-        if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
-        {
-            var typeSelector:CSSStyleDeclaration =
-                StyleManager.getStyleDeclaration("mx.containers.ControlBar");
-
-            if (typeSelector)
-            {
-                if (typeSelector.getStyle("borderStyle") === undefined)
-                    typeSelector.setStyle("borderStyle", "none");
-            }
-        }
     }

     //--------------------------------------------------------------------------


Transferred from the Adobe Open Source Subversion Repository

Revision: 10785
Author:   gruehle@adobe.com
Date:     2009-10-01T19:19:27.748512Z

Log Message:
-----------
Fallout from 10766:
- ControlBar default borderStyle is "none"
- DateChooser "todayColor" style is theme="spark, halo", and back in framework defaults.css

QE notes: This should fix breaking tests
Doc notes: -
Bugs: SDK-23544, SDK-23545
Reviewer: Ryan
Tests run: checkintests
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DateChooser.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/ControlBar.as</path>

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

--- frameworks/projects/mx/src/mx/containers/ControlBar.as
+++ frameworks/projects/mx/src/mx/containers/ControlBar.as
@@ -151,7 +151,7 @@
             if (typeSelector)
             {
                 if (typeSelector.getStyle("borderStyle") === undefined)
-                    typeSelector.setStyle("borderStyle", "controlBar");
+                    typeSelector.setStyle("borderStyle", "none");
             }
         }
     }


Transferred from the Adobe Open Source Subversion Repository

Revision: 6422
Author:   hmuller@adobe.com
Date:     2009-04-30T17:00:23.069723Z

Log Message:
-----------
Added fixedThumbSize property to Scroller, moved focusEnabled=false from List to ListSkin.

QE Notes:
Doc Notes:
Bugs: sdk-20733, sdk-17360
Reviewer: Chet, Glenn, Deepa

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/HScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/ListSkin.mxml</path>

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

--- frameworks/projects/spark/src/spark/components/List.as
+++ frameworks/projects/spark/src/spark/components/List.as
@@ -412,10 +412,6 @@
             dataGroup.addEventListener(
                 RendererExistenceEvent.RENDERER_REMOVE, dataGroup_rendererRemoveHandler);
         }
-        // The scroller, between textView and this in the chain, should not
-        // getFocus.
-        if (instance == scroller)
-            scroller.focusEnabled = false;
     }

     /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 11811
Author:   dsubrama@adobe.com
Date:     2009-11-14T20:14:54.284449Z

Log Message:
-----------
Fixes for FXG 2.0.

SDK-23790 - We now set the blendMode correctly when switching from an AIM blendMode to a native Flash one.

SDK-24039 - We hoisted the AIM blendMode support up to UIComponent as per Catalyst's request.

SDK-23715 - Positioning of radial gradient strokes is now correct.

As part of this change, the spark.primitives.supportClasses.shaders packaged move into the framework swc/project, specifically mx.graphics.shaderClasses.

QE notes: Regression and re-gening of so many bitmaps.
Doc notes: None
Bugs: SDK-23790, SDK-24039, SDK-23715
Reviewer: Jason/Evtim/Pete
Tests run: Checkintests - known failures with bitmaps
Is noteworthy for integration: Yes

Modified Paths:
--------------
<path kind="dir" action="D">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/shaders</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/LuminosityMaskFilter.pbk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/GraphicElement.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ColorDodgeShader.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/HueShader.as</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/SoftLight.pbj</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/fxg/FlexFXG2SWFTranscoder.java</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/SoftLight.pbk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Group.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ColorBurn.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ColorBurn.pbk</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/ExclusionShaderExample.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/tools/dependencychecker/frameworkSwcExceptionsList.txt</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/ColorShaderExample.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/HueShaderExample.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/FilledElement.as</path>
<path kind="dir" action="D">/flex/sdk/trunk/frameworks/projects/spark/asdoc/en_US/spark/primitives/supportClasses</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/SoftLightShader.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ColorBurnShader.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/SaturationShaderExample.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Saturation.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Saturation.pbk</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/LuminosityShader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ColorShader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/SparkClasses.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/SoftLightShaderExample.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/ks5792.jpg</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/ColorBurnShaderExample.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/LuminosityMaskShader.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/SaturationShader.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Exclusion.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Exclusion.pbk</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/LuminosityShaderExample.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/Path.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Luminosity.pbj</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Luminosity.pbk</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Color.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Color.pbk</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/ColorDodgeShaderExample.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Hue.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ColorDodge.pbj</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/Hue.pbk</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ColorDodge.pbk</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/asdoc/en_US/mx/graphics/shaderClasses/examples/LuminosityMaskShaderExample.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/ExclusionShader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/FrameworkClasses.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/StrokedElement.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/LuminosityMaskFilter.pbj</path>

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

--- frameworks/projects/spark/src/spark/primitives/Path.as
+++ frameworks/projects/spark/src/spark/primitives/Path.as
@@ -528,6 +528,15 @@
         }
         return pathBBox;
     }
+
+    /**
+     *  @private
+     *  Returns the bounds of the element, including stroke in local coordinates.
+     */
+    override protected function getStrokeBounds():Rectangle
+    {
+        return getBoundingBoxWithStroke(width, height, null);
+    }

 	/**
 	 *  @private
@@ -1053,10 +1062,7 @@
 					lastMoveY = y;
 					prevX = x;
 					prevY = y;
-
-					// If a moveto is followed by multiple pairs of coordinates,
-					// the subsequent pairs are treated as implicit lineto commands.
-					prevIdentifier = (c == 0x6D) ? 0x6C : 0x4C; // c == 'm' ? 'l' : 'L'
+                    prevIdentifier = 0x6D;
 					break;

 				case 0x6C:	// l


Testing hudson ci server 2

Testing hudson ci server 2

--- spec/UIComponentSpecs.as
+++ spec/UIComponentSpecs.as
@@ -10,7 +10,7 @@
 		{
 			const instance:UIComponent = new Button;

-			describe (instance, 'is a component from the mx\.controls package', function () :void
+			describe (instance, 'is a component from the mx controls package', function () :void
 			{
 				it ('should be a UIComponent', function () :void
 				{


- changed the detection of scrolling needs in the Label control to use TextField::maxScrollV and TextField::maxScrollH instead of text height and width. This didn't work reliably in AS2 but does so in AS3 and actually increases reliability.

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@191 bc4816be-ef27-423a-9c4d-fc420be121a2

--- src/reprise/controls/Label.as
+++ src/reprise/controls/Label.as
@@ -574,7 +574,7 @@
 			}
 			if (overflow == 0) //'auto' gets resolved to '0'
 			{
-				if (m_labelDisplay.textHeight > availableHeight)
+				if (m_labelDisplay.maxScrollV > 1)
 				{
 					if (!m_vScrollbar)
 					{
@@ -589,8 +589,7 @@
 					m_vScrollbar.setVisibility(false);
 				}

-				if (!m_labelDisplay.wordWrap &&
-					m_labelDisplay.textWidth > m_labelDisplay.width - 3)
+				if (!m_labelDisplay.wordWrap && m_labelDisplay.maxScrollH > 0)
 				{
 					if (!m_hScrollbar)
 					{
@@ -600,7 +599,7 @@
 					m_hScrollbar.setVisibility(true);

 					if ((!m_vScrollbar || !m_vScrollbar.getVisibility()) &&
-						m_labelDisplay.textHeight > availableHeight)
+						m_labelDisplay.maxScrollV > 1)
 					{
 						if (!m_vScrollbar)
 						{
@@ -628,10 +627,13 @@
 			availableHeight += m_paddingTop + m_paddingBottom;
 			availableWidth += m_paddingLeft + m_paddingRight;

-			m_vScrollbar.outerHeight = availableHeight;
-			m_vScrollbar.top = m_borderTopWidth;
-			m_vScrollbar.left = availableWidth + m_borderLeftWidth;
-			m_vScrollbar.delayValidation();
+			if (m_vScrollbar)
+			{
+				m_vScrollbar.outerHeight = availableHeight;
+				m_vScrollbar.top = m_borderTopWidth;
+				m_vScrollbar.left = availableWidth + m_borderLeftWidth;
+				m_vScrollbar.delayValidation();
+			}

 			if (m_hScrollbar)
 			{


Try to use XML diffs to be tolerant of small floating point differences

--- mustella/as3/src/mustella/CompareBitmap.as
+++ mustella/as3/src/mustella/CompareBitmap.as
@@ -508,7 +508,7 @@
 		var t:String = xmlreader.data;
 		s = s.replace(/\r/g, "");
 		t = t.replace(/\r/g, "");
-		if (s !== t && differ(s, t))
+		if (s !== t && xmldiffer(s, t))
 		{
 			testResult.doFail ("compare returned" + compareVal, absolutePathResult(url) + ".bad.png");

@@ -1376,6 +1376,149 @@
 			return true;
 		return false;
 	}
+
+    private function xmldiffer(s:String, t:String):Boolean
+    {
+        var retval:Boolean = false;
+
+        var xmls:XML = XML(s);
+        var xmlt:XML = XML(t);
+        retval = compareNodes(xmls, xmlt);
+        if (retval)
+            differ(s, t);
+        return retval;
+    }
+
+    private static var xywidthheight:Object = { x: 1, y: 1, width: 1, height: 1};
+
+    private function compareNodes(s:XML, t:XML):Boolean
+    {
+        var retval:Boolean = false;
+        var q:String;
+        var i:int;
+        var n:int;
+        var m:int;
+        var st:String;
+        var tt:String;
+        var sv:String;
+        var tv:String;
+
+        // compare tag names
+        var sn:String = s.name().toString();
+        var tn:String = t.name().toString();
+        var sparts:Array = sn.split(".");
+        var tparts:Array = tn.split(".");
+        n = sparts.length;
+        for (i = 0; i < n; i++)
+            sparts[i] = trimTag(sparts[i]);
+        n = tparts.length;
+        for (i = 0; i < n; i++)
+            tparts[i] = trimTag(tparts[i]);
+        sn = sparts.join(".");
+        tn = tparts.join(".");
+        if (tn != sn)
+        {
+            if (sn == "NullChild" || sn == "flash.display.StaticText" ||
+                tn == "NullChild" || tn == "flash.display.StaticText")
+            {
+                // inconsistent behavior around StaticText
+            }
+            else
+            {
+                trace("tag name mismatch: cur=", sn, "xml=", tn);
+                retval = true;
+            }
+        }
+
+        var sa:XMLList = s.attributes();
+        var ta:XMLList = t.attributes();
+        n = sa.length();
+        m = ta.length();
+        if (n != m)
+        {
+            trace(sn, "different number of attributes: cur=", n, "xml=", m);
+            retval = true;
+        }
+        else
+        {
+            for (i = 0; i < n; i++)
+            {
+                st = sa[i].name().toString();
+                tt = ta[i].name().toString();
+                if (st != tt)
+                {
+                    trace(sn, "attribute name mismatch: cur=", st, "xml=", tt);
+                    retval = true;
+                }
+                else
+                {
+                    sv = s['@' + st].toString();
+                    tv = s['@' + tt].toString();
+                    if (sv != tv)
+                    {
+                        if (xywidthheight[st] == 1)
+                        {
+                            var sf:Number = Number(sv);
+                            var tf:Number = Number(tv);
+                            if (Math.abs(tf - sf) > 0.1)
+                            {
+                                trace(sn + '@' + st, "attribute value mismatch: cur=", sv, "xml=", tv);
+                                retval = true;
+                            }
+                        }
+                        else if (st == "matrix")
+                        {
+                            // strip parens
+                            sv = sv.substring(1, sv.length - 2);
+                            tv = tv.substring(1, tv.length - 2);
+                            sparts = sv.split(",");
+                            tparts = tv.split(",");
+                            n = sparts.length;
+                            for (i = 0; i < n; i++)
+                            {
+                                sv = sparts[i];
+                                tv = tparts[i];
+                                sv = sv.split("=")[1];
+                                tv = tv.split("=")[1];
+                                sf = Number(sv);
+                                tf = Number(tv);
+                                if (Math.abs(tf - sf) > 0.1)
+                                {
+                                    trace(sn + '@' + st, "matrix value mismatch: cur=", sv, "xml=", tv);
+                                    retval = true;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            trace(sn + '@' + st, "attribute value mismatch: cur=", sv, "xml=", tv);
+                            retval = true;
+                        }
+                    }
+                }
+            }
+        }
+
+        var sl:XMLList = s.children();
+        var tl:XMLList = t.children();
+        n = sl.length();
+        m = tl.length();
+        if (n != m)
+        {
+            trace(sn, "different number of children: cur=", n, "xml=", m);
+            retval = true;
+        }
+        else
+        {
+            for (i = 0; i < n; i++)
+            {
+                if (compareNodes(sl[i], tl[i]))
+                    retval = true;
+            }
+        }
+        return retval;
+    }
+
 }

 }


These functions aren't actually used by sortDisplayChildren

git-svn-id: b675b909355d5cf946977f44a8ec5a6ceb3782e4@569 ed5b42cb-e716-0410-a449-f6a68f950b19

--- src/as/com/threerings/flash/DisplayUtil.as
+++ src/as/com/threerings/flash/DisplayUtil.as
@@ -242,44 +242,6 @@
     public static function dumpHierarchy (top :DisplayObject) :String
     {
         return dumpHierarchy0(top);
-    }
-
-    /** Helper function for sortDisplayChildren. */
-    private static function qsortDisplayChildren (
-        container :DisplayObjectContainer, left :int, right :int, comp :Function) :void
-    {
-        if (right - left > 1) { // containers of size 0 or 1 are already sorted
-
-            // arbitrarily choose the element in the middle of the sort list as the pivot element
-            var pivotIndex :int = left + ((right - left) / 2);
-
-            pivotIndex = partitionDisplayChildren(container, left, right, pivotIndex, comp);
-            qsortDisplayChildren(container, left, pivotIndex - 1, comp);
-            qsortDisplayChildren(container, pivotIndex + 1, right, comp);
-        }
-    }
-
-    /** Helper function for qsortDisplayChildren. */
-    private static function partitionDisplayChildren (
-        container :DisplayObjectContainer, left :int, right :int, pivotIndex :int, comp :Function) :int
-    {
-        var pivotObj :DisplayObject = container.getChildAt(pivotIndex);
-
-        container.swapChildrenAt(pivotIndex, right); // move pivot to end
-
-        var storeIndex :int = left;
-
-        for (var i :int = left; i < right; ++i) {
-            var thisObj :DisplayObject = container.getChildAt(i);
-            if (0 > comp(thisObj, pivotObj)) {
-                container.swapChildrenAt(i, storeIndex);
-                storeIndex += 1;
-            }
-        }
-
-        container.swapChildrenAt(storeIndex, right);
-
-        return storeIndex;
     }

     /**