Transferred from the Adobe Open Source Subversion Repository

Revision: 8483
Author:   smgilson@adobe.com
Date:     2009-07-09T17:52:48.367800Z

Log Message:
-----------
Second checkin to update the namespace in ASDoc MXML syntax descriptions for Spark components

QE Notes: None
Doc Notes: None
Bugs: -
Checkintests: passed

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/easing/EaseInOutBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Fade.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/animation/MotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/ColorMatrixFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/easing/Power.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/BlurFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/DisplacementMapFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/ShaderFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/DropShadowFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/CallAction.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GradientBevelFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/AnimateColor.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Scale3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Animate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/AnimateTransitionShader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/AnimateFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Rotate3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/AddAction.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Scale.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/VerticalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/Graphic.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Move3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Rotate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/BasicLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Resize.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/AnimateTransform3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Wipe.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/easing/Sine.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Move.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GlowFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/AnimateTransform.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/TileLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/ConvolutionFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/easing/Linear.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/animation/Keyframe.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GradientGlowFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/SetAction.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/RemoveAction.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/BevelFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/GradientFilter.as</path>

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

--- frameworks/projects/spark/src/spark/effects/Resize.as
+++ frameworks/projects/spark/src/spark/effects/Resize.as
@@ -38,7 +38,7 @@
  *  and adds the following tab attributes:

  *
  *

- *  <mx:Resize
+ *  <s:Resize
  *    id="ID"
  *    widthFrom="val"
  *    heightFrom="val"


Transferred from the Adobe Open Source Subversion Repository

Revision: 5347
Author:   cframpto@adobe.com
Date:     2009-03-17T17:34:54.805989Z

Log Message:
-----------
1.  Implement autoSize in TextView (default=true), FxTextInput (defalt=false) and FxTextArea.as (default=false).  If linesBreaks are toFit, maxWidth and percentWidth can be used to control the width.  height, minHeight, maxHeight, percentHeight, width and minWidth are ignored.
2.  widthInChars changed to be width in ems (size of "M" in default font) even though the property hasn't been renamed yet. The default was changed from 20 to 15 for TextView, FxTextInput and FxTextArea.
3.  The heightInLines calculation was improved so it is much closer to what it would be if you actually measured the text.
4.  Removed showSelection/hideSelection from focusIn/Out handlers since they were no longer needed.  We've implemented the various selection formats now.

This will break a few mustella tests.

QE Notes: sent Peter D. notes on how autoSize works
Doc Notes:
Bugs: SDK-19110, SDK-19034, SDK-19395, SDK-16359
Reviewers: Gordon and some testing by Peter D.

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxTextInput.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/FxTextBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxTextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/utils/TextUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/TextView.as</path>

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

--- frameworks/projects/spark/src/spark/utils/TextUtil.as
+++ frameworks/projects/spark/src/spark/utils/TextUtil.as
@@ -64,6 +64,32 @@
     /**
      *  @private
      */
+    public static function getNumberOrPercentOf(value:Object,
+                                                n:Number):Number
+    {
+        // If 'value' is a Number like 10.5, return it.
+        if (value is Number)
+            return Number(value);
+
+        // If 'value' is a percentage String like "10.5%",
+        // return that percentage of 'n'.
+        if (value is String)
+        {
+            var len:int = String(value).length;
+            if (len >= 1 && value.charAt(len - 1) == "%")
+            {
+                var percent:Number = Number(value.substring(0, len - 1));
+                return percent / 100 * n;
+            }
+        }
+
+        // Otherwise, return NaN.
+        return NaN;
+    }
+
+    /**
+     *  @private
+     */
     public static function obscureTextFlow(textFlow:TextFlow,
                                            obscurationChar:String):void
     {


Transferred from the Adobe Open Source Subversion Repository

Revision: 17491
Author:   aharui@adobe.com
Date:     2010-08-26T18:31:34.581497Z

Log Message:
-----------
Handle clipped sub-apps

QE notes: none
Doc notes: New optional parameter to SystemManager.getVisibleApplicationRect
Bugs: SDK-26478
Reviewer: Darrell
Tests run: checkintests mustella/MarshallPlan
Is noteworthy for integration: yes

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/DateField.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/VSlider.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/treeClasses/TreeItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/dataGridClasses/DataGridItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/SystemManagerProxy.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/listClasses/TileListItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/MenuBar.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/ISystemManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark_dmv/src/mx/controls/advancedDataGridClasses/FTEAdvancedDataGridItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/PopUpButton.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/systemClasses/MarshallingSupport.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/HSlider.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/Menu.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/datavisualization/src/mx/controls/advancedDataGridClasses/AdvancedDataGridItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/ComboBox.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/listClasses/ListItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/controls/ColorPicker.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/mx/controls/dataGridClasses/FTEDataGridItemRenderer.as</path>

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

--- frameworks/projects/spark/src/spark/components/HSlider.as
+++ frameworks/projects/spark/src/spark/components/HSlider.as
@@ -183,7 +183,7 @@
             var r:Point = thumb.parent.localToGlobal(o);

             // Get the screen bounds
-            var screenBounds:Rectangle = systemManager.getVisibleApplicationRect();
+            var screenBounds:Rectangle = systemManager.getVisibleApplicationRect(null, true);
             // Get the tips bounds. We only care about the dimensions.
             var tipBounds:Rectangle = tipAsDisplayObject.getBounds(tipAsDisplayObject.parent);


Transferred from the Adobe Open Source Subversion Repository

Revision: 3796
Author:   tan@adobe.com
Date:     2008-10-21T22:01:05.695187Z

Log Message:
-----------
Link the FxHSlider, FxVSlider, FxSpinner and FxNumericStepper examples to ASDoc.

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxNumericStepper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxVSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxHSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxSpinner.as</path>

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

--- frameworks/projects/spark/src/spark/components/HSlider.as
+++ frameworks/projects/spark/src/spark/components/HSlider.as
@@ -22,6 +22,8 @@

 /**
  *  The FxHSlider class defines a horizontal slider component.
+ *
+ *  @includeExample examples/FxHSliderExample.mxml
  */
 public class FxHSlider extends FxSlider
 {


Comment fixup.

Comment fixup.

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

--- src/as/com/threerings/flash/FrameSprite.as
+++ src/as/com/threerings/flash/FrameSprite.as
@@ -38,7 +38,7 @@
     }

     /**
-     * Called to update our visual appearance prior to the flash player each frame.
+     * Called to update our visual appearance prior to each frame.
      */
     protected function handleFrame (... ignored) :void
     {


Read the import dir when a config is opened

--- exporter/src/main/as/flump/export/Exporter.as
+++ exporter/src/main/as/flump/export/Exporter.as
@@ -31,11 +31,11 @@
 import spark.components.Window;
 import spark.events.GridSelectionEvent;

-import starling.display.Sprite;
-
 import com.threerings.util.F;
 import com.threerings.util.Log;
 import com.threerings.util.StringUtil;
+
+import starling.display.Sprite;

 public class Exporter
 {
@@ -136,6 +136,8 @@
             try {
                 _conf = FlumpConf.fromJSON(JSONFormat.readJSON(_confFile));
                 _win.title = _confFile.name;
+                var dir :String = _confFile.parent.nativePath + File.separator + _conf.importDir;
+                setImport(new File(dir));
             } catch (e :Error) {
                 log.warning("Unable to parse conf", e);
                 _errors.dataProvider.addItem(new ParseError(_confFile.nativePath,


Transferred from the Adobe Open Source Subversion Repository

Revision: 4724
Author:   rfrishbe@adobe.com
Date:     2009-01-29T02:13:02.210369Z

Log Message:
-----------
Bunch of small changes:

build scripts..just minor fixes and making it player 10

FxComponent - required parts must be present--not just defined

FxContainer - removing some dead code around IUIComponent since everything should be an IVisualElement now

Group - move around logic for removing a previously parented object.  This helps deal with graphic elements with shared display objects

GraphicElement - need to handle display object getting changed as well

ArrayList/ListCollectionView - add addAll() and addAllAt()

AdvancedLayoutFeatures - remove Vector import (now that build scripts are fixed, it works fine)

QE Notes: Write tests for addAll() and allAllAt(), check that required parts are required in the first state
Doc Notes: None
Bugs: SDK-18536, SDK-18745, SDK-18709, SDK-18189, SDK-18537
Reviewer: Evtim
tests: checkintests, mustella DataGroup, List, Group, FxContainer, FxDataContainer

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/utilities/build.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/collections/ListCollectionView.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flash-integration/build.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/FxComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/build.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/collections/ArrayList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/GraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/AdvancedLayoutFeatures.as</path>

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

--- frameworks/projects/framework/src/mx/collections/ArrayList.as
+++ frameworks/projects/framework/src/mx/collections/ArrayList.as
@@ -18,14 +18,12 @@
 import flash.utils.IDataOutput;
 import flash.utils.IExternalizable;
 import flash.utils.getQualifiedClassName;
+
 import mx.core.IPropertyChangeNotifier;
-import mx.core.mx_internal;
 import mx.events.CollectionEvent;
 import mx.events.CollectionEventKind;
 import mx.events.PropertyChangeEvent;
 import mx.events.PropertyChangeEventKind;
-import mx.managers.ISystemManager;
-import mx.managers.SystemManager;
 import mx.resources.IResourceManager;
 import mx.resources.ResourceManager;
 import mx.utils.ArrayUtil;
@@ -310,6 +308,26 @@

         startTrackUpdates(item);
         internalDispatchEvent(CollectionEventKind.ADD, item, index);
+    }
+
+    /**
+     *  @copy mx.collections.ListCollectionView#addAll
+     */
+    public function addAll(addList:IList):void
+    {
+        addAllAt(addList, length);
+    }
+
+    /**
+     *  @copy mx.collections.ListCollectionView#addAllAt
+     */
+    public function addAllAt(addList:IList, index:int):void
+    {
+        var length:int = addList.length;
+        for(var i:int=0; i < length; i++)
+        {
+            this.addItemAt(addList.getItemAt(i), i+index);
+        }
     }

     /**


FLEX-34294: Create a base Class for workers making them debuggable via FDB - Adjusted minimum AIR version and typo.

--- frameworks/projects/framework/src/mx/core/DebuggableWorker.as
+++ frameworks/projects/framework/src/mx/core/DebuggableWorker.as
@@ -28,7 +28,7 @@
  *  it allows the debugging of those workers using FDB.
  *
  *  @langversion 3.0
- *  @playerversion Flash 10
+ *  @playerversion Flash 11.4
  *  @playerversion AIR 3.4
  *  @productversion Flex 4
  */
@@ -49,7 +49,7 @@

     /**
      *  @private
-     *  This is here so we get the this pointer set to Application.
+     *  This is here so we get the "this" pointer set to this worker instance.
      */
     private function debugTickler():void {
         // We need some bytes of code in order to have a place to break.


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

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

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

--- frameworks/projects/framework/src/mx/events/ItemClickEvent.as
+++ frameworks/projects/framework/src/mx/events/ItemClickEvent.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2005-2006 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.events
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 3139
Author:   jimurphy@adobe.com
Date:     2008-09-08T15:42:37.788151Z

Log Message:
-----------
Merged 3.0.x revisions [3074,3079-3080,3086,3094,3096,3098,3101-3102,3104,3108,3114,3123,3125-3126] -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/FocusRequestDirection.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/NetConnectionChannel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/PopUpButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/EventListenerRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/config/ServerConfig.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/SecurityUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/FocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Container.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxMouseEvent.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManagerProxy.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterDragManagerEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/SWFBridgeGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SWFBridgeEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UITextFormat.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/sliderClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ISystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InvalidateRequestData.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ISWFLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ISWFBridgeProvider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/InterManagerRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SWFBridgeRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ISWFBridgeGroup.as</path>

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

--- frameworks/projects/framework/src/mx/events/SWFBridgeEvent.as
+++ frameworks/projects/framework/src/mx/events/SWFBridgeEvent.as
@@ -16,10 +16,9 @@
 import flash.events.IEventDispatcher;

 /**
- *  This is an event sent between sandboxes.
- *  The event lets objects in other sandboxes know
- *  what is going on in this sandbox.
- *  The events are informational in nature as opposed to SWFBridgeRequests,
+ *  This is an event that is sent between applications that are in different security sandboxes.
+ *  The event lets objects in other sandboxes know what is going on in this sandbox.
+ *  The events are informational in nature as opposed to a SWFBridgeRequest,
  *  which request an object do something on its behalf.
  */
 public class SWFBridgeEvent extends Event
@@ -40,23 +39,23 @@
         "bridgeApplicationActivate";

     /**
-     *  Sent via bridge to a child application's systemManager to notify it
-	 *  that the SWF is about to be unloaded.  The systemManager marshals and
+     *  Sent through a bridge to a child application's SystemManager to notify it
+	 *  that the SWF is about to be unloaded. The SystemManager marshals and
 	 *  re-dispatches the event so that application code can remove references
-	 *  that would prevent the SWF from unloading
+	 *  that would prevent the SWF file from unloading.
      */
     public static const BRIDGE_APPLICATION_UNLOADING:String = "bridgeApplicationUnloading";

 	/**
-	 *  Dispatched via bridges to all other FocusManagers to notify them
-	 *  that another focus manager is now active.
+	 *  Dispatched through bridges to all other FocusManagers to notify them
+	 *  that another FocusManager is now active.
 	 */
 	public static const BRIDGE_FOCUS_MANAGER_ACTIVATE:String =
         "bridgeFocusManagerActivate";

 	/**
-	 *  Dispatched via parent bridge to its SWFLoader to notify it
-	 *  that a new system manager has been initialized.
+	 *  Dispatched through a parent bridge to its SWFLoader to notify it
+	 *  that a new SystemManager has been initialized.
 	 */
 	public static const BRIDGE_NEW_APPLICATION:String =
         "bridgeNewApplication";
@@ -65,24 +64,58 @@
 	 *	Dispatched to a parent bridge or sandbox root to notify it that
 	 *  a window was activated.
 	 *
-	 *  For a compatible application, the data property
-     *  is set to the system manager proxy that was activated.
-	 *  For an untrusted application, the data property
-     *  is set to a string id of the window.
+	 *  For a compatible application, the data property
+	 *  is an object with two properties, window
+	 *  and notifier. The data.window property
+     *  is the SystemManager proxy that was activated.
+	 *  For an untrusted application, the data.window property
+     *  is a string id of the window. The
+     *  data.notifier property is the bridge of the
+     *  application dispatching the event. The event might be dispatched
+     *  directly to a sandbox root instead of over a bridge, so event.target
+     *  might not be the bridge of the application dispatching the event.
 	 */
     public static const BRIDGE_WINDOW_ACTIVATE:String = "bridgeWindowActivate";

 	/**
 	 *	Dispatched to a parent bridge or sandbox root to notify it that
-	 *	the proxy system manager was deactivated.
+	 *	the proxy SystemManager was deactivated.
 	 *
-	 *  For a compatible application, the data property
-     *  is set to the system manager proxy that was activated.
-	 *  For an untrusted application, the data property
-     *  is set to a string id of the window.
-     *
+     *  For a compatible application, the data property
+     *  is an object with two properties, window
+     *  and notifier. The data.window property
+     *  is the SystemManager proxy that was activated.
+     *  For an untrusted application, the data.window property
+     *  is a string id of the window. The
+     *  data.notifier property is the bridge of the
+     *  application dispatching the event. The event might be dispatched
+     *  directly to a sandbox root instead of over a bridge, so event.target
+     *  might not be the bridge of the application dispatching the event.
 	 */
     public static const BRIDGE_WINDOW_DEACTIVATE:String = "brdigeWindowDeactivate";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Marshal a SWFBridgeRequest from a remote ApplicationDomain into the current
+     *  ApplicationDomain.
+     *
+     *  @param event A SWFBridgeRequest which might have been created in a different ApplicationDomain.
+     *
+     *  @return A SWFBridgeEvent that was created in the caller's ApplicationDomain.
+     */
+    public static function marshal(event:Event):SWFBridgeEvent
+    {
+        var eventObj:Object = event;
+        return new SWFBridgeEvent(eventObj.type,
+                                  eventObj.bubbles,
+                                  eventObj.cancelable,
+                                  eventObj.data);
+    }

 	//--------------------------------------------------------------------------
 	//
@@ -92,6 +125,16 @@

 	/**
 	 *  Constructor.
+	 *
+     	 *  @param type The event type; indicates the action that caused the event.
+     	 *
+     	 *  @param bubbles Specifies whether the event can bubble up the display list hierarchy.
+     	 *
+     	 *  @param cancelable Specifies whether the behavior associated with the event can be prevented.
+	 *
+	 *  @param data An object that is null by default, but can contain information about the event, depending on the
+	 *  type of event.
+	 *
 	 */
 	public function SWFBridgeEvent(type:String, bubbles:Boolean = false,
                                        cancelable:Boolean = false,
@@ -113,7 +156,7 @@
 	//----------------------------------

 	/**
-	 *  Related data.
+	 *  Information about the event.
 	 */
 	public var data:Object;


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@1262099 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/modules/ModuleManager.as
+++ frameworks/projects/framework/src/mx/modules/ModuleManager.as
@@ -0,0 +1,1029 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2006-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.modules
+{
+
+import mx.core.IFlexModuleFactory;
+
+/**
+ *  The ModuleManager class centrally manages dynamically loaded modules.
+ *  It maintains a mapping of URLs to modules.
+ *  A module can exist in a state where it is already loaded
+ *  (and ready for use), or in a not-loaded-yet state.
+ *  The ModuleManager dispatches events that indicate module status.
+ *  Clients can register event handlers and then call the
+ *  load() method, which dispatches events when the factory is ready
+ *  (or immediately, if it was already loaded).
+ */
+public class ModuleManager
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Get the IModuleInfo interface associated with a particular URL.
+     *  There is no requirement that this URL successfully load,
+     *  but the ModuleManager returns a unique IModuleInfo handle for each unique URL.
+     *
+     *  @param url A URL that represents the location of the module.
+     *
+     *  @return The IModuleInfo interface associated with a particular URL.
+     */
+    public static function getModule(url:String):IModuleInfo
+    {
+        return getSingleton().getModule(url);
+    }
+
+    /**
+     *  See if the referenced object is associated with (or, in the managed
+     *  ApplicationDomain of) a known IFlexModuleFactory implementation.
+     *
+     *  @param object The object that the ModuleManager tries to create.
+     *
+     *  @return Returns the IFlexModuleFactory implementation, or null
+     *  if the object type cannot be created from the factory.
+     */
+    public static function getAssociatedFactory(
+                                object:Object):IFlexModuleFactory
+    {
+        return getSingleton().getAssociatedFactory(object);
+    }
+
+    /**
+     *  @private
+     *  Typed as Object, for now. Ideally this should be IModuleManager.
+     */
+    private static function getSingleton():Object
+    {
+        if (!ModuleManagerGlobals.managerSingleton)
+            ModuleManagerGlobals.managerSingleton = new ModuleManagerImpl();
+
+        return ModuleManagerGlobals.managerSingleton;
+    }
+}
+
+}
+
+import flash.display.Loader;
+import flash.events.ErrorEvent;
+import flash.events.Event;
+import flash.events.EventDispatcher;
+import flash.events.IOErrorEvent;
+import flash.events.ProgressEvent;
+import flash.events.SecurityErrorEvent;
+import flash.net.URLRequest;
+import flash.system.ApplicationDomain;
+import flash.system.LoaderContext;
+import flash.system.Security;
+import flash.system.SecurityDomain;
+import flash.utils.Dictionary;
+import flash.utils.getDefinitionByName;
+import flash.utils.getQualifiedClassName;
+import mx.core.IFlexModuleFactory;
+import mx.events.ModuleEvent;
+import mx.modules.IModuleInfo;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Helper class: ModuleManagerImpl
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  @private
+ *  ModuleManagerImpl is the Module Manager singleton,
+ *  hidden from direct access by the ModuleManager class.
+ *  See the documentation for ModuleManager for the details on this class.
+ */
+class ModuleManagerImpl extends EventDispatcher
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function ModuleManagerImpl()
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var moduleList:Object = {};
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    public function getAssociatedFactory(object:Object):IFlexModuleFactory
+    {
+        var className:String = getQualifiedClassName(object);
+
+        for each (var m:Object in moduleList)
+        {
+            var info:ModuleInfo = m as ModuleInfo;
+
+            if (!info.ready)
+                continue;
+
+            var domain:ApplicationDomain = info.applicationDomain;
+
+            try
+            {
+                var cls:Class = Class(domain.getDefinition(className));
+                if (object is cls)
+                    return info.factory;
+            }
+            catch(error:Error)
+            {
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     *  @private
+     */
+    public function getModule(url:String):IModuleInfo
+    {
+        var info:ModuleInfo = moduleList[url] as ModuleInfo;
+
+        if (!info)
+        {
+            info = new ModuleInfo(url);
+            moduleList[url] = info;
+        }
+
+        return new ModuleInfoProxy(info);
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Helper class: ModuleInfo
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  @private
+ *  The ModuleInfo class encodes the loading state of a module.
+ *  It isn't used directly, because there needs to be only one single
+ *  ModuleInfo per URL, even if that URL is loaded multiple times,
+ *  yet individual clients need their own dedicated events dispatched
+ *  without re-dispatching to clients that already received their events.
+ *  ModuleInfoProxy holds the public IModuleInfo implementation
+ *  that can be externally manipulated.
+ */
+class ModuleInfo extends EventDispatcher
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function ModuleInfo(url:String)
+    {
+        super();
+
+        _url = url;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var factoryInfo:FactoryInfo;
+
+    /**
+     *  @private
+     */
+    private var limbo:Dictionary;
+
+    /**
+     *  @private
+     */
+    private var loader:Loader;
+
+    /**
+     *  @private
+     */
+    private var numReferences:int = 0;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  applicationDomain
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get applicationDomain():ApplicationDomain
+    {
+        return !limbo && factoryInfo ? factoryInfo.applicationDomain : null;
+    }
+
+    //----------------------------------
+    //  error
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the error property.
+     */
+    private var _error:Boolean = false;
+
+    /**
+     *  @private
+     */
+    public function get error():Boolean
+    {
+        return !limbo ? _error : false;
+    }
+
+    //----------------------------------
+    //  factory
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get factory():IFlexModuleFactory
+    {
+        return !limbo && factoryInfo ? factoryInfo.factory : null;
+    }
+
+    //----------------------------------
+    //  loaded
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the loader property.
+     */
+    private var _loaded:Boolean = false;
+
+    /**
+     *  @private
+     */
+    public function get loaded():Boolean
+    {
+        return !limbo ? _loaded : false;
+    }
+
+    //----------------------------------
+    //  ready
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the ready property.
+     */
+    private var _ready:Boolean = false;
+
+    /**
+     *  @private
+     */
+    public function get ready():Boolean
+    {
+        return !limbo ? _ready : false;
+    }
+
+    //----------------------------------
+    //  setup
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the setup property.
+     */
+    private var _setup:Boolean = false;
+
+    /**
+     *  @private
+     */
+    public function get setup():Boolean
+    {
+        return !limbo ? _setup : false;
+    }
+
+    //----------------------------------
+    //  size
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get size():int
+    {
+        return !limbo && factoryInfo ? factoryInfo.bytesTotal : 0;
+    }
+
+    //----------------------------------
+    //  url
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the url property.
+     */
+    private var _url:String;
+
+    /**
+     *  @private
+     */
+    public function get url():String
+    {
+        return _url;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    public function load(applicationDomain:ApplicationDomain = null,
+                         securityDomain:SecurityDomain = null):void
+    {
+        if (_loaded)
+            return;
+
+        _loaded = true;
+
+        limbo = null;
+
+        if (_url.indexOf("published://") == 0)
+            return;
+
+        var r:URLRequest = new URLRequest(_url);
+
+        var c:LoaderContext = new LoaderContext();
+        c.applicationDomain =
+            applicationDomain ?
+            applicationDomain :
+            new ApplicationDomain(ApplicationDomain.currentDomain);
+
+        c.securityDomain = securityDomain;
+        if (securityDomain == null && Security.sandboxType == Security.REMOTE)
+            c.securityDomain = SecurityDomain.currentDomain;
+
+        loader = new Loader();
+
+        loader.contentLoaderInfo.addEventListener(
+            Event.INIT, initHandler);
+        loader.contentLoaderInfo.addEventListener(
+            Event.COMPLETE, completeHandler);
+        loader.contentLoaderInfo.addEventListener(
+            ProgressEvent.PROGRESS, progressHandler);
+        loader.contentLoaderInfo.addEventListener(
+            IOErrorEvent.IO_ERROR, errorHandler);
+        loader.contentLoaderInfo.addEventListener(
+            SecurityErrorEvent.SECURITY_ERROR, errorHandler);
+
+        loader.load(r, c);
+    }
+
+    /**
+     *  @private
+     */
+    public function resurrect():void
+    {
+        if (!factoryInfo && limbo)
+        {
+            //trace("trying to resurrect ", _url, "...");
+            for (var f:Object in limbo)
+            {
+                //trace("found it!");
+                factoryInfo = f as FactoryInfo;
+                break;
+            }
+
+            limbo = null;
+        }
+
+        if (!factoryInfo)
+        {
+            if (_loaded)
+                dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD));
+
+            loader = null;
+            _loaded = false;
+            _setup = false;
+            _ready = false;
+            _error = false;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    public function release():void
+    {
+        if (_ready && !limbo)
+        {
+            // We can try to keep a fully functional factory around
+            //trace("putting factory for ", _url, " on ice...");
+            limbo = new Dictionary(true);
+            limbo[factoryInfo] = 1;
+            factoryInfo = null;
+        }
+        else
+        {
+            // Otherwise we just drop it
+            unload();
+        }
+    }
+
+    /**
+     *  @private
+     */
+
+    private function clearLoader():void
+    {
+        if (loader)
+        {
+            if (loader.contentLoaderInfo)
+            {
+                loader.contentLoaderInfo.removeEventListener(
+                    Event.INIT, initHandler);
+                loader.contentLoaderInfo.removeEventListener(
+                    Event.COMPLETE, completeHandler);
+                loader.contentLoaderInfo.removeEventListener(
+                    ProgressEvent.PROGRESS, progressHandler);
+                loader.contentLoaderInfo.removeEventListener(
+                    IOErrorEvent.IO_ERROR, errorHandler);
+                loader.contentLoaderInfo.removeEventListener(
+                    SecurityErrorEvent.SECURITY_ERROR, errorHandler);
+            }
+
+            try
+            {
+                if (loader.content)
+                    loader.content.removeEventListener("ready", readyHandler);
+            }
+            catch(error:Error)
+            {
+                // we might get unloaded because of a security error
+                // which will disallow access to loader.content
+                // so if we get an error here, just ignore it.
+            }
+
+
+            if (_loaded)
+            {
+                try
+                {
+                    loader.close();
+                }
+                catch(error:Error)
+                {
+                }
+            }
+
+            try
+            {
+                loader.unload();
+            }
+            catch(error:Error)
+            {
+            }
+
+            loader = null;
+        }
+    }
+    /**
+     *  @private
+     */
+    public function unload():void
+    {
+        clearLoader();
+
+        if (_loaded)
+            dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD));
+
+        limbo = null;
+        factoryInfo = null;
+        _loaded = false;
+        _setup = false;
+        _ready = false;
+        _error = false;
+    }
+
+    /**
+     *  @private
+     */
+    public function publish(factory:IFlexModuleFactory):void
+    {
+        if (factoryInfo)
+            return; // can't re-publish without unloading.
+
+        if (_url.indexOf("published://") != 0)
+            return;
+
+        factoryInfo = new FactoryInfo();
+        factoryInfo.factory = factory;
+        _loaded = true;
+        _setup = true;
+        _ready = true;
+        _error = false;
+
+        dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
+        dispatchEvent(new ModuleEvent(ModuleEvent.PROGRESS));
+        dispatchEvent(new ModuleEvent(ModuleEvent.READY));
+    }
+
+    /**
+     *  @private
+     */
+    public function addReference():void
+    {
+        ++numReferences;
+    }
+
+    /**
+     *  @private
+     */
+    public function removeReference():void
+    {
+        --numReferences;
+        if (numReferences == 0)
+            release();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    public function initHandler(event:Event):void
+    {
+        //trace("child load of " + _url + " fired init");
+
+        factoryInfo = new FactoryInfo();
+
+        try
+        {
+            factoryInfo.factory = loader.content as IFlexModuleFactory;
+        }
+        catch(error:Error)
+        {
+        }
+
+        if (!factoryInfo.factory)
+        {
+            var moduleEvent:ModuleEvent = new ModuleEvent(
+                ModuleEvent.ERROR, event.bubbles, event.cancelable);
+            moduleEvent.bytesLoaded = 0;
+            moduleEvent.bytesTotal = 0;
+            moduleEvent.errorText = "SWF is not a loadable module";
+            dispatchEvent(moduleEvent);
+            return;
+        }
+
+        loader.content.addEventListener("ready", readyHandler);
+
+        try
+        {
+            factoryInfo.applicationDomain =
+                loader.contentLoaderInfo.applicationDomain;
+        }
+        catch(error:Error)
+        {
+        }
+        _setup = true;
+
+        dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
+    }
+
+    /**
+     *  @private
+     */
+    public function progressHandler(event:ProgressEvent):void
+    {
+        var moduleEvent:ModuleEvent = new ModuleEvent(
+            ModuleEvent.PROGRESS, event.bubbles, event.cancelable);
+        moduleEvent.bytesLoaded = event.bytesLoaded;
+        moduleEvent.bytesTotal = event.bytesTotal;
+        dispatchEvent(moduleEvent);
+    }
+
+    /**
+     *  @private
+     */
+    public function completeHandler(event:Event):void
+    {
+        //trace("child load of " + _url + " is complete");
+
+        var moduleEvent:ModuleEvent = new ModuleEvent(
+            ModuleEvent.PROGRESS, event.bubbles, event.cancelable);
+        moduleEvent.bytesLoaded = loader.contentLoaderInfo.bytesLoaded;
+        moduleEvent.bytesTotal = loader.contentLoaderInfo.bytesTotal;
+        dispatchEvent(moduleEvent);
+    }
+
+    /**
+     *  @private
+     */
+    public function errorHandler(event:ErrorEvent):void
+    {
+        _error = true;
+
+        var moduleEvent:ModuleEvent = new ModuleEvent(
+            ModuleEvent.ERROR, event.bubbles, event.cancelable);
+        moduleEvent.bytesLoaded = 0;
+        moduleEvent.bytesTotal = 0;
+        moduleEvent.errorText = event.text;
+        dispatchEvent(moduleEvent);
+
+        //trace("child load of " + _url + " generated an error " + event);
+    }
+
+    /**
+     *  @private
+     */
+    public function readyHandler(event:Event):void
+    {
+        //trace("child load of " + _url + " is ready");
+
+        _ready = true;
+
+        factoryInfo.bytesTotal = loader.contentLoaderInfo.bytesTotal;
+
+        clearLoader();
+
+        dispatchEvent(new ModuleEvent(ModuleEvent.READY));
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Helper class: FactoryInfo
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  @private
+ *  Used for weak dictionary references to a GC-able module.
+ */
+class FactoryInfo
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function FactoryInfo()
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  factory
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public var factory:IFlexModuleFactory;
+
+    //----------------------------------
+    //  applicationDomain
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public var applicationDomain:ApplicationDomain;
+
+    //----------------------------------
+    //  bytesTotal
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public var bytesTotal:int = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Helper class: ModuleInfoProxy
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  @private
+ *  ModuleInfoProxy implements IModuleInfo and allows each caller of load()
+ *  to have their own dedicated module events, while still using the same
+ *  backing load state.
+ */
+class ModuleInfoProxy extends EventDispatcher implements IModuleInfo
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function ModuleInfoProxy(info:ModuleInfo)
+    {
+        super();
+
+        this.info = info;
+
+        info.addEventListener(ModuleEvent.SETUP, moduleEventHandler, false, 0, true);
+        info.addEventListener(ModuleEvent.PROGRESS, moduleEventHandler, false, 0, true);
+        info.addEventListener(ModuleEvent.READY, moduleEventHandler, false, 0, true);
+        info.addEventListener(ModuleEvent.ERROR, moduleEventHandler, false, 0, true);
+        info.addEventListener(ModuleEvent.UNLOAD, moduleEventHandler, false, 0, true);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var info:ModuleInfo;
+
+    /**
+     *  @private
+     */
+    private var referenced:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  data
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the data property.
+     */
+    private var _data:Object;
+
+    /**
+     *  @private
+     */
+    public function get data():Object
+    {
+        return _data;
+    }
+
+    /**
+     *  @private
+     */
+    public function set data(value:Object):void
+    {
+        _data = value;
+    }
+
+    //----------------------------------
+    //  error
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get error():Boolean
+    {
+        return info.error;
+    }
+
+    //----------------------------------
+    //  factory
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get factory():IFlexModuleFactory
+    {
+        return info.factory;
+    }
+
+    //----------------------------------
+    //  loaded
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get loaded():Boolean
+    {
+        return info.loaded;
+    }
+
+    //----------------------------------
+    //  ready
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get ready():Boolean
+    {
+        return info.ready;
+    }
+
+    //----------------------------------
+    //  setup
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get setup():Boolean
+    {
+        return info.setup;
+    }
+
+    //----------------------------------
+    //  url
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    public function get url():String
+    {
+        return info.url;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    public function publish(factory:IFlexModuleFactory):void
+    {
+        info.publish(factory);
+    }
+
+    /**
+     *  @private
+     */
+    public function load(applicationDomain:ApplicationDomain = null,
+                         securityDomain:SecurityDomain = null):void
+    {
+        info.resurrect();
+
+        if (!referenced)
+        {
+            info.addReference();
+            referenced = true;
+        }
+
+        //trace("Module[", url, "] load");
+
+        if (info.error)
+        {
+            //trace("Module[", url, "] load is in error state");
+            dispatchEvent(new ModuleEvent(ModuleEvent.ERROR));
+        }
+        else if (info.loaded)
+        {
+            //trace("Module[", url, "] load is already loaded");
+
+            if (info.setup)
+            {
+                //trace("Module[", url, "] load is already set up");
+                dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
+
+                if (info.ready)
+                {
+                    //trace("Module[", url, "] load is already ready");
+
+                    var moduleEvent:ModuleEvent =
+                        new ModuleEvent(ModuleEvent.PROGRESS);
+                    moduleEvent.bytesLoaded = info.size;
+                    moduleEvent.bytesTotal = info.size;
+                    dispatchEvent(moduleEvent);
+
+                    dispatchEvent(new ModuleEvent(ModuleEvent.READY));
+                }
+            }
+        }
+        else
+        {
+            info.load(applicationDomain, securityDomain);
+        }
+    }
+
+    /**
+     *  @private
+     */
+    public function release():void
+    {
+        if (referenced)
+        {
+            info.removeReference();
+            referenced = false;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    public function unload():void
+    {
+        info.unload();
+
+        info.removeEventListener(ModuleEvent.SETUP, moduleEventHandler);
+        info.removeEventListener(ModuleEvent.PROGRESS, moduleEventHandler);
+        info.removeEventListener(ModuleEvent.READY, moduleEventHandler);
+        info.removeEventListener(ModuleEvent.ERROR, moduleEventHandler);
+        info.removeEventListener(ModuleEvent.UNLOAD, moduleEventHandler);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function moduleEventHandler(event:ModuleEvent):void
+    {
+        dispatchEvent(event);
+    }
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 12074
Author:   gruehle@adobe.com
Date:     2009-11-21T01:02:03.186839Z

Log Message:
-----------
Change baseColor to chromeColor.

QE notes: Tests need to be updated.
Doc notes: ASDoc has been updated. Other docs need updating.
Bugs: SDK-24298
Reviewer: Ely
Tests run: checkintests, qe cyclone
Is noteworthy for integration: Yes

Modified Paths:
--------------
112 paths were modified

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

--- frameworks/projects/spark/src/spark/components/Application.as
+++ frameworks/projects/spark/src/spark/components/Application.as
@@ -134,7 +134,7 @@
  *    frameRate="24"
  *    pageTitle""
  *    preloader="No default"
- *    preloaderBaseColor="No default"
+ *    preloaderChromeColor="No default"
  *    scriptRecursionLimit="1000"
  *    scriptTimeLimit="60"
  *    usePreloader="true"
@@ -554,16 +554,16 @@
     public var preloader:Object;

     //----------------------------------
-    //  preloaderBaseColor
+    //  preloaderChromeColor
     //----------------------------------

     [Inspectable(defaultValue="0xCCCCCC", format="Color")]

     /**
-     *  Specifies the base color used by the default preloader component. This property
-     *  has the same effect as the baseColor style used by Spark skins.
+     *  Specifies the chrome color used by the default preloader component. This property
+     *  has the same effect as the chromeColor style used by Spark skins.
      *  Typically this property should be set to the same value as the
-     *  Application container's baseColor style property.
+     *  Application container's chromeColor style property.
      *
      *
Note: This property cannot be set by ActionScript code; it must be set in MXML code.

      *
@@ -577,7 +577,7 @@
      * component. It is here so that it gets picked up by the compiler and included
      * in the info() structure for the generated system manager. The download progress bar
      * grabs the value directly from the info() structure. */
-    public var preloaderBaseColor:uint;
+    public var preloaderChromeColor:uint;

     //----------------------------------
     //  scriptRecursionLimit


Transferred from the Adobe Open Source Subversion Repository

Revision: 2950
Author:   hmuller@adobe.com
Date:     2008-08-21T20:23:05.935439Z

Log Message:
-----------
Most of the rest of the "Group as Viewport" feature.  Enables simple
scrolling for Groups with VerticalLayout or HorizontalLayout, including
support for fixed size rows/columns.  Currently, if variableSizeRows/Columns
is true, then rowHeight/columnWidth must be specified.

- HorizontalLayout

Replaced private static GAP:int constant with a similar "gap"
property.  Gap is the vertical space between rows, default is 6.

Added a columnCount:int property and a protected explicitColumnCount var.
The columnCount property specifies the number of visible columns, which
implies the layoutTarget's width.  The default is -1 which means
that all columns should be visible.

Added variableColumnWidth:Boolean and columnWidth:Number properties.
If the variableColumnWidth is true, HorzontalLayout works as
in earlier versions.  Otherwise the contentWidth and measuredWidth
are proportional to columnWidth.

Changed the updateDisplayList function to set the scrollRect
to the layoutTarget's width/height.

- VerticalLayout

Removed unused colWidth,explicitColWidth properties from
VerticalLayout.  Setting the width of a VerticalLayout
has the same effect as setting colWidth would have.

- Group
Changed vertical,horizontalScrollPosition properties to match the
invalidate/commitProperties pattern.

- HorizontalLayout, VerticalLayout, Group
Eliminated some Java-style bracket formatting atrocities.

QE: No
Doc: No
Checkintests: Pass
Reviewer: Jason
Bugs:
  SDK-1648 - Horizontal Layout is broken in Gumbo when it 's set dynamically

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/core/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/layout/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/layout/VerticalLayout.as</path>

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

--- frameworks/projects/spark/src/spark/layouts/VerticalLayout.as
+++ frameworks/projects/spark/src/spark/layouts/VerticalLayout.as
@@ -11,7 +11,6 @@

 package flex.layout
 {
-
 import flash.geom.Rectangle;

 import flex.core.Group;
@@ -83,7 +82,10 @@
     {
         _target = value;
     }
-
+
+    //----------------------------------
+    //  gap
+    //----------------------------------

     /**
      *  @private
@@ -112,16 +114,16 @@
      */
     public function set gap(value:int):void
     {
-        if (_gap != value)
-        {
-			_gap = value;
- 		   	var layoutTarget:Group = target;
-        	if (layoutTarget != null) {
-				gapChanged = true;
-            	layoutTarget.invalidateSize();
-	            layoutTarget.invalidateDisplayList();
-        	}
-        }
+        if (_gap == value) return;
+
+		_gap = value;
+ 	   	var layoutTarget:Group = target;
+    	if (layoutTarget != null)
+    	{
+			gapChanged = true;
+        	layoutTarget.invalidateSize();
+            layoutTarget.invalidateDisplayList();
+    	}
     }

     //----------------------------------
@@ -173,20 +175,12 @@
         {
             setRowCount(value);
  		   	var layoutTarget:Group = target;
-        	if (layoutTarget != null) {
+        	if (layoutTarget != null)
+        	{
         		rowCountChanged = true;
             	layoutTarget.invalidateSize();
 	            layoutTarget.invalidateDisplayList();
         	}
-
-/*
-            rowCountChanged = true;
-            invalidateProperties();
-            invalidateSize();
-            itemsSizeChanged = true;
-            invalidateDisplayList();
-            dispatchEvent(new Event("rowCountChanged"));
-*/
         }
     }

@@ -232,8 +226,6 @@
      *  The height of the rows in pixels.
      *  Unless the variableRowHeight property is
      *  true, all rows are the same height.
-     *  If not specified, the row height is based on
-     *  the font size and other properties of the renderer.
      */
     public function get rowHeight():Number
     {
@@ -251,17 +243,12 @@
         {
             setRowHeight(value);
  		   	var layoutTarget:Group = target;
-        	if (layoutTarget != null) {
+        	if (layoutTarget != null)
+        	{
         		rowHeightChanged = true;
             	layoutTarget.invalidateSize();
 	            layoutTarget.invalidateDisplayList();
         	}
-         /*
-            invalidateSize();
-            itemsSizeChanged = true;
-            invalidateDisplayList();
-            dispatchEvent(new Event("rowHeightChanged"));
-          */
         }
     }

@@ -270,92 +257,59 @@
      *  setting of explicitRowHeight which
      *  permanently locks in the height of the rows.
      *
-     *  @param v The row height, in pixels.
-     */
-    protected function setRowHeight(v:Number):void
-    {
-        _rowHeight = v;
+     *  @param value The row height, in pixels.
+     */
+    protected function setRowHeight(value:Number):void
+    {
+        _rowHeight = value;
     }
-
-    //----------------------------------
-    //  explicitColWidth
-    //----------------------------------
-
-    /**
-     *  The column width requested by explicitly setting
-     *  colWidth.
-     */
-    protected var explicitColWidth:Number;
-
-    //----------------------------------
-    //  colWidth
-    //----------------------------------
-
-    /**
-     *  @private
-     */
-    private var _colWidth:Number = 20;
-
-    /**
-     *  @private
-     */
-    private var colWidthChanged:Boolean = false;
+
+
+    //----------------------------------
+    //  variableRowHeight
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _variableRowHeight:Boolean = true;

     [Inspectable(category="General")]

     /**
-     *  The width of the (one) column in pixels.
-     */
-    public function get colWidth():Number
-    {
-        return _colWidth;
-    }
-
-    /**
-     *  @private
-     */
-    public function set colWidth(value:Number):void
-    {
-        explicitColWidth = value;
-
-        if (_colWidth != value)
-        {
-            setColWidth(value);
- 		   	var layoutTarget:Group = target;
-        	if (layoutTarget != null) {
-        		colWidthChanged = true;
-            	layoutTarget.invalidateSize();
-	            layoutTarget.invalidateDisplayList();
-        	}
-        }
-    }
-
-    /**
-     *  Sets the colWidth property without causing invalidation or
-     *  setting of explicitColWidth which
-     *  permanently locks in width of the (one) column.
-     *
-     *  @param v The row height, in pixels.
-     */
-    protected function setColWidth(v:Number):void
-    {
-        _colWidth = v;
-    }
-
-
-    public function measure():void
-    {
-    	var layoutTarget:Group = target;
-        if (!layoutTarget)
-            return;
-
+     *  @default true
+     */
+    public function get variableRowHeight():Boolean
+    {
+        return _variableRowHeight;
+    }
+
+    /**
+     *  @private
+     */
+    public function set variableRowHeight(value:Boolean):void
+    {
+        if (value == _variableRowHeight) return;
+
+        _variableRowHeight = value;
+ 		var layoutTarget:Group = target;
+        if (layoutTarget != null) {
+    		layoutTarget.invalidateSize();
+        	layoutTarget.invalidateDisplayList();
+        }
+    }
+
+
+    private function variableRowHeightMeasure(layoutTarget:Group):void
+    {
         var minWidth:Number = 0;
         var minHeight:Number = 0;
         var preferredWidth:Number = 0;
         var preferredHeight:Number = 0;
         var visibleHeight:Number = 0;
         var visibleRows:uint = 0;
-
+        var explicitRowCount:int = explicitRowCount;
+
         var count:uint = layoutTarget.numLayoutItems;
         var totalCount:uint = count; // How many items will be laid out
         for (var i:int = 0; i < count; i++)
@@ -375,7 +329,8 @@
             minWidth = Math.max(minWidth, itemMinWidth);
             minHeight += itemMinHeight;

-            if ((explicitRowCount != -1) && (visibleRows < explicitRowCount)) {
+            if ((explicitRowCount != -1) && (visibleRows < explicitRowCount))
+            {
             	visibleHeight = preferredHeight;
             	visibleRows += 1;
             }
@@ -386,7 +341,7 @@
             var gapSpace:Number = gap * (totalCount - 1);
             minHeight += gapSpace;
             preferredHeight += gapSpace;
-            visibleHeight += (visibleRows < 2) ? 0 : ((visibleRows - 1) * gap);
+            visibleHeight += (visibleRows > 1) ? (gap * (visibleRows - 1)) : 0;
         }

         layoutTarget.measuredWidth = preferredWidth;
@@ -397,6 +352,55 @@

         layoutTarget.measuredMinWidth = minWidth;
         layoutTarget.measuredMinHeight = minHeight;
+    }
+
+
+    private function fixedRowHeightMeasure(layoutTarget:Group):void
+    {
+        // TBD init rowHeight if explicitRowHeight isNaN
+        var rows:uint = layoutTarget.numLayoutItems;
+        var visibleRows:uint = (explicitRowCount == -1) ? rows : explicitRowCount;
+        var contentHeight:Number = (rows * rowHeight) + ((rows > 1) ? (gap * (rows - 1)) : 0);
+        var visibleHeight:Number = (visibleRows * rowHeight) + ((visibleRows > 1) ? (gap * (visibleRows - 1)) : 0);
+
+        var columnWidth:Number = layoutTarget.explicitWidth;
+        var minColumnWidth:Number = columnWidth;
+        if (isNaN(columnWidth))
+        {
+			minColumnWidth = columnWidth = 0;
+	        var count:uint = layoutTarget.numLayoutItems;
+	        for (var i:int = 0; i < count; i++)
+	        {
+	            var layoutItem:ILayoutItem = layoutTarget.getLayoutItemAt(i);
+	            if (!layoutItem || !layoutItem.includeInLayout) continue;
+	            columnWidth = Math.max(columnWidth, layoutItem.preferredSize.x);
+	            var itemMinWidth:Number = hasPercentWidth(layoutItem) ? layoutItem.minSize.x : layoutItem.preferredSize.x;
+	            minColumnWidth = Math.max(minColumnWidth, itemMinWidth);
+	        }
+        }
+
+        layoutTarget.measuredWidth = columnWidth;
+        layoutTarget.measuredHeight = visibleHeight;
+
+        layoutTarget.contentWidth = columnWidth;
+        layoutTarget.contentHeight = contentHeight;
+
+        layoutTarget.measuredMinWidth = minColumnWidth;
+        layoutTarget.measuredMinHeight = rowHeight;
+    }
+
+
+    public function measure():void
+    {
+    	var layoutTarget:Group = target;
+        if (!layoutTarget)
+            return;
+
+        if (variableRowHeight)
+        	variableRowHeightMeasure(layoutTarget);
+        else
+        	fixedRowHeightMeasure(layoutTarget);
+
     }

@@ -430,18 +434,29 @@
         // TODO EGeorgie: horizontalAlign
         var hAlign:Number = 0;

+        // If rowCount wasn't set, then as the LayoutItems are positioned
+        // we'll count how many rows fall within the layoutTarget's scrollRect
+        var visibleRows:uint = 0;
+        var minVisibleY:Number = layoutTarget.verticalScrollPosition;
+        var maxVisibleY:Number = minVisibleY + unscaledHeight;
+
         // Finally, position the objects
         var y:Number = 0;
         for each (var lo:ILayoutItem in layoutItemArray)
         {
             var x:Number = (unscaledWidth - lo.actualSize.x) * hAlign;
-
             lo.setActualPosition(x, y);
-            y += lo.actualSize.y;
-            y += gap;
-        }
-
-        var r:Rectangle = layoutTarget.scrollRect; // returns a copy
+            if (!variableRowHeight)
+                lo.setActualSize(lo.actualSize.x, rowHeight);
+            var dy:Number = lo.actualSize.y;
+            if ((explicitRowCount == -1) && (y < maxVisibleY) && ((y + dy) > minVisibleY))
+            	visibleRows += 1;
+            y += dy + gap;
+        }
+        if (explicitRowCount == -1)
+        	setRowCount(visibleRows);
+
+        var r:Rectangle = layoutTarget.scrollRect;
         if (r != null)
         {
             r.width = unscaledWidth;


improved populateGrid()

improved populateGrid()

--- WeaveUI/src/weave/ui/CustomGrid.as
+++ WeaveUI/src/weave/ui/CustomGrid.as
@@ -18,12 +18,17 @@
 */
 package weave.ui
 {
+	import avmplus.getQualifiedClassName;
+
 	import flash.display.DisplayObject;
 	import flash.display.DisplayObjectContainer;

 	import mx.containers.Grid;
 	import mx.containers.GridItem;
 	import mx.containers.GridRow;
+	import mx.core.Container;
+
+	import weave.core.ClassUtils;

 	[DefaultProperty("dataProvider")]

@@ -83,10 +88,10 @@
 		 * Populates a Grid with a set of items.  It also copies the horizontalAlign and verticalAlign styles from the Grid to each GridItem.
 		 * @param grid A Grid container.
 		 * @param items A two-dimensional Array of items
-		 * @param generator A function that accepts an item and returns a DisplayObject.
+		 * @param generator A Class that extends Container, or a Function that accepts an item and returns a DisplayObject.
 		 * @param visitor A function that accepts a GridItem object.
 		 */
-		public static function populateGrid(grid:Grid, dataProvider:Array, generator:Function = null, visitor:Function = null):void
+		public static function populateGrid(grid:Grid, dataProvider:Array, generator:Object = null, visitor:Function = null):void
 		{
 			var gridRows:Array = initChildren(grid, dataProvider.length, GridRow);
 			for (var r:int = 0; r < gridRows.length; r++)
@@ -98,15 +103,28 @@
 				for (var c:int = 0; c < gridItems.length; c++)
 				{
 					var gridItem:GridItem = gridItems[c] as GridItem;
-					initChildren(gridItem, 0, null);
+					var children:Array = initChildren(gridItem, 1, generator as Class);
 					gridRow.addChild(gridItem);
 					var dataItem:Object = dataRow[c];
-					var displayObject:DisplayObject = generator is Function
-						? generator(dataItem) as DisplayObject
-						: dataItem as DisplayObject;
+					var displayObject:DisplayObject = dataItem as DisplayObject;
+					if (generator is Function)
+					{
+						displayObject = generator(dataItem) as DisplayObject;
+					}
+					else if (generator is Class)
+					{
+						if (!ClassUtils.classExtends(getQualifiedClassName(generator), getQualifiedClassName(Container)))
+							throw new Error("If generator is a Class, it must extend Container.");
+						var GeneratorClass:Class = generator as Class;
+						var container:Container = (children[0] as GeneratorClass || new GeneratorClass()) as Container;
+						if (container)
+						{
+							displayObject = container;
+							container.data = dataItem;
+						}
+					}
 					if (displayObject)
 						gridItem.addChild(displayObject);
-
 					for each (var style:String in ['horizontalAlign', 'verticalAlign'])
 						gridItem.setStyle(style, grid.getStyle(style));

@@ -116,18 +134,24 @@
 			}
 		}

-		private static function initChildren(container:DisplayObjectContainer, desiredNumber:int, type:Class):Array
+		private static function initChildren(container:DisplayObjectContainer, desiredNumber:uint, type:Class):Array
 		{
+			// remove unwanted children
+			var i:int = container.numChildren;
+			while (i-- && type && !(container.getChildAt(0) is type))
+				container.removeChildAt(i);
+
 			// remove extra children
-			while (container.numChildren > desiredNumber)
-				container.removeChildAt(container.numChildren - 1);
+			i = container.numChildren;
+			while (i-- > desiredNumber)
+				container.removeChildAt(i);

 			var result:Array = [];
-			for (var i:int = 0; i < desiredNumber; i++)
+			for (i = 0; i < desiredNumber; i++)
 			{
 				if (i < container.numChildren) // existing child
 					result.push(container.getChildAt(i));
-				else // new child
+				else if (type) // new child
 					result.push(container.addChild(new type()));
 			}
 			return result;


Fixed line endings of InjectionConfig

Fixed line endings of InjectionConfig

--- src/org/swiftsuspenders/InjectionConfig.as
+++ src/org/swiftsuspenders/InjectionConfig.as
@@ -1,64 +1,64 @@
-/*
-* Copyright (c) 2009 the original author or authors
-*
-* Permission is hereby granted to use, modify, and distribute this file
-* in accordance with the terms of the license agreement accompanying it.
-*/
-
-package org.swiftsuspenders
-{
+/*
+* Copyright (c) 2009 the original author or authors
+*
+* Permission is hereby granted to use, modify, and distribute this file
+* in accordance with the terms of the license agreement accompanying it.
+*/
+
+package org.swiftsuspenders
+{
 	import org.swiftsuspenders.injectionresults.InjectionResult;
-
-	public class InjectionConfig
-	{
-		/*******************************************************************************************
-		 *								public properties										   *
-		 *******************************************************************************************/
-		public var request : Class;
-		public var injectionName : String;
-
-
-		/*******************************************************************************************
-		 *								private properties										   *
-		 *******************************************************************************************/
-		private var m_injector : Injector;
-		private var m_result : InjectionResult;
-
-
-		/*******************************************************************************************
-		 *								public methods											   *
-		 *******************************************************************************************/
-		public function InjectionConfig(
-			request : Class, injectionName : String, injector : Injector)
-		{
-			this.request = request;
-			this.injectionName = injectionName;
-			m_injector = injector;
-		}
-
-		public function getResponse() : Object
-		{
-			if (m_result)
-			{
-				return m_result.getResponse();
-			}
-			var parentConfig : InjectionConfig = m_injector.getParentMapping(request, injectionName);
-			if (parentConfig)
-			{
-				return parentConfig.getResponse();
-			}
-			return null;
-		}
-
-		public function setResult(result : InjectionResult) : void
-		{
-			m_result = result;
-		}
-
-		public function setInjector(injector : Injector) : void
-		{
-			m_injector = injector;
-			m_result.setInjector(injector);
-		}
-	}
+
+	public class InjectionConfig
+	{
+		/*******************************************************************************************
+		 *								public properties										   *
+		 *******************************************************************************************/
+		public var request : Class;
+		public var injectionName : String;
+
+
+		/*******************************************************************************************
+		 *								private properties										   *
+		 *******************************************************************************************/
+		private var m_injector : Injector;
+		private var m_result : InjectionResult;
+
+
+		/*******************************************************************************************
+		 *								public methods											   *
+		 *******************************************************************************************/
+		public function InjectionConfig(
+			request : Class, injectionName : String, injector : Injector)
+		{
+			this.request = request;
+			this.injectionName = injectionName;
+			m_injector = injector;
+		}
+
+		public function getResponse() : Object
+		{
+			if (m_result)
+			{
+				return m_result.getResponse();
+			}
+			var parentConfig : InjectionConfig = m_injector.getParentMapping(request, injectionName);
+			if (parentConfig)
+			{
+				return parentConfig.getResponse();
+			}
+			return null;
+		}
+
+		public function setResult(result : InjectionResult) : void
+		{
+			m_result = result;
+		}
+
+		public function setInjector(injector : Injector) : void
+		{
+			m_injector = injector;
+			m_result.setInjector(injector);
+		}
+	}
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 5859
Author:   rfrishbe@adobe.com
Date:     2009-04-01T23:13:22.675548Z

Log Message:
-----------
Adding FLVPlayback source code to Flex 4 project, rather than using a pre-built SWC.

Some video PARB changes:

Class Name Changes:
Rename VideoDisplay -> VideoPlayer
Combine MetadataEvent and VideoEvent into VideoEvent

Video property/method changes:
isLive -> live
isPlaying -> playing
isMuted -> muted
mute(), unmute() -> muted getter/setter

Also fixed a bug where VideoPlayer wasn't properly re-dispatching events.

QE Notes: -
Doc Notes: -
Bugs: -
Reviewer: Deepa
tests: checkintests

Modified Paths:
--------------
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoScaleMode.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/events/VideoEvent.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoDisplayPlayPauseButtonSkin.mxml" copyfrom-rev="5766" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoPlayerPlayPauseButtonSkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/ConnectClient.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/flvplayback_internal.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoDisplay.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/NCManager.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/libs/videoPlayer.swc</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoProgressEvent.as</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/FMSCapabilities.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/ConnectClientNative.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoDisplayPlayPauseButtonSkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/NCManagerNative.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/INCManager.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoDisplayMuteButtonSkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoState.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/ComponentVersion.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/ConnectClientDynamicStream.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoDisplaySkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/DynamicStreamItem.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/ReconnectClient.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoError.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoDisplay.as" copyfrom-rev="5766" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoPlayer.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoAlign.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoPlayerClient.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoPlayer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/VideoElement.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/DVRManager.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/QueuedCommand.as</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/Flex4Classes.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/defaults-3.0.0.css</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/ParseResults.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoDisplayMuteButtonSkin.mxml" copyfrom-rev="5766" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoPlayerMuteButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/build.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/defaults.css</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/SMILManager.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/events/MetadataEvent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/IVPEvent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/DynamicStream.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoDisplay.png" copyfrom-rev="5766" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoPlayer.png</path>
<path kind="file" action="M">/flex/sdk/trunk/build.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/FPADManager.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoDisplaySkin.mxml" copyfrom-rev="5766" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/VideoPlayerSkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/AutoLayoutEvent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/VideoEvent.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoDisplay.png</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/NCManagerDynamicStream.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/LayoutEvent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/FPMediaCapabilities.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/fl/video/MetadataEvent.as</path>

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

--- frameworks/projects/spark/src/SparkClasses.as
+++ frameworks/projects/spark/src/SparkClasses.as
@@ -54,7 +54,7 @@
 import spark.skins.default.TextAreaSkin; TextAreaSkin;
 import spark.skins.default.TextInputSkin; TextInputSkin;
 import spark.skins.default.ToggleButtonSkin; ToggleButtonSkin;
-import spark.skins.default.VideoDisplaySkin; VideoDisplaySkin;
+import spark.skins.default.VideoPlayerSkin; VideoPlayerSkin;
 import spark.skins.default.VScrollBarSkin; VScrollBarSkin;
 import spark.skins.default.VScrollBarThumbSkin; VScrollBarThumbSkin;
 import spark.skins.default.VSliderSkin; VSliderSkin;


Added coloring for ports

Added coloring for ports

--- src/Displays/DPort.as
+++ src/Displays/DPort.as
@@ -5,6 +5,7 @@
 	import Layouts.PortLayout;
 	import org.flixel.FlxPoint;
 	import org.flixel.FlxSprite;
+	import Values.Value;

 	/**
 	 * ...
@@ -19,10 +20,10 @@
 			port = Layout.port;
 			super();
 			if (layout.vertical) {
-				makeGraphic(3, U.GRID_DIM / 2, 0xff000000);
+				makeGraphic(3, U.GRID_DIM / 2, 0xffffffff);
 				offset.x = width / 2;
 			} else {
-				makeGraphic(U.GRID_DIM / 2, 3, 0xff000000);
+				makeGraphic(U.GRID_DIM / 2, 3, 0xffffffff);
 				offset.y = height / 2;
 			}
 		}
@@ -38,6 +39,24 @@
 			}
 		}

+		override public function draw():void {
+			color = getColor();
+			super.draw();
+		}
+
+		protected function getColor():uint {
+			if (!port.getSource())
+				return 0xff0000;
+
+			var value:Value = port.getValue();
+			if (value.unknown)
+				return 0xc219d9;
+			else if (value.unpowered)
+				return 0x1d19d9;
+			else
+				return 0x0;
+		}
+
 		public function nearPoint(p:FlxPoint, radius:int = 0):Boolean {
 			return p.x + radius >= x && p.y + radius >= y && p.x - radius <= x + width && p.y - radius <= y + height;
 		}


LinkableHashMap now uses registered display name to generate a new name when requesting object with name ''

--- WeaveJS/src/weavejs/core/LinkableHashMap.as
+++ WeaveJS/src/weavejs/core/LinkableHashMap.as
@@ -15,12 +15,13 @@

 package weavejs.core
 {
+	import weavejs.WeaveAPI;
 	import weavejs.api.core.DynamicState;
 	import weavejs.api.core.ICallbackCollection;
 	import weavejs.api.core.IChildListCallbackInterface;
 	import weavejs.api.core.ILinkableHashMap;
 	import weavejs.api.core.ILinkableObject;
-	import weavejs.util.JS;
+	import weavejs.util.JS;

 	/**
 	 * Allows dynamically creating instances of objects implementing ILinkableObject at runtime.
@@ -264,13 +265,19 @@
 		{
 			if (className)
 			{
-				// if no name is specified, generate a unique one now.
-				if (!name)
-					name = generateUniqueName(className.split('::').pop().split('.').pop());
-				var classDef:Class = Weave.getDefinition(className);
-				if (Weave.isLinkable(classDef)
+				var classDef:Class = Weave.getDefinition(className);
+				if (Weave.isLinkable(classDef)
 					&& (_typeRestriction == null || classDef === _typeRestriction || classDef.prototype is _typeRestriction) )
 				{
+					// if no name is specified, generate a unique one now.
+					if (!name)
+					{
+						var baseName:String = className.split('::').pop().split('.').pop();
+						if (name == '')
+							baseName = WeaveAPI.ClassRegistry.getDisplayName(classDef) || baseName;
+						name = generateUniqueName(baseName);
+					}
+
 //					try
 //					{
 						// If this name is not associated with an object of the specified type,
@@ -296,7 +303,7 @@
 			{
 				removeObject(name);
 			}
-			return _nameToObjectMap[name];
+			return _nameToObjectMap[name || ''];
 		}

 		/**


fix typo

fix typo

--- src/aerys/minko/scene/controller/scene/RenderingController.as
+++ src/aerys/minko/scene/controller/scene/RenderingController.as
@@ -281,7 +281,7 @@
 				pass.end.execute(pass, context, backBuffer);
 			}

-			// force clear is nothing was rendered
+			// force clear if nothing was rendered
 			if (numTriangles == 0)
 			{
 				var color : uint = backBuffer.backgroundColor;


Check drawCalls existence in meshFrameChangeHandler

--- src/aerys/minko/scene/controller/scene/RenderingController.as
+++ src/aerys/minko/scene/controller/scene/RenderingController.as
@@ -668,10 +668,11 @@
 			var mesh		: Mesh				= bindings.owner as Mesh;
 			var geom		: Geometry			= mesh.geometry;

-			if (!geom)
+			var drawCalls	: Vector.<DrawCall>	= _meshToDrawCalls[mesh];
+
+			if (!geom || !drawCalls)
 				return ;

-			var drawCalls	: Vector.<DrawCall>	= _meshToDrawCalls[mesh];
 			var numCalls	: uint				= drawCalls.length;

 			for (var callId : uint = 0; callId < numCalls; ++callId)


Added unit tests for the rest of the constructor.

--- unittests/TestArgumentSchemes.as
+++ unittests/TestArgumentSchemes.as
@@ -11,7 +11,7 @@
 		[Before]
 		public function setUp():void
 		{
-			argSchemes = new ArgumentSchemes("Basic claim", "Basic Reason".split(""), false, "Basic Inference", true);
+			argSchemes = new ArgumentSchemes("Basic Claim", "Basic Reason".split(""), false, "Basic Inference", true);
 		}

 		[After]
@@ -31,8 +31,17 @@
 		}

 		[Test]
-		public function testConstructor():void{
-			Assert.assertEquals("Basic claim", argSchemes.getClaim());
+		public function testConstructorClaim():void{
+			Assert.assertEquals("Basic Claim", argSchemes.getClaim());
+		}
+		[Test]
+		public function testConstructorReason():void{
+			Assert.assertEquals("Basic Reason".split("").toString(), argSchemes.getReason().toString());
+		}
+		[Test]
+		public function testConstructorInference():void{
+			//Don't test this until we know what to use in args to getInference(selectFunction:String)
+			//Assert.assertEquals("Basic Inference", argSchemes.getInference(""));
 		}
 	}
 }


Level : getSeqNumFromProgramDate() optimize

don't iterate if target program date is higher than last fragment program date
related to https://github.com/mangui/flashls/issues/405

--- src/org/mangui/hls/model/Level.as
+++ src/org/mangui/hls/model/Level.as
@@ -99,10 +99,17 @@
                 return -1;

             var len : int = fragments.length;
-            for (var i : int = 0; i < len; i++) {
-                /* check whether fragment contains current position */
-                if (fragments[i].data.valid && fragments[i].program_date <= program_date && fragments[i].program_date + 1000 * fragments[i].duration > program_date) {
-                    return (start_seqnum + i);
+            if(len) {
+                if (program_date > (fragments[len-1].program_date + 1000*fragments[len-1].duration))
+                    return -1;
+
+                for (var i : int = 0; i < len; i++) {
+                    /* check whether fragment contains current position */
+                    if (fragments[i].data.valid &&
+                        (fragments[i].program_date <= program_date) &&
+                        (fragments[i].program_date + 1000 * fragments[i].duration) > program_date) {
+                        return (start_seqnum + i);
+                    }
                 }
             }
             return -1;