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

--- frameworks/projects/rpc/src/mx/rpc/xml/SchemaManager.as
+++ frameworks/projects/rpc/src/mx/rpc/xml/SchemaManager.as
@@ -0,0 +1,466 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.rpc.xml
+{
+
+[ExcludeClass]
+
+/**
+ * SchemaManager manages multiple Schema definitions by target namespace.
+ *
+ * @private
+ */
+public class SchemaManager extends QualifiedResourceManager
+{
+    public function SchemaManager()
+    {
+        super();
+        initialScope = [];
+        schemaStack = [];
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    //
+    //--------------------------------------------------------------------------
+
+    public function get namespaces():Object
+    {
+        if (_namespaces == null)
+            _namespaces = {};
+
+        return _namespaces;
+    }
+
+    public function set namespaces(value:Object):void
+    {
+        _namespaces = value;
+    }
+
+    /**
+     * The constants for the version of Schema that is to be used
+     * in the type system associated with this manager, such as a WSDL
+     * types definition.
+     *
+     * FIXME: Verify that it is legal for a type system to refer to two
+     * different Schemas that use different version of the XML Schema
+     * specification? If so, then the schemaConstants could be obtained
+     * from each Schema.
+     */
+    public function get schemaConstants():SchemaConstants
+    {
+        if (_schemaConstants == null)
+            _schemaConstants = SchemaConstants.getConstants();
+
+        return _schemaConstants;
+    }
+
+    public function set schemaConstants(value:SchemaConstants):void
+    {
+        _schemaConstants = value;
+    }
+
+    public function get schemaMarshaller():SchemaMarshaller
+    {
+        if (_schemaMarshaller == null)
+        {
+            _schemaMarshaller = new SchemaMarshaller(schemaConstants, schemaDatatypes);
+        }
+        return _schemaMarshaller;
+    }
+
+    public function get schemaDatatypes():SchemaDatatypes
+    {
+        if (_schemaDatatypes == null)
+        {
+            _schemaDatatypes = SchemaDatatypes.getConstants(schemaConstants.xsdURI);
+        }
+        return _schemaDatatypes;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+    public function addNamespaces(map:Object):void
+    {
+        for (var prefix:String in map)
+        {
+            var ns:Namespace = map[prefix] as Namespace;
+            namespaces[prefix] = ns;
+        }
+    }
+
+    /**
+     * Adds a Schema to the current scope. If a Schema already exists in
+     * the scope then the scope is promoted to an Array of Schemas.
+     */
+    public function addSchema(schema:Schema, toCurrentScope:Boolean = true):void
+    {
+        addResource(schema.targetNamespace, schema);
+
+        var schemaSet:Array;
+        if (toCurrentScope == true)
+            schemaSet = schemaStack.pop();
+
+        if (schemaSet == null)
+            schemaSet = [];
+
+        schemaSet.push(schema);
+        if (!schemaSet.hasOwnProperty("current"))
+            schemaSet["current"] = schemaSet[0];
+
+        schemaStack.push(schemaSet);
+
+        // We keep track of the initial scope for reset()
+        if (schemaStack.length == 1)
+            initialScope = schemaStack[0];
+    }
+
+    /**
+     * Returns the Schema that was last used to retrieve a definition.
+     */
+    public function get currentSchema():Schema
+    {
+        var schema:Schema;
+
+        var schemaSet:Array = currentScope();
+        if (schemaSet.hasOwnProperty("current"))
+            schema = schemaSet["current"];
+
+        return schema;
+    }
+
+    public function currentScope():Array
+    {
+        var current:Array = schemaStack.pop();
+        if (current != null)
+            schemaStack.push(current);
+        else
+            current = [];
+        return current;
+    }
+
+    /**
+     * Look for the definition of the given QName in all schemas in the current
+     * scope. If the definition could not be found the function returns null.
+     *
+     * @param name The name of the component defined in a schema.
+     * @param componentTypes A list of structural element types that may have
+     * the name provided, such as <element>, <complexType>, <simpleType>,
+     * <attribute> or <attributeGroup>. The first one found is returned.
+     */
+    public function getNamedDefinition(name:QName, ...componentTypes:Array):XML
+    {
+        var schemas:Array = currentScope();
+
+        for (var s:int = 0; s < schemas.length; s++)
+        {
+            var schema:Schema = schemas[s];
+            componentTypes.unshift(name);
+            var result:Object = schema.getNamedDefinition.apply(schema, componentTypes);
+            if (result != null)
+            {
+                var definition:XML = result.definition as XML;
+                pushSchemaInScope(result.schema);
+                return definition;
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Locate a schema for the given namespace and push it to a
+     * new scope level.
+     */
+    public function pushNamespaceInScope(nsParam:*):Boolean
+    {
+        var ns:Namespace = new Namespace(nsParam);
+        var schemas:Array = currentScope();
+
+        for (var s:int = 0; s < schemas.length; s++)
+        {
+            var schema:Schema = schemas[s];
+            if (schema.targetNamespace.uri == ns.uri)
+            {
+                pushSchemaInScope(schema);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Push the given Schema to a new scope level, and set it as the
+     * current schema for that scope.
+     *
+     * @param schema The Schema to push to a new scope
+     */
+    public function pushSchemaInScope(schema:Schema):void
+    {
+        if (schema != null)
+        {
+            var newSchemaSet:Array = [ schema ];
+            newSchemaSet["current"] = newSchemaSet[0];
+            schemaStack.push(newSchemaSet);
+        }
+    }
+
+    /**
+     * @private FIXME: Find a better method name and/or document
+     */
+    public function getOrCreatePrefix(uri:String):String
+    {
+        var result:String;
+        var ns:Namespace;
+
+        // Check top level namespaces
+        for each (ns in namespaces)
+        {
+            if  (ns.uri == uri)
+            {
+                return ns.prefix;
+            }
+        }
+
+        // Check current schema namespaces
+        if (currentSchema != null)
+        {
+            var schemaNamespaces:Object = currentSchema.namespaces;
+            for each (ns in schemaNamespaces)
+            {
+                if  (ns.uri == uri)
+                {
+                    return ns.prefix;
+                }
+            }
+        }
+
+        var prefixString:String = "ns";
+        var nameSpace:Namespace;
+        var newPrefix:String = prefixString + namespaceCount;
+        if (namespaces[newPrefix] != null)
+        {
+            namespaceCount++;
+            newPrefix = prefixString + namespaceCount;
+            nameSpace = new Namespace(newPrefix, uri);
+            namespaces[newPrefix] = nameSpace;
+            return newPrefix;
+        }
+        else
+        {
+            nameSpace = new Namespace(newPrefix, uri);
+            namespaces[newPrefix] = nameSpace;
+            return newPrefix;
+        }
+        return null;
+    }
+
+    public function getQNameForAttribute(ncname:String, form:String = null):QName
+    {
+        var qname:QName;
+        if (form == "qualified"
+            || (form == null && currentSchema.attributeFormDefault == "qualified"))
+        {
+            qname = new QName(currentSchema.targetNamespace.uri, ncname);
+        }
+        else
+        {
+            qname = new QName("", ncname);
+        }
+        return qname;
+    }
+
+    public function getQNameForElement(ncname:String, form:String = null):QName
+    {
+        var qname:QName;
+        if (form == "qualified"
+            || ((form == null || form == "")
+                && currentSchema.elementFormDefault == "qualified"))
+        {
+            qname = new QName(currentSchema.targetNamespace.uri, ncname);
+        }
+        else
+        {
+            qname = new QName("", ncname);
+        }
+        return qname;
+    }
+
+
+    /**
+     * Resolves a prefixed name back into a QName based on the prefix to
+     * namespace mappings.
+     *
+     * @param prefixedName The name to be resolved. Can be prefixed or unqualified.
+     * @param parent The XML node where prefixedName appears. Allows local xmlns
+     * declarations to be examined
+     * @param qualifyToTargetNamespace A switch controlling the behavior for
+     * unqualified names. If false, unqualified names are assumed to be prefixed
+     * by "" and a xmlns="..." declaration is looked up. If no xmlns=".."
+     * declaration is in scope, and the parent node is in the default namespace,
+     * the prefixedName is resolved to the default namespace. Otherwise, it is
+     * resolved to the targetNamespace of the current schema. If qualifyToTargetNamespace
+     * is true, unqualified names are assumed to be in the target namespace of
+     * the current schema, regardless of declarations for unprefixed namespaces.
+     * qualifyToTargetNamespace should be true when resolving names coming from
+     * the following schema attributes: name, ref.
+     */
+    public function getQNameForPrefixedName(prefixedName:String, parent:XML=null,
+                                    qualifyToTargetNamespace:Boolean=false):QName
+    {
+        var qname:QName;
+
+        // Separate into prefix and local name
+        var prefix:String;
+        var localName:String;
+        var prefixIndex:int = prefixedName.indexOf(":");
+        if (prefixIndex > 0)
+        {
+            prefix = prefixedName.substr(0, prefixIndex);
+            localName = prefixedName.substr(prefixIndex + 1);
+        }
+        else
+        {
+            localName = prefixedName;
+        }
+
+        var ns:Namespace;
+
+        // First, map unqualified names to the target namespace, if the flag
+        // is explicitly set. (Used when looking up unqualified names by "ref")
+        if (prefix == null && qualifyToTargetNamespace == true)
+        {
+            ns = currentSchema.targetNamespace;
+        }
+
+        // Otherwise, assume that unqualified names are in the default namespace.
+        if (prefix == null)
+        {
+            prefix = "";
+        }
+
+        // First, check if a parent XML has a local definition for this
+        // namespace...
+        if (ns == null)
+        {
+            if (parent != null)
+            {
+                var localNamespaces:Array = parent.inScopeNamespaces();
+                for each (var localNS:Namespace in localNamespaces)
+                {
+                    if (localNS.prefix == prefix)
+                    {
+                        ns = localNS;
+                        break;
+                    }
+                }
+            }
+        }
+
+        // Next, check top level namespaces
+        if (ns == null)
+        {
+            ns = namespaces[prefix];
+        }
+
+        // Next, check current schema namespaces
+        if (ns == null)
+        {
+            ns = currentSchema.namespaces[prefix];
+        }
+
+        if (ns == null)
+        {
+            // Check if parent XML node is in the default namespace
+            var parentNS:Namespace = (parent != null) ? parent.namespace() : null;
+            if (parentNS != null && parentNS.prefix == "")
+                ns = parentNS;
+            // Otherwise we use the target namespace of the current definition
+            else
+                ns = currentSchema.targetNamespace;
+        }
+
+        if (ns != null)
+            qname = new QName(ns.uri, localName);
+        else
+            qname = new QName("", localName);
+
+        return qname;
+    }
+
+    /**
+     * Converts ActionScript to XML based on default rules
+     * established for each of the built-in XML Schema types.
+     */
+    public function marshall(value:*, type:QName = null, restriction:XML = null):String
+    {
+        return schemaMarshaller.marshall(value, type, restriction);
+    }
+
+    /**
+     * Informs the SchemaManager that the current definition is no
+     * longer being processed so we release the associated Schema from the
+     * current scope of qualified definitions.
+     */
+    public function releaseScope():*
+    {
+        return schemaStack.pop();
+    }
+
+    /**
+     * Reverts to initialScope.
+     */
+    public function reset():void
+    {
+        namespaceCount = 0;
+        schemaStack = [];
+        schemaStack.push(initialScope);
+    }
+
+    /**
+     * Converts XML to ActionScript based on default rules
+     * established for each of the built-in XML Schema types.
+     */
+    public function unmarshall(value:*, type:QName = null, restriction:XML = null):*
+    {
+        return schemaMarshaller.unmarshall(value, type, restriction);
+    }
+
+
+    //--------------------------------------------------------------------------
+    //
+    // Private Variables
+    //
+    //--------------------------------------------------------------------------
+
+    private var namespaceCount:uint = 0;
+
+    /**
+     * A Stack of Schemas which records the current scope and the last Schema
+     * that was accessed to locate a definition. Multiple Schemas may be
+     * placed in Scope at any level by adding them to the Stack as an Array.
+     */
+    private var schemaStack:Array;
+    private var initialScope:*;
+    private var _namespaces:Object;
+    private var _schemaMarshaller:SchemaMarshaller;
+    private var _schemaConstants:SchemaConstants;
+    private var _schemaDatatypes:SchemaDatatypes;
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 6747
Author:   clucier@adobe.com
Date:     2009-05-08T09:56:03.784265Z

Log Message:
-----------
Fixing integration blocker. Protecting graphics code from the possibility of
unscaledWidth or unscaledHeight being NaN.
Bugs: SDK-21023.
QE Notes: None

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Group.as

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

--- frameworks/projects/spark/src/spark/components/Group.as
+++ frameworks/projects/spark/src/spark/components/Group.as
@@ -846,7 +846,8 @@
             graphics.clear();

         // Render a transparent background fill as necessary to support the mouseOpaque flag.
-        if (_mouseOpaque && mouseEventReferenceCount != 0)
+        if ( _mouseOpaque && mouseEventReferenceCount != 0
+             && !isNaN(unscaledHeight) && !isNaN(unscaledWidth))
         {
             graphics.beginFill(0xFFFFFF, 0);
             graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);


Transferred from the Adobe Open Source Subversion Repository

Revision: 7301
Author:   gruehle@adobe.com
Date:     2009-05-27T04:34:08.199475Z

Log Message:
-----------
Scale grid bug fix. Need to make sure the extent of the group bounds is filled in order for the player to scale things correctly.

Bugs: SDK-20603
Reviwer: Jason
Doc/QA Notes: None

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/ButtonBarLastButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/ButtonBarFirstButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/SpinnerIncrButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/SpinnerDecrButtonSkin.mxml</path>

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

--- frameworks/projects/spark/src/spark/components/Group.as
+++ frameworks/projects/spark/src/spark/components/Group.as
@@ -775,6 +775,17 @@
         {
             graphics.clear();
             renderFillForMouseOpaque();
+
+            // If a scaleGrid is set, make sure the extent of the groups bounds are filled so
+            // the player will scale our contents as expected.
+            if (scale9Grid && resizeMode == ResizeMode.SCALE)
+            {
+                graphics.lineStyle();
+                graphics.beginFill(0, 0);
+                graphics.drawRect(0, 0, 1, 1);
+                graphics.drawRect(measuredWidth - 1, measuredHeight - 1, 1, 1);
+                graphics.endFill();
+            }
         }

         // Iterate through the graphic elements. If an element has a displayObject that has been


Transferred from the Adobe Open Source Subversion Repository

Revision: 19985
Author:   mhorn@adobe.com
Date:     2011-01-27T20:21:44.818020Z

Log Message:
-----------
ASDoc updates

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/modules/ModuleLoader.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/modules/Module.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/modules/ModuleLoader.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mx/src/mx/modules/Module.as</path>

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

--- frameworks/projects/mx/src/mx/modules/Module.as
+++ frameworks/projects/mx/src/mx/modules/Module.as
@@ -16,12 +16,14 @@

 [Frame(factoryClass="mx.core.FlexModuleFactory")]

+[Alternative(replacement="spark.modules.Module", since="4.5")]
+
 /**
  *  The base class for MXML-based dynamically-loadable modules. You extend this
  *  class in MXML by using the <mx:Module> tag in an MXML file, as the
  *  following example shows:
  *
- *

+ *

  *  <?xml version="1.0"?>
  *  <!-- This module loads an image. -->
  *  <mx:Module  width="100%" height="100%" xmlns:mx="http://www.adobe.com/2006/mxml">
@@ -29,7 +31,7 @@
  *    <mx:Image source="trinity.gif"/>
  *
  *  </mx:Module>
- *

+ *

  *
  *
Extending the Module class in ActionScript is the same as using the <mx:Module> tag
  *  in an MXML file. You extend this class if your module interacts with the framework.


Moved to whirled/contrib.

Moved to whirled/contrib.

git-svn-id: a3e1eb16dde062992de22c830ed8045c8013209a@544 c613c5cb-e716-0410-b11b-feb51c14d237

--- src/as/com/threerings/ezgame/CardDeck.as
+++ src/as/com/threerings/ezgame/CardDeck.as
@@ -1,64 +0,0 @@
-//
-// $Id$
-//
-// Vilya library - tools for developing networked games
-// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
-// http://www.threerings.net/code/vilya/
-//
-// This library is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License as published
-// by the Free Software Foundation; either version 2.1 of the License, or
-// (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-package com.threerings.ezgame {
-
-/**
- * A simple card deck that encodes cards as a string like "Ac" for the
- * ace of clubs, or "Td" for the 10 of diamonds.
- */
-public class CardDeck
-{
-    public function CardDeck (gameCtrl :EZGameControl, deckName :String = "deck")
-    {
-        _gameCtrl = gameCtrl;
-        _deckName = deckName;
-
-        var deck :Array = new Array();
-        for each (var rank :String in ["2", "3", "4", "5", "6", "7", "8",
-                "9", "T", "J", "Q", "K", "A"]) {
-            for each (var suit :String in ["c", "d", "h", "s"]) {
-                deck.push(rank + suit);
-            }
-        }
-
-        _gameCtrl.services.bags.create(_deckName, deck);
-    }
-
-    public function dealToPlayer (
-        playerId :int, count :int, msgName :String) :void
-    {
-        // TODO: support the callback
-        _gameCtrl.services.bags.deal(_deckName, count, msgName, null, playerId);
-    }
-
-    public function dealToData (count :int, propName :String) :void
-    {
-        _gameCtrl.services.bags.deal(_deckName, count, propName, null);
-    }
-
-    /** The game control. */
-    protected var _gameCtrl :EZGameControl;
-
-    /** The name of our deck. */
-    protected var _deckName :String;
-}
-}


Added bytesToString() and stringToBytes().

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@4733 542714f4-19e9-0310-aa3c-eee0fc999fb1

--- src/as/com/threerings/util/StringUtil.as
+++ src/as/com/threerings/util/StringUtil.as
@@ -246,6 +246,35 @@
     }

     /**
+     * Turn the specified byte array, containing only ascii characters, into a String.
+     */
+    public static function fromBytes (bytes :ByteArray) :String
+    {
+        var s :String = "";
+        if (bytes != null) {
+            for (var ii :int = 0; ii < bytes.length; ii++) {
+                s += String.fromCharCode(bytes[ii]);
+            }
+        }
+        return s;
+    }
+
+    /**
+     * Turn the specified String, containing only ascii characters, into a ByteArray.
+     */
+    public static function toBytes (s :String) :ByteArray
+    {
+        if (s == null) {
+            return null;
+        }
+        var ba :ByteArray = new ByteArray();
+        for (var ii :int = 0; ii < s.length; ii++) {
+            ba[ii] = int(s.charCodeAt(ii)) & 0xFF;
+        }
+        return ba;
+    }
+
+    /**
      * Generates a string from the supplied bytes that is the hex encoded
      * representation of those byts. Returns the empty String for a
      * null or empty byte array.


Fix AxisTransmit events

Fix AxisTransmit events

--- src/com/axis/audioclient/AxisTransmit.as
+++ src/com/axis/audioclient/AxisTransmit.as
@@ -21,8 +21,8 @@
   import flash.utils.ByteArray;

   public class AxisTransmit implements IAudioClient {
-    private static const EVENT_AUDIO_TRANSMIT_STARTED:String = "audioTransmitStarted";
-    private static const EVENT_AUDIO_TRANSMIT_STOPPED:String = "audioTransmitStopped";
+    private static const EVENT_AUDIO_TRANSMIT_STARTED:String = 'audioTransmitStarted';
+    private static const EVENT_AUDIO_TRANSMIT_STOPPED:String = 'audioTransmitStopped';

     private var urlParsed:Object = {};
     private var conn:Socket = new Socket();
@@ -35,7 +35,7 @@
     private var mic:Microphone = Microphone.getMicrophone();
     private var _microphoneVolume:Number;

-    private var currentState:String = "stopped";
+    private var currentState:String = 'stopped';

     public function AxisTransmit() {
       /* Set default microphone volume */
@@ -105,7 +105,6 @@
     public function stop():void {
       if (!conn.connected) {
         ErrorManager.dispatchError(813);
-        this.callAPI(EVENT_AUDIO_TRANSMIT_STOPPED);
         return;
       }

@@ -113,6 +112,8 @@
         mic.removeEventListener(StatusEvent.STATUS, onMicStatus);
         mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, onMicSampleData);
       }
+      this.currentState = 'stopped';
+      this.callAPI(EVENT_AUDIO_TRANSMIT_STOPPED);
       conn.close();
     }

@@ -155,8 +156,8 @@
     }

     public function onClosed(event:Event):void {
-      if ("playing" === this.currentState) {
-        this.currentState = "stopped";
+      if ('playing' === this.currentState) {
+        this.currentState = 'stopped';
         this.callAPI(EVENT_AUDIO_TRANSMIT_STOPPED);
       }
     }
@@ -166,8 +167,8 @@
         return;
       }

-      if ("stopped" === this.currentState) {
-        this.currentState = "playing";
+      if ('stopped' === this.currentState) {
+        this.currentState = 'playing';
         this.callAPI(EVENT_AUDIO_TRANSMIT_STARTED);
       }


For 647184 - exactgc generator script should track conditional compilation directives: script update v2 (r=rulohani)

--- utils/exactgc.as
+++ utils/exactgc.as
@@ -115,13 +115,14 @@

 class GCClass
 {
-    function GCClass(tag, attr) {
+    function GCClass(tag, attr, _cond) {
         cls = getAttr(attr, 0);
         base = getAttr(attr, 1);
         hook = tag.match("_WITH_HOOK") != null;
         ifdef = tag.match("_IFDEF") != null ? getAttr(attr,2) : false;
         ifndef = tag.match("_IFNDEF") != null ? getAttr(attr,2) : false;
         if_ = !ifdef && !ifndef && tag.match("_IF") != null ? getAttr(attr,2) : false;
+        cond = _cond;
     }

     public function toString() { return printProps(this, ["cls","base","hook","ifdef"]) }
@@ -134,6 +135,7 @@
     const ifdef;
     const ifndef;
     const if_;
+    const cond;

     var fullClassPrefix=""; // for nested classes
     var out = new Printer(1);
@@ -145,14 +147,15 @@
     var hint = null;
 }

-class GCCppExact extends GCClass { function GCCppExact(tag,attr) { super(tag,attr) } }
-class GCAS3Exact extends GCClass { function GCAS3Exact(tag,attr) { super(tag,attr) } }
+class GCCppExact extends GCClass { function GCCppExact(tag,attr,cond) { super(tag,attr,cond) } }
+class GCAS3Exact extends GCClass { function GCAS3Exact(tag,attr,cond) { super(tag,attr,cond) } }

 // For GC_DATA_BEGIN and GC_DATA_END annotations in C++ classes.
 class GCDataSection
 {
-    function GCDataSection(tag, attr) {
+    function GCDataSection(tag, attr, cond) {
+        // ignore cond
         cls = getAttr(attr, 0);
     }

@@ -161,9 +164,9 @@
     const cls;
 }

-class GCDataBegin extends GCDataSection { function GCDataBegin(tag, attr) { super(tag,attr) } }
-class GCDataEnd extends GCDataSection { function GCDataEnd(tag, attr) { super(tag,attr) } }
-class GCNoData extends GCDataSection { function GCNoData(tag, attr) { super(tag,attr) } }
+class GCDataBegin extends GCDataSection { function GCDataBegin(tag, attr, cond) { super(tag,attr,cond) } }
+class GCDataEnd extends GCDataSection { function GCDataEnd(tag, attr, cond) { super(tag,attr,cond) } }
+class GCNoData extends GCDataSection { function GCNoData(tag, attr, cond) { super(tag,attr,cond) } }

 // For the various field annotations in C++ classes.
 //
@@ -182,12 +185,13 @@

 class GCField
 {
-    function GCField(tag, attr) {
+    function GCField(tag, attr, _cond) {
         cls = getAttr(attr, 0);
         name = getAttr(attr, 1);
         ifdef = tag.match("_IFDEF") != null ? getAttr(attr,2) : false;
         ifndef = tag.match("_IFNDEF") != null ? getAttr(attr,2) : false;
         if_ = !ifdef && !ifndef && tag.match("_IF") != null ? getAttr(attr,2) : false;
+        cond = _cond;
     }

     public function toString() { return printProps(this, ["cls","name","ifdef", "if_"]) }
@@ -197,18 +201,19 @@
     const ifdef;
     const ifndef;
     const if_;
-}
-
-class GCPointer extends GCField { function GCPointer(tag, attr) { super(tag, attr) } }
-class GCAtom extends GCField { function GCAtom(tag, attr) { super(tag, attr) } }
-class GCStructure extends GCField { function GCStructure(tag, attr) { super(tag, attr) } }
-class GCConservative extends GCField { function GCConservative(tag, attr) { super(tag, attr) } }
+    const cond;
+}
+
+class GCPointer extends GCField { function GCPointer(tag, attr, cond) { super(tag, attr, cond) } }
+class GCAtom extends GCField { function GCAtom(tag, attr, cond) { super(tag, attr, cond) } }
+class GCStructure extends GCField { function GCStructure(tag, attr, cond) { super(tag, attr, cond) } }
+class GCConservative extends GCField { function GCConservative(tag, attr, cond) { super(tag, attr, cond) } }

 class GCPointers extends GCField
 {
-    function GCPointers(tag, attr) {
+    function GCPointers(tag, attr, cond) {
         splitFieldAndSize(attr, 1);
-        super(tag,attr);
+        super(tag,attr,cond);
         declCount = getAttr(attr, 2);
         count = getAttr(attr, 3);
         hint = tag.match("_SMALL") != null ? "small" : null;
@@ -223,9 +228,9 @@

 class GCAtoms extends GCField
 {
-    function GCAtoms(tag, attr) {
+    function GCAtoms(tag, attr, cond) {
         splitFieldAndSize(attr, 1);
-        super(tag,attr);
+        super(tag,attr,cond);
         declCount = getAttr(attr, 2);
         count = getAttr(attr, 3);
         hint = tag.match("_SMALL") != null ? "small" : null;
@@ -240,9 +245,9 @@

 class GCStructures extends GCField
 {
-    function GCStructures(tag, attr) {
+    function GCStructures(tag, attr, cond) {
         splitFieldAndSize(attr, 1);
-        super(tag,attr);
+        super(tag,attr,cond);
         declCount = getAttr(attr, 2);
         count = getAttr(attr, 3);
         hint = tag.match("_SMALL") != null ? "small" : null;
@@ -302,6 +307,42 @@
     var indent = 0;
     var indentString = "";
     var output = "";
+}
+
+class Condition
+{
+    static const IF = 0;
+    static const IFDEF = 1;
+    static const IFNDEF = 2;
+    static const ELIF = 3;
+    static const ELSE = 4;
+    static const INERT = 5;
+
+    function Condition(_type, _cond, _butnot=null) {
+        type = _type;
+        cond = _cond;
+        butnot = _butnot;
+    }
+
+    public function toString() {
+        return "Cond: " + typeName + ": " + cond;
+    }
+
+    function get typeName() {
+        switch (type) {
+        case IF: return "if";
+        case IFDEF: return "ifdef";
+        case IFNDEF: return "ifndef";
+        case ELIF: return "elif";
+        case ELSE: return "else";
+        case INERT: return "inert";
+        default: return "XXX";
+        }
+    }
+
+    const type;
+    const cond;
+    const butnot;
 }

 const constructors =
@@ -554,6 +595,7 @@

     var cppClassStack = [];       // tracks GC_CPP_EXACT, etc
     var cppDataStack = [];        // tracks GC_DATA_BEGIN / GC_DATA_END
+    var cppIfStack = [];          // tracks #if, #ifdef, etc

     // TODO: factor regular expressions to avoid duplication?

@@ -627,6 +669,13 @@
         return xs;
     }

+    function copyIfStack() {
+        var v = [];
+        for ( var i=0 ; i < cppIfStack.length ; i++ )
+            v[i] = cppIfStack[i];
+        return v;
+    }
+
     function positionalAttrs(tag, s, paren, cls) {
         var attr = splitAttrs(s, paren);
         for ( var i=0 ; i < attr.length ; i++ ) {
@@ -635,7 +684,7 @@
         }
         if (cls != null)
             attr.unshift(cls);
-        return new constructors[tag](tag,attr);
+        return new constructors[tag](tag,attr,copyIfStack());
     }

     function parseNamedAttrs(s) {
@@ -736,12 +785,21 @@

     const nativeAnnotationRegex:RegExp = /^\[native\s*\((.*)\)\s*\]/;

+    function sanitizeCondition(s) {
+        s = s.replace(/^\s*|\s*$/g, "");
+        s = s.replace(/\/\*.*\*\/\s*$/g, "");  // strip /* .. */ comments first in case it contains an embedded //
+        s = s.replace(/\/\/.*$/g, "");
+        s = s.replace(/\s*$/g, "");
+        return s;
+    }
+
     // FIXME: Additional error checking we could add here:
     //  - only one data section per class, globally

     function processFile(filename) {
         cppDataStack.length = 0;
         cppClassStack.length = 0;
+        cppIfStack.length = 0;

         const beforeReadLines = new Date();
         const text = readLines(filename);
@@ -749,6 +807,7 @@

         const beforeProcessing = new Date();
         const cppfile = Boolean(filename.match(/\.(h|cpp)$/));
+        const hfile = Boolean(filename.match(/\.h$/));
         const as3file = Boolean(filename.match(/\.as$/));
         var lineno = 0;

@@ -764,11 +823,14 @@

             var gcIndex = -1;
             var nativeIndex = -1;
-            if (!as3file)
+            var cppIndex = -1;
+            if (!as3file) {
                 gcIndex = line.indexOf("GC_");
+                cppIndex = line.indexOf("#");
+            }
             if (!cppfile)
                 nativeIndex = line.indexOf("[native");
-            if (gcIndex == -1 && nativeIndex == -1)
+            if (gcIndex == -1 && cppIndex == -1 && nativeIndex == -1)
                 continue;

             errorContext = "On " + filename + " line " + lineno;
@@ -778,6 +840,65 @@
             // known-good index.  This yields the same performance as
             // using a global regex and setting lastIndex to indicate
             // where we want to start matching.
+
+            if (cppIndex >= 0) {
+                // CPP macro?
+                //
+                // There are two options for handling elif / else:
+                //
+                //  - break them out as separate #ifdefs by accumulating (and negating) conditions
+                //  - preserve the elif / else structure
+                //
+                // I've gone with the former because it fits the structure of existing code, but
+                // if the resulting condtions end up being messy, or it becomes unreliable for
+                // any reason, then we should reconsider.  In practice most conditions are simple
+                // and #if..elif chains are not long.  The main liability is that we sort field names
+                // lexicographically so clauses may become reorganized on output; this does not lead
+                // to bugs but makes the code confusing to read.
+
+                if ((result = (/^#\s*(ifdef|ifndef|if|elif|else|endif|define)/).exec(line.substring(cppIndex))) != null) {
+                    var rest = sanitizeCondition(line.substring(cppIndex + result[0].length));
+                    var directive = result[1];
+                    switch (directive) {
+                    case "ifdef":
+                        cppIfStack.push(new Condition(Condition.IFDEF, rest));
+                        break;
+                    case "ifndef":
+                        cppIfStack.push(new Condition(Condition.IFNDEF, rest));
+                        break;
+                    case "define":
+                        // This is a hack, but it's necessary: if this is a header file, and the top element
+                        // is #ifndef, and the condition for that element is the same name that is being
+                        // defined here, then we replace the top element with an inert element.  This takes
+                        // care of the include-a-file-once idiom that would otherwise be hard to handle.
+                        if (hfile &&
+                            cppIfStack.length > 0 &&
+                            rest == cppIfStack[cppIfStack.length-1].cond) {
+                            cppIfStack.pop();
+                            cppIfStack.push(new Condition(Condition.INERT, rest));
+                        }
+                        break;
+                    case "if":
+                        cppIfStack.push(new Condition(Condition.IF, rest));
+                        break;
+                    case "elif":
+                        cppIfStack.length > 0 || fail("found #elif without matching #if, #ifdef, or #ifndef: " + line);
+                        var top = cppIfStack.pop();
+                        cppIfStack.push(new Condition(Condition.ELIF, rest, top));
+                        break;
+                    case "else": {
+                        cppIfStack.length > 0 || fail("found #else without matching #if, #ifdef, or #ifndef: " + line);
+                        var top = cppIfStack.pop();
+                        cppIfStack.push(new Condition(Condition.ELSE, null, top));
+                        break;
+                    }
+                    case "endif":
+                        cppIfStack.length > 0 || fail("found #endif without matching #if, #ifdef, or #ifndef: " + line);
+                        cppIfStack.pop();
+                        break;
+                    }
+                }
+            }

             if (gcIndex >= 0) {
                 // C++ annotations.
@@ -948,6 +1069,7 @@
         if (s.if_) fieldname += "!if!" + s.if_;
         if (s.ifdef) fieldname += "!ifdef!" + s.ifdef;
         if (s.ifndef) fieldname += "!ifndef!" + s.ifndef;
+        if (s.cond) fieldname += "!cond!" + makeConditions(s.cond);
         if (isVariableLength(s)) {
             // FIXME: It would be good to loosen the following restriction up; it
             // would be sufficient to decree that only one of the arrays can be
@@ -1008,22 +1130,111 @@
     }
 }

+// This stack is being used to filter our output so that we do not print
+// redundant conditions.
+
+const pendingConditions = [];
+
+function matchesPendingCondition(c) {
+    for ( var i=0 ; i < pendingConditions.length ; i++ ) {
+        var x = pendingConditions[i];
+        if (c.type == x.type && c.cond == x.cond)
+            return true;
+    }
+    return false;
+}
+
+// Explicit _IFDEF etc annotations take precedence over computed annotations,
+// this allows the explicit annotations to be used as an escape valve.
+
 function ifdefOpen(out, fieldOrClass)
 {
-    if (fieldOrClass.ifdef)
-        out.PR("#ifdef " + fieldOrClass.ifdef);
-
-    if (fieldOrClass.ifndef)
-        out.PR("#ifndef " + fieldOrClass.ifndef);
-
-    if (fieldOrClass.if_)
-        out.PR("#if " + fieldOrClass.if_);
-}
-
-function ifdefClose(out, fieldOrClass)
+    if (fieldOrClass.ifdef || fieldOrClass.ifndef || fieldOrClass.if_) {
+        if (fieldOrClass.ifdef)
+            out.PR("#ifdef " + fieldOrClass.ifdef);
+        if (fieldOrClass.ifndef)
+            out.PR("#ifndef " + fieldOrClass.ifndef);
+        if (fieldOrClass.if_)
+            out.PR("#if " + fieldOrClass.if_);
+    }
+    else {
+        var conds = fieldOrClass.cond;
+        for ( var i=0 ; i < conds.length ; i++ ) {
+            if (conds[i].type == Condition.INERT)
+                continue;
+            var skip = matchesPendingCondition(conds[i]);
+            pendingConditions.push(conds[i]);
+            if (skip)
+                continue;
+            out.PR("#if " + makeCondition(conds[i]));
+        }
+    }
+}
+
+function ifdefClose(out, fieldOrClass, withName = false)
 {
     if (fieldOrClass.ifdef || fieldOrClass.ifndef || fieldOrClass.if_)
         out.PR("#endif // " + (fieldOrClass.ifdef || fieldOrClass.ifndef || fieldOrClass.if_));
+    else {
+        var conds = fieldOrClass.cond;
+        for ( var i=0 ; i < conds.length ; i++ ) {
+            if (conds[i].type == Condition.INERT)
+                continue;
+            var x = pendingConditions.pop();
+            if (matchesPendingCondition(x))
+                continue;
+            out.PR("#endif" +( withName ? (" // " + makeCondition(x)) : ""));
+        }
+    }
+}
+
+// Returns something of this form:
+//
+//   C ::= defined( N )
+//       | ( E )
+//       | !C
+//       | C && C
+//
+//   N ::= <some identifier>
+//   E ::= <some expression>
+
+function makeCondition(c, negate=false) {
+    function neg(x) {
+        if (!negate)
+            return x;
+        if (x.charCodeAt(0) == "!")
+            return x.substring(1);
+        return "!" + x;
+    }
+    switch (c.type) {
+    case Condition.IF:
+        return neg("(" + c.cond + ")");
+    case Condition.IFDEF:
+        return neg("defined(" + c.cond + ")");
+    case Condition.IFNDEF:
+        return neg("!defined(" + c.cond + ")");
+    case Condition.ELIF:
+        // Here we put the butnot condition first to make it more obvious what's going on,
+        // though in practice it'll be pretty confusing to read the code since the field
+        // names are sorted lexicographically (earlier in this script) and may be sorted
+        // in some bizarre order at some future time in order to make multi-argument calls
+        // to TraceLocation.  See comments in the parsing code above about the plusses
+        // and minuses of breaking conditions apart rather than sticking with the if-elif-else
+        // structure.
+        return makeCondition(c.butnot, true) + " && " + neg("(" + c.cond + ")");
+    case Condition.ELSE:
+        return makeCondition(c.butnot, true);
+    case Condition.INERT:
+        return "1";
+    default:
+        fail("Internal error: makeCondition does not understand this condition : " + c);
+    }
+}
+
+// A hack, used for generating unique names way up above.
+
+function makeConditions(cs) {
+    return cs.map(function (x) { return makeCondition(x,false) }).join("!");
 }

 // If a class is large it could be because it has a pointer array or
@@ -1136,8 +1347,16 @@

     errorContext = "Accumulating bodies";

+    // Open and close ifdefs for the class on a dummy printer to avoid redundant
+    // ifdefs.  We need to do this because the tracer bodies are emitted separately
+    // and pasted into functions later.
+
+    var dummy = new Printer();
+
     for ( var i=0 ; i < cppClassList.length ; i++ ) {
         var c = cppClassList[i];
+
+        ifdefOpen(dummy, c);

         // The interlock is just a #define with that name emitted at
         // the beginning of the output, we'll get a compilation error
@@ -1171,6 +1390,8 @@
             if (c is GCClass && c.variable_length_field != null)
                 emitArrayUnchunked(c);
         }
+
+        ifdefClose(dummy, c, true);
     }
 }

@@ -1323,7 +1544,7 @@
                     PR("}").
                     NL();
             }
-            ifdefClose(output,c);
+            ifdefClose(output,c, true);
             output.NL();
         }
     }


Transferred from the Adobe Open Source Subversion Repository

Revision: 12850
Author:   jimurphy@adobe.com
Date:     2009-12-11T14:57:14.623098Z

Log Message:
-----------
add 6 new DMV projects to the SDK:
automation
automation_air
automation_dmv
automation_flashflexkit
automation_spark
datavisualization

These projects are setup to build in an ant main call.  There are currently several warnings in the datavisualization project that will be cleaned up.  No checkintests exist for these projects as of yet.

I also modified the exisitng projects build files for easier management of the localization targets, bundle and fat-swc. If the projects that I updated:airframework,airspark,framework,playerglobal,rpc,and spark.  All the new projects have been implemented this same way.

QE notes: DMV folks should run through their tests
Doc notes: probably
Bugs: nope
Reviewer:
Tests run: ran the following targets: compile,checkintests,other.locales and doc
Is noteworthy for integration: no

Modified Paths:
--------------
1404 paths were modified

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

--- frameworks/projects/advancedgrids/src/mx/olap/OLAPHierarchy.as
+++ frameworks/projects/advancedgrids/src/mx/olap/OLAPHierarchy.as
@@ -0,0 +1,655 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 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.olap
+{
+
+import flash.utils.Dictionary;
+import flash.utils.getTimer;
+
+import mx.collections.ArrayCollection;
+import mx.collections.ICollectionView;
+import mx.collections.IList;
+import mx.collections.IViewCursor;
+import mx.core.mx_internal;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  metadata
+//--------------------------------------
+
+[DefaultProperty("elements")]
+
+/**
+ *  The OLAPHierarchy class represents a hierarchy of the schema of an OLAP cube.
+ *
+ *  @mxml
+ *

+ *  The <mx:OLAPHierarchy> tag inherits all of the tag attributes
+ *  of its superclass, and adds the following tag attributes:
+ *

+ *

+ *  <mx:OLAPHierarchy
+ *    Properties
+ *    allMemberName="(All)"
+ *    elements="An array of Levels of this hierarchy"
+ *    hasAll="true|false"
+ *    name="No default"
+ *  />
+ *
+ *  @see mx.olap.IOLAPHierarchy
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class OLAPHierarchy extends OLAPElement implements IOLAPHierarchy
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor
+     *
+     *  @param name The name of the OLAP level that includes the OLAP schema hierarchy of the element.
+     *
+     *  @param displayName The name of the OLAP level, as a String, which can be used for display.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function OLAPHierarchy(name:String=null, displayName:String=null)
+    {
+        OLAPTrace.traceMsg("Creating hierarchy: " + name, OLAPTrace.TRACE_LEVEL_3);
+        //if (!name)
+        //  name = "Hierarchy";
+        super(name, displayName);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     * The all member of this hierarchy.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    mx_internal var allMember:OLAPMember;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    // hasAll
+    //----------------------------------
+
+    private var _hasAll:Boolean = true;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @default true
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+     public function get hasAll():Boolean
+    {
+        return _hasAll;
+    }
+
+    /**
+     *  @private
+     */
+     public function set hasAll(value:Boolean):void
+    {
+        //we need to recreate this.
+        if (_hasAll != value)
+            _allLevels = null;
+        _hasAll = value;
+    }
+
+    //----------------------------------
+    // levels
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    protected var _levels:IList = new ArrayCollection();
+
+    /**
+     *  @private
+     */
+    protected var _levelMap:Dictionary = new Dictionary(true);
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get levels():IList
+    {
+        return _levels;
+    }
+
+    /**
+     *  @private
+     */
+    public function set levels(value:IList):void
+    {
+        var level:OLAPLevel;
+        _levels = value;
+        _levelMap = new Dictionary(true);
+
+        var n:int = levels.length;
+        for (var i:int = 0; i < n; ++i)
+        {
+            level = levels.getItemAt(i) as OLAPLevel;
+            level.hierarchy = this;
+            _levelMap[level.attributeName] = level;
+        }
+    }
+
+    //----------------------------------
+    // elements
+    //----------------------------------
+
+    /**
+    *  An Array of the  levels of the hierarchy, as OLAPLevel instances.
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 9
+    *  @playerversion AIR 1.1
+    *  @productversion Flex 3
+    */
+    public function set elements(value:Array):void
+    {
+        levels = new ArrayCollection(value);
+    }
+
+    //----------------------------------
+    // allLevels
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    protected var _allLevels:IList;
+
+    /**
+     *  @private
+     */
+    mx_internal function get allLevels():IList
+    {
+        if (!_allLevels)
+        {
+            _allLevels = new ArrayCollection(_levels.toArray());
+            _allLevels.addItemAt(allLevel, 0);
+        }
+
+        return _allLevels;
+    }
+
+    //----------------------------------
+    // dataProvider
+    //----------------------------------
+
+    private var _dataProvider:ICollectionView;
+
+    /**
+     *  @private
+     */
+    public function get dataProvider():ICollectionView
+    {
+        if (_dataProvider)
+            return _dataProvider;
+        return OLAPDimension(dimension).dataProvider;
+    }
+
+    /**
+     *  @private
+     */
+    public function set dataProvider(value:ICollectionView):void
+    {
+        _dataProvider = value;
+    }
+
+    //----------------------------------
+    // allLevelName
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    protected var _allLevelName:String = "(All)";
+
+    /**
+     *  The name of the all level for the hierarchy.
+     *
+     *  @default "(All)"
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    mx_internal function get allLevelName():String
+    {
+        return _allLevelName;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function set allLevelName(value:String):void
+    {
+        _allLevelName = value;
+    }
+
+    //----------------------------------
+    // allLevel
+    //----------------------------------
+
+    private var _allLevel:IOLAPLevel;
+
+    /**
+     *  The all level for the hierarchy.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    mx_internal function set allLevel(l:IOLAPLevel):void
+    {
+        _allLevel = l;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function get allLevel():IOLAPLevel
+    {
+        return _allLevel;
+    }
+
+    //----------------------------------
+    // allMemberName
+    //----------------------------------
+
+    private var _allMemberName:String = "(All)";
+
+    /**
+     *  @inheritDoc
+     *
+     *  @default "(All)"
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get allMemberName():String
+    {
+        return _allMemberName;
+    }
+
+    /**
+     *  @private
+     */
+    public function set allMemberName(value:String):void
+    {
+        if (value && _allMemberName != value)
+        {
+        	//if all level and all member are already present update them
+        	//this may be a rare case
+            var level:OLAPLevel = _levelMap[allLevelName];
+            if (level)
+            {
+                level.removeMemberByName(_allMemberName);
+                _allMemberName = value;
+                allMember = level.createMember(null, allMemberName) as OLAPMember;
+                allMember.setIsAll(true);
+            }
+            else
+                _allMemberName = value;
+        }
+
+    }
+
+    //----------------------------------
+    // members
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var allMembersCache:ArrayCollection;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get members():IList
+    {
+        var temp:Array = [];
+        if (hasAll)
+        {
+            if (!allMembersCache)
+            {
+                // add the all member then add children of each member up to the leaf level.
+                temp.push(allMember);
+                temp = temp.concat(getMembersRecursively(allMember));
+                allMembersCache = new ArrayCollection(temp);
+            }
+            return allMembersCache;
+        }
+        else
+        {
+            //TODO handle the case when all member is not present. Is this correct?
+            var n:int = levels.length;
+            for (var i:int = 0; i < n; ++i)
+            {
+                var level:OLAPLevel = levels.getItemAt(i) as OLAPLevel;
+                temp = temp.concat(level.getMembers(false).source);
+            }
+        }
+
+        return new ArrayCollection(temp);
+    }
+
+    //----------------------------------
+    // defaultMember
+    //----------------------------------
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+     public function get defaultMember():IOLAPMember
+    {
+        if (hasAll)
+            return allMember;
+
+        // return the first levels first member as default
+        return levels.length >= 1 ? levels[0].members[0] : null;
+    }
+
+    //----------------------------------
+    // name
+    //----------------------------------
+
+    /**
+     * User defined name of this hierarchy. If user has not set a explicit name
+     * then the dimension name is returned.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    override public function get name():String
+    {
+        var n:String = super.name;
+        if (!n)
+            return dimension.name;
+        return n;
+    }
+
+    //----------------------------------
+    // children
+    //----------------------------------
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get children():IList
+    {
+        if (allLevel)
+        {
+            var temp:IOLAPMember = allLevel.members.getItemAt(0) as IOLAPMember;
+            var retValue:IList = temp.children;
+            return retValue;
+        }
+
+        //TODO pick first level's members as we don't have the all level?
+        return null;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function findLevel(name:String):IOLAPLevel
+    {
+        // allLevel is internal
+        if (name == allLevelName)
+            return null;
+        return _levelMap[name];
+    }
+
+    /**
+     *  @private
+     *  Creates a level of a hierarchy.
+     *
+     *  @param name The name of the level.
+     *
+     *  @return An OLAPLevel instance that represents the new level.
+     */
+    mx_internal function createLevel(name:String):OLAPLevel
+    {
+        var l:OLAPLevel = new OLAPLevel(name);
+        l.hierarchy = this;
+        l.dimension = dimension;
+        _levels.addItem(l);
+        _levelMap[name] = l;
+
+        return l;
+    }
+
+    /**
+     *  @private
+     */
+    protected function createAllLevelIfRequired():void
+    {
+        var level:OLAPLevel;
+        if (hasAll)
+        {
+            //check if we don't have all level and member
+            // if we don't have create them
+            level = _levelMap[allLevelName];
+            if (!level)
+            {
+                //we don't want all level to get included in levels array
+                //level = createLevel(allLevelName);
+                level = new OLAPLevel(name);
+                level.hierarchy = this;
+                level.dimension = dimension;
+                allLevel = level;
+                allMember = level.createMember(null, allMemberName) as OLAPMember;
+                allMember.setIsAll(true);
+            }
+        }
+        else
+        {
+            allLevel = null;
+            allMember = null;
+            level = _levelMap[allLevelName];
+            if (level)
+            {
+                var index:int = _levels.getItemIndex(level);
+                if (index > -1)
+                    _levels.removeItemAt(index);
+                delete _levelMap[allLevelName];
+            }
+        }
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function refresh():void
+    {
+        //clear the cached array
+        _allLevels = null;
+        allMembersCache = null;
+
+        createAllLevelIfRequired();
+
+        if (allLevel)
+            OLAPLevel(allLevel).refresh();
+
+        for each (var level:OLAPLevel in _levels)
+        {
+            level.dimension = dimension;
+            level.refresh();
+        }
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function processData(data:Object):void
+    {
+        var parent:IOLAPMember;
+        if (allLevel)
+            parent = allLevel.members.getItemAt(0) as IOLAPMember;
+
+        var n:int = levels.length;
+        for (var i:int = 0; i < n; ++i)
+        {
+            var level:OLAPLevel = levels.getItemAt(i) as OLAPLevel;
+            var value:String = level.dataFunction(data, level.dataField);
+
+            //the new member is parent to the next member
+            parent = level.createMember(parent, value);
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function makeMembers():Boolean
+    {
+        var iterator:IViewCursor = dataProvider.createCursor();
+
+        var startTime:int = getTimer();
+
+        while (!iterator.afterLast)
+        {
+            var currentData:Object = iterator.current;
+            processData(currentData);
+            iterator.moveNext();
+        }
+
+        var endTime:int = getTimer();
+
+        return true;
+    }
+
+    /**
+     *  @private
+     */
+    private function getMembersRecursively(m:IOLAPMember):Array
+    {
+        var temp:Array = [];
+        var children:IList = m.children;
+        var n:int = children.length;
+        for (var i:int = 0; i < n; ++i)
+        {
+            var member:IOLAPMember = children.getItemAt(i) as IOLAPMember;
+            temp.push(member);
+            if (member.children.length > 0)
+            {
+                var members:Array = getMembersRecursively(member);
+                temp = temp.concat(members);
+            }
+        }
+        return temp;
+    }
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function findMember(name:String):IOLAPMember
+    {
+        if (allLevel)
+        {
+            if (name == allMemberName)
+                return allMember;
+            return allMember.findChildMember(name);
+        }
+
+        if (levels.length)
+        {
+            var defLevel:IOLAPLevel = levels[0];
+            var list:IList = defLevel.findMember(name);
+            if (list && list.length == 1)
+                return list.getItemAt(0) as IOLAPMember;
+        }
+
+        return null;
+    }
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

--- frameworks/projects/framework/src/mx/core/SimpleApplication.as
+++ frameworks/projects/framework/src/mx/core/SimpleApplication.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/framework/src/mx/managers/IPopUpManager.as
+++ frameworks/projects/framework/src/mx/managers/IPopUpManager.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2006-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

--- frameworks/projects/mx/src/mx/effects/UnconstrainItemAction.as
+++ frameworks/projects/mx/src/mx/effects/UnconstrainItemAction.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 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.effects
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 22217
Author:   mhorn@adobe.com
Date:     2011-08-25T18:07:03.696931Z

Log Message:
-----------
minor asdoc change

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/VideoPlayer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/FormHeading.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/DropDownList.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/framework/src/mx/controls/ToolTip.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/TabBar.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/VideoDisplay.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/Panel.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/Form.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/NumericStepper.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/VSlider.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/ComboBox.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/TitleWindow.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/ToggleButton.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/Spinner.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mx/src/mx/controls/ProgressBar.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/BorderContainer.as</path>

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

--- frameworks/projects/spark/src/spark/components/ToggleButton.as
+++ frameworks/projects/spark/src/spark/components/ToggleButton.as
@@ -22,7 +22,7 @@
  * Because this component does not define a skin for the mobile theme, Adobe
  * recommends that you not use it in a mobile application. Alternatively, you
  * can define your own mobile skin for the component. For more information,
- * see Spark Skinning.
+ * see Basics of mobile skinning.
  */
 [DiscouragedForProfile("mobileDevice")]


Transferred from the Adobe Open Source Subversion Repository

Revision: 20416
Author:   dloverin@adobe.com
Date:     2011-02-23T01:51:10.789734Z

Log Message:
-----------
VideoDisplay thumbnail fix.

Call invalidateDisplayList() after changing the thumbnail source.

QE notes: None.
Doc notes: None.
Bugs: SDK-29616
Reviewer: Ryan
Tests run: cyclone
Is noteworthy for integration: No.

Modified Paths:
--------------
/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/VideoDisplay.as

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

--- frameworks/projects/spark/src/spark/components/VideoDisplay.as
+++ frameworks/projects/spark/src/spark/components/VideoDisplay.as
@@ -1174,6 +1174,7 @@

             thumbnailBitmapImage.source = thumbnailSource;
             invalidateSize();
+            invalidateDisplayList();
         }
         else
         {


Transferred from the Adobe Open Source Subversion Repository

Revision: 16720
Author:   dloverin@adobe.com
Date:     2010-06-29T17:33:54.284541Z

Log Message:
-----------
Integrate OSMF 1.0 source and add http streaming capability to VideoDisplay.

QE notes: Many fragile tests that broke were fixed. A few more half-pixel off failures in mustella VideoPlayer tests need to be investigated.
Doc notes: None.
Bugs: none.
Reviewer: Ryan
Tests run: checkintests, VideoDisplay, VideoPlayer
Is noteworthy for integration: Yes.

Modified Paths:
--------------
415 paths were modified

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

--- frameworks/projects/spark/src/spark/components/VideoDisplay.as
+++ frameworks/projects/spark/src/spark/components/VideoDisplay.as
@@ -26,34 +26,36 @@
 import mx.resources.IResourceManager;
 import mx.resources.ResourceManager;

-import org.osmf.display.MediaPlayerSprite;
-import org.osmf.display.ScaleMode;
-import org.osmf.display.ScaleModeUtils;
+
+import org.osmf.containers.MediaContainer;
+import org.osmf.elements.VideoElement;
 import org.osmf.events.AudioEvent;
-import org.osmf.events.DimensionEvent;
+import org.osmf.events.DisplayObjectEvent;
 import org.osmf.events.LoadEvent;
 import org.osmf.events.MediaPlayerCapabilityChangeEvent;
 import org.osmf.events.MediaPlayerStateChangeEvent;
-import org.osmf.events.PlayingChangeEvent;
 import org.osmf.events.SeekEvent;
 import org.osmf.events.TimeEvent;
-import org.osmf.gateways.RegionGateway;
-import org.osmf.layout.LayoutUtils;
-import org.osmf.layout.RegistrationPoint;
-import org.osmf.media.IMediaResource;
+import org.osmf.layout.HorizontalAlign;
+import org.osmf.layout.LayoutMetadata;
+import org.osmf.layout.ScaleMode;
+import org.osmf.layout.VerticalAlign;
+import org.osmf.media.DefaultMediaFactory;
+import org.osmf.media.MediaElement;
+import org.osmf.media.MediaFactory;
+import org.osmf.media.MediaFactoryItem;
 import org.osmf.media.MediaPlayer;
 import org.osmf.media.MediaPlayerState;
+import org.osmf.media.MediaResourceBase;
 import org.osmf.media.URLResource;
-import org.osmf.metadata.MediaType;
-import org.osmf.metadata.MediaTypeFacet;
+import org.osmf.media.MediaType;
 import org.osmf.net.NetLoader;
-import org.osmf.net.dynamicstreaming.DynamicStreamingItem;
-import org.osmf.net.dynamicstreaming.DynamicStreamingNetLoader;
-import org.osmf.net.dynamicstreaming.DynamicStreamingResource;
-import org.osmf.utils.FMSURL;
+import org.osmf.net.DynamicStreamingItem;
+import org.osmf.net.rtmpstreaming.RTMPDynamicStreamingNetLoader;
+import org.osmf.net.DynamicStreamingResource;
+import org.osmf.net.FMSURL;
 import org.osmf.utils.OSMFStrings;
 import org.osmf.utils.URL;
-import org.osmf.video.VideoElement;

 import spark.components.mediaClasses.DynamicStreamingVideoItem;
 import spark.components.mediaClasses.DynamicStreamingVideoSource;
@@ -237,6 +239,84 @@
         return resourceManager.getString("osmf", resourceName, args);
     }

+    /**
+     * Copied from OSMF ScaleModeUtils.getScaledSize. ScaleModeUtils became
+     * an internal OSMF class in OSMF 1.0 so it is copied here.
+     *
+     * Calculates the scaled size based on the scaling algorithm.
+     * The available width and height are the width and height of the container.
+     * The intrinsic width and height are the width and height of the content.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion OSMF 1.0
+     */
+    private static function getScaledSize
+        ( scaleMode:String
+          , availableWidth:Number, availableHeight:Number
+            , intrinsicWidth:Number, intrinsicHeight:Number
+        ):Point
+    {
+        var result:Point;
+
+        switch (scaleMode)
+        {
+            case ScaleMode.ZOOM:
+            case ScaleMode.LETTERBOX:
+
+                var availableRatio:Number
+                = availableWidth
+                / availableHeight;
+
+                var componentRatio:Number
+                = (intrinsicWidth || availableWidth)
+                / (intrinsicHeight || availableHeight);
+
+                if 	(	(scaleMode == ScaleMode.ZOOM && componentRatio < availableRatio)
+                    ||	(scaleMode == ScaleMode.LETTERBOX && componentRatio > availableRatio)
+                )
+                {
+                    result
+                    = new Point
+                        ( availableWidth
+                            , availableWidth / componentRatio
+                        );
+                }
+                else
+                {
+                    result
+                    = new Point
+                        ( availableHeight * componentRatio
+                            , availableHeight
+                        );
+                }
+
+                break;
+
+            case ScaleMode.STRETCH:
+
+                result
+                = new Point
+                ( availableWidth
+                    , availableHeight
+                );
+                break;
+
+            case ScaleMode.NONE:
+
+                result
+                = new Point
+                ( intrinsicWidth	|| availableWidth
+                    , intrinsicHeight	|| availableHeight
+                );
+
+                break;
+        }
+
+        return result;
+    }
+
     //--------------------------------------------------------------------------
     //
     //  Constructor
@@ -263,8 +343,8 @@
         addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
         addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);

-        // Set the TLF hook used for localizing runtime error messages.
-        // TLF itself has English-only messages,
+        // Set the OSMF hook used for localizing runtime error messages.
+        // OSMF itself has English-only messages,
         // but higher layers like Flex can provide localized versions.
         OSMFStrings.resourceStringFunction = getResourceString;
     }
@@ -284,11 +364,18 @@

     /**
      *  @private
-     *  This is the underlying gateway object used to display
+     *  This is the underlying container used to display
      *  the underlying videoPlayer.
      */
-    mx_internal var videoGateway:RegionGateway;
-
+    mx_internal var videoContainer:MediaContainer;
+
+    /**
+     *  @private
+     *  How the correct media elements are created based on the url of
+     *  the resource.
+     */
+    mx_internal var mediaFactory:MediaFactory;
+
     /**
      *  @private
      *  Whether the video is on the display list or not
@@ -356,7 +443,7 @@
      *  video because of autoDisplayFirstFrame.
      *
      *
In this case we are in "state2" of loading,
-     *  which means have set videoPlayer.view.visible=false
+     *  which means have set videoPlayer.displayObject.visible=false
      *  and videoPlayer.muted=true.  We've also called play() and are
      *  waiting for the DimensionChangeEvent.

      *
@@ -869,8 +956,13 @@
         }

         // set scaleMode on the videoElement object
-        if (videoPlayer.element)
-            LayoutUtils.setLayoutAttributes(videoPlayer.element.metadata, scaleMode, RegistrationPoint.CENTER);
+        if (videoPlayer.media)
+        {
+            var layout:LayoutMetadata = videoPlayer.media.
+                                getMetadata(LayoutMetadata.LAYOUT_NAMESPACE) as LayoutMetadata;
+            if (layout)
+                layout.scaleMode = _scaleMode;
+        }

         invalidateSize();
         invalidateDisplayList();
@@ -1081,7 +1173,7 @@
      */
     public function get videoObject():Video
     {
-        return videoPlayer.view as Video;
+        return videoPlayer.displayObject as Video;
     }

     //----------------------------------
@@ -1190,8 +1282,15 @@
         }
         else
         {
-            intrinsicWidth = videoPlayer.width;
-            intrinsicHeight = videoPlayer.height;
+            // If there is no media the width/height will be NaN.
+            // Convert it to zero for our purposes.
+            intrinsicWidth = videoPlayer.mediaWidth;
+            if (isNaN(intrinsicWidth))
+                intrinsicWidth = 0;
+
+            intrinsicHeight = videoPlayer.mediaHeight;
+            if (isNaN(intrinsicHeight))
+                intrinsicHeight = 0;
         }

         measuredWidth = intrinsicWidth;
@@ -1220,7 +1319,7 @@
         if (thumbnailSource && thumbnailGroup)
         {
             // get what the size of our image should be
-            var newSize:Point = ScaleModeUtils.getScaledSize(scaleMode, unscaledWidth, unscaledHeight,
+            var newSize:Point = getScaledSize(scaleMode, unscaledWidth, unscaledHeight,
                 thumbnailBitmapImage.getPreferredBoundsWidth(), thumbnailBitmapImage.getPreferredBoundsHeight());

             // set the thumbnailGroup to be the size of the component.
@@ -1236,13 +1335,12 @@
             return;
         }

-        // set the gateway's dimensions
-        LayoutUtils.setAbsoluteLayout(videoGateway.metadata,
-            Math.floor(unscaledWidth), Math.floor(unscaledHeight));
-
-        // need to validate the gateway immediately--otherwise we may run out of synch
+        videoContainer.width = Math.floor(unscaledWidth);
+        videoContainer.height = Math.floor(unscaledHeight);
+
+        // need to validate the gateway immediately--otherwise we may run out of synch
         // as they may wait a frame by default before validating (see SDK-24880)
-        videoGateway.validateContentNow();
+        videoContainer.validateNow();
     }

     //--------------------------------------------------------------------------
@@ -1277,9 +1375,9 @@
         // if inLoadingState1 && !pausable, then let the loading state handle it
         // if !inLoadingState1 && pausable, then just pause
         // if !inLoadingState1 && !pausable, then load (if needed to show first frame)
-        if (!inLoadingState1 && videoPlayer.pausable)
+        if (!inLoadingState1 && videoPlayer.canPause)
             videoPlayer.pause();
-        else if (!videoPlayer.pausable && autoDisplayFirstFrame)
+        else if (!videoPlayer.canPause && autoDisplayFirstFrame)
             load();
     }

@@ -1304,7 +1402,7 @@
         // and to start playing again.  Otherwise, go ahead and play
         if (inLoadingState1)
             cancelLoadAndPlay();
-        else if (videoPlayer.playable)
+        else if (videoPlayer.canPlay)
             videoPlayer.play();
     }

@@ -1346,7 +1444,7 @@

         // TODO (rfrishbe): could handle what to do if this gets called when loading() better.
         // Need to store where we want to seek to.
-        if (videoPlayer.seekable)
+        if (videoPlayer.canSeek)
             videoPlayer.seek(time);
     }

@@ -1378,9 +1476,9 @@
         // if inLoadingState1 && !pausable, then let the loading state handle it
         // if !inLoadingState1 && pausable, then just pause
         // if !inLoadingState1 && !pausable, then load (if needed to show first frame)
-        if (!inLoadingState1 && videoPlayer.pausable)
+        if (!inLoadingState1 && videoPlayer.canPause)
             videoPlayer.stop();
-        else if (!videoPlayer.pausable && autoDisplayFirstFrame)
+        else if (!videoPlayer.canPause && autoDisplayFirstFrame)
             load();
     }

@@ -1429,11 +1527,25 @@
     {
         // create new video player
         videoPlayer = new MediaPlayer();
-        videoGateway = new RegionGateway();
-        videoGateway.clipChildren = true;
-
+        videoContainer = new MediaContainer();
+        videoContainer.clipChildren = true;
+
+        mediaFactory = new DefaultMediaFactory();
+
+        // remove unsupport media types
+        var unsupportedMediaTypes:Array = ["org.osmf.elements.video.dvr.dvrcast",
+                                           "org.osmf.elements.image",
+                                           "org.osmf.elements.swf"];
+
+        for each (var mediaType:String in unsupportedMediaTypes)
+        {
+            var mediaFactoryItem:MediaFactoryItem = mediaFactory.getItemById(mediaType);
+            if (mediaFactoryItem)
+                mediaFactory.removeItem(mediaFactoryItem);
+        }
+
         // internal events
-        videoPlayer.addEventListener(DimensionEvent.DIMENSION_CHANGE, videoPlayer_dimensionChangeHandler);
+        videoPlayer.addEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE, videoPlayer_mediaSizeChangeHandler);
         videoPlayer.addEventListener(AudioEvent.VOLUME_CHANGE, videoPlayer_volumeChangeHandler);
         videoPlayer.addEventListener(AudioEvent.MUTED_CHANGE, videoPlayer_mutedChangeHandler);

@@ -1444,7 +1556,7 @@
         videoPlayer.addEventListener(TimeEvent.DURATION_CHANGE, dispatchEvent);
         videoPlayer.addEventListener(TimeEvent.COMPLETE, dispatchEvent);

-        addChild(videoGateway);
+        addChild(videoContainer);
     }

     /**
@@ -1458,10 +1570,12 @@
         cleanUpSource()

         // if was playing a previous video, let's remove it now
-        if (videoPlayer.element)
-            videoGateway.removeElement(videoPlayer.element);
-
-        var videoElement:org.osmf.video.VideoElement;
+        if (videoPlayer.media && videoContainer.containsMediaElement(videoPlayer.media))
+        {
+            videoContainer.removeMediaElement(videoPlayer.media);
+        }
+
+        var videoElement:org.osmf.media.MediaElement = null;

         // check for 4 cases: streaming video, progressive download,
         // an IMediaResource, or a VideoElement.
@@ -1481,14 +1595,14 @@
             // around serverName vs. streamName.
             if (streamingSource.host is String)
             {
-                dsr = new DynamicStreamingResource(new FMSURL(streamingSource.host as String),
-                    streamingSource.streamType);
+                dsr = new DynamicStreamingResource(streamingSource.host as String,
+                                                   streamingSource.streamType);
             }
             else if (streamingSource.host is URL)
             {
-                dsr = new DynamicStreamingResource(streamingSource.host as URL,
-                    streamingSource.streamType);
-            }
+                dsr = new DynamicStreamingResource(URL(streamingSource.host).host,
+                                                   streamingSource.streamType);
+            }

             if (dsr)
             {
@@ -1509,28 +1623,33 @@

                 // add video type metadata so if the URL is ambiguous, OSMF will
                 // know what type of file we're trying to connect to
-                dsr.metadata.addFacet(new MediaTypeFacet(MediaType.VIDEO));
-
-                videoElement = new org.osmf.video.VideoElement(new DynamicStreamingNetLoader(), dsr);
+                dsr.mediaType = MediaType.VIDEO;
+
+                videoElement = new org.osmf.elements.VideoElement(dsr, new RTMPDynamicStreamingNetLoader());
             }
         }
         else if (source is String)
         {
-            var urlResource:URLResource = new URLResource(new URL(source as String));
-
-            // add video type metadata so if the URL is ambiguous, OSMF will
-            // know what type of file we're trying to connect to
-            urlResource.metadata.addFacet(new MediaTypeFacet(MediaType.VIDEO));
-
-            videoElement = new org.osmf.video.VideoElement(new NetLoader(), urlResource);
-        }
-        else if (source is IMediaResource)
-        {
-            videoElement = new org.osmf.video.VideoElement(new NetLoader(), source as IMediaResource);
-        }
-        else if (source is org.osmf.video.VideoElement)
-        {
-            videoElement = source as org.osmf.video.VideoElement;
+            var urlResource:URLResource = new URLResource(source as String);
+            videoElement = mediaFactory.createMediaElement(urlResource);
+
+            // If the url could not be resolved to a media element then try
+            // telling osmf the media is a video and try again.
+            // We do not specify the media type as video the first time,
+            // so we can have the chance to play audio.
+            if (videoElement == null)
+            {
+                urlResource.mediaType = MediaType.VIDEO;
+                videoElement = mediaFactory.createMediaElement(urlResource);
+            }
+        }
+        else if (source is MediaResourceBase)
+        {
+            videoElement = mediaFactory.createMediaElement(MediaResourceBase(source));
+        }
+        else if (source is org.osmf.elements.VideoElement)
+        {
+            videoElement = source as org.osmf.elements.VideoElement;
         }

         // reset the visibilityPausedTheVideo flag
@@ -1548,18 +1667,26 @@

         // set videoPlayer's element to the newly constructed VideoElement
         // set the newly constructed videoElement's gateway to be the videoGateway
-        videoPlayer.element = videoElement;
+        videoPlayer.media = videoElement;

         if (videoElement)
         {
-            videoElement.gateway = videoGateway;
-
-            // set the video's width within the gateway to be 100%, 100%
-            LayoutUtils.setRelativeLayout(videoElement.metadata, 100, 100);
-
-            // set the element scale (and distribute surplus space such that the
-            // element stays center)
-            LayoutUtils.setLayoutAttributes(videoElement.metadata, scaleMode, RegistrationPoint.CENTER);
+
+            if (videoElement.getMetadata(LayoutMetadata.LAYOUT_NAMESPACE) == null)
+            {
+                var layout:LayoutMetadata = new LayoutMetadata();
+                layout.scaleMode = scaleMode;
+                layout.verticalAlign = VerticalAlign.MIDDLE;
+                layout.horizontalAlign = HorizontalAlign.CENTER;
+                layout.percentWidth = 100;
+                layout.percentHeight = 100;
+                videoElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layout);
+            }
+
+            if (videoElement && !videoContainer.containsMediaElement(videoElement) )
+            {
+                videoContainer.addMediaElement(videoElement);
+            }
         }
         else
         {
@@ -1674,7 +1801,7 @@
                 // source has loaded up and it's playable
                 if (inLoadingState1)
                     cancelLoadAndPlay();
-                else if (videoPlayer.playable)
+                else if (videoPlayer.canPlay)
                     videoPlayer.play();
             }
         }
@@ -1701,9 +1828,9 @@
                 // if inLoadingState1 && !pausable, then let the loading state handle it
                 // if !inLoadingState1 && pausable, then just pause
                 // if !inLoadingState1 && !pausable, then load (if needed to show first frame)
-                if (!inLoadingState1 && videoPlayer.pausable)
+                if (!inLoadingState1 && videoPlayer.canPause)
                     videoPlayer.pause();
-                else if (!videoPlayer.pausable && autoDisplayFirstFrame)
+                else if (!videoPlayer.canPause && autoDisplayFirstFrame)
                     load();
             }
         }
@@ -1730,7 +1857,9 @@
             {
                 // second step
                 videoPlayer.muted = beforeLoadMuted;
-                videoPlayer.view.visible = true;
+
+                if (videoPlayer.displayObject)
+                    videoPlayer.displayObject.visible = true;

                 // don't need to do anything to play except change state info and reset
                 // properties above
@@ -1738,12 +1867,13 @@
             else
             {
                 // third step
-                videoPlayer.removeEventListener(SeekEvent.SEEK_END, videoPlayer_seekEndHandler);
+                videoPlayer.removeEventListener(SeekEvent.SEEKING_CHANGE, videoPlayer_seekChangeHandler);
                 videoPlayer.muted = beforeLoadMuted;
-                videoPlayer.view.visible = true;
+                if (videoPlayer.displayObject)
+                    videoPlayer.displayObject.visible = true;

                 // wasn't playing
-                if (videoPlayer.playable)
+                if (videoPlayer.canPlay)
                     videoPlayer.play();
             }

@@ -1776,7 +1906,7 @@
             {
                 // second step
                 videoPlayer.muted = beforeLoadMuted;
-                videoPlayer.view.visible = true;
+                videoPlayer.displayObject.visible = true;

                 // going to call pause() now to stop immediately
                 videoPlayer.pause();
@@ -1784,9 +1914,9 @@
             else
             {
                 // third step
-                videoPlayer.removeEventListener(SeekEvent.SEEK_END, videoPlayer_seekEndHandler);
+                videoPlayer.removeEventListener(SeekEvent.SEEKING_CHANGE, videoPlayer_seekChangeHandler);
                 videoPlayer.muted = beforeLoadMuted;
-                videoPlayer.view.visible = true;
+                videoPlayer.displayObject.visible = true;

                 // already called pause(), so don't do anything
             }
@@ -2047,7 +2177,9 @@
             {
                 beforeLoadMuted = videoPlayer.muted;
                 videoPlayer.muted = true;
-                videoPlayer.view.visible = false;
+
+                if (videoPlayer.displayObject)
+                    videoPlayer.displayObject.visible = false;

                 inLoadingState2 = true;
             }
@@ -2061,20 +2193,57 @@
     /**
      *  @private
      */
-    private function videoPlayer_dimensionChangeHandler(event:DimensionEvent):void
+    private function videoPlayer_mediaSizeChangeHandler(event:DisplayObjectEvent):void
     {
         invalidateSize();

         // if we're loading up the video, then let's finish the load in here
         if (inLoadingState2)
         {
-            inLoadingState3 = true;
-            // the seek(0) is asynchronous so let's add an event listener to see when it's finsished:
-            videoPlayer.addEventListener(SeekEvent.SEEK_END, videoPlayer_seekEndHandler);
-
-            // called play(), now call pause() and seek(0);
-            videoPlayer.pause();
-            videoPlayer.seek(0);
+            if (videoPlayer.canSeek && videoPlayer.canSeekTo(0))
+            {
+                inLoadingState3 = true;
+
+                // the seek(0) is asynchronous so let's add an event listener to see when it's finsished:
+                videoPlayer.addEventListener(SeekEvent.SEEKING_CHANGE, videoPlayer_seekChangeHandler);
+
+                // called play(), now call pause() and seek(0);
+                videoPlayer.pause();
+                videoPlayer.seek(0);
+            }
+            else
+            {
+                //trace("videoPlayer_mediaSizeChangeHandler: waiting for media to become seekable");
+
+                // wait for the media to become seekable.
+                videoPlayer.addEventListener(MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE, videoPlayer_canSeekChangeHandler);
+            }
+        }
+    }
+
+    /**
+     *  @private
+     *  Wait until the media is seekable before we call pause() and seek().
+     */
+    private function videoPlayer_canSeekChangeHandler(event:Event):void
+    {
+        //trace("videoPlayer_canSeekChangeHandler: seeking = " + videoPlayer.canSeek);
+
+        videoPlayer.removeEventListener(MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE, videoPlayer_canSeekChangeHandler);
+
+        if (inLoadingState2)
+        {
+            if (videoPlayer.canSeek && videoPlayer.canSeekTo(0))
+            {
+                inLoadingState3 = true;
+
+                // the seek(0) is asynchronous so let's add an event listener to see when it's finsished:
+                videoPlayer.addEventListener(SeekEvent.SEEKING_CHANGE, videoPlayer_seekChangeHandler);
+
+                // called play(), now call pause() and seek(0);
+                videoPlayer.pause();
+                videoPlayer.seek(0);
+            }
         }
     }

@@ -2085,15 +2254,19 @@
      *  This will be called after the video has loaded up and
      *  we have finished seeking back to the first frame.
      */
-    private function videoPlayer_seekEndHandler(event:SeekEvent):void
-    {
-        inLoadingState1 = false;
-        inLoadingState2 = false;
-        inLoadingState3 = false;
-
-        videoPlayer.removeEventListener(SeekEvent.SEEK_END, videoPlayer_seekEndHandler);
-        videoPlayer.muted = beforeLoadMuted;
-        videoPlayer.view.visible = true;
+    private function videoPlayer_seekChangeHandler(event:SeekEvent):void
+    {
+        if (!event.seeking)
+        {
+            inLoadingState1 = false;
+            inLoadingState2 = false;
+            inLoadingState3 = false;
+
+            videoPlayer.removeEventListener(SeekEvent.SEEKING_CHANGE, videoPlayer_seekChangeHandler);
+            videoPlayer.muted = beforeLoadMuted;
+            if (videoPlayer.displayObject)
+                videoPlayer.displayObject.visible = true;
+        }
     }
 }
 }


remove test of _enabled because it should now be done before calling DrawCall.apply()

--- src/aerys/minko/render/DrawCall.as
+++ src/aerys/minko/render/DrawCall.as
@@ -298,9 +298,6 @@

 		public function apply(context : Context3DResource, previous : DrawCall) : uint
 		{
-			if (!_enabled)
-				return 0;
-
 			context.setColorMask(_colorMaskR, _colorMaskG, _colorMaskB, _colorMaskA)
 				   .setProgramConstantsFromVector(PROGRAM_TYPE_VERTEX, 0, _vsConstants)
 				   .setProgramConstantsFromVector(PROGRAM_TYPE_FRAGMENT, 0, _fsConstants);


fix typo

fix typo

--- src/aerys/minko/scene/node/Mesh.as
+++ src/aerys/minko/scene/node/Mesh.as
@@ -222,7 +222,7 @@
 			if (name)
 				this.name = name;

-			_cloned = new Signal('Mesh.clones');
+			_cloned = new Signal('Mesh.cloned');
 			_materialChanged = new Signal('Mesh.materialChanged');
 			_frameChanged = new Signal('Mesh.frameChanged');
 			_geometryChanged = new Signal('Mesh.geometryChanged');


XIFF-53: Tuning on the uncompression method. It was spitting out incomplete data, now complete. Changes based on http://community.igniterealtime.org/people/mani

--- src/org/igniterealtime/xiff/util/Zlib.as
+++ src/org/igniterealtime/xiff/util/Zlib.as
@@ -38,7 +38,7 @@
 	public class Zlib implements ICompressor
 	{
 		/**
-		 * Uncompress the given ByteArray.
+		 * Uncompress (inflate) the given ByteArray.
 		 *
 		 * @param	data
 		 * @return Uncompressed data
@@ -47,6 +47,8 @@
 		{
 			data.position = 0;
 			var uncompressed:ByteArray = new ByteArray();
+			var outBytesLength:int = data.length * 2;
+
 			var err:int;
 			var i:int = 0;
 			var j:int = 0;
@@ -63,22 +65,46 @@
 			stream.next_out = uncompressed;
 			stream.next_out_index = 0;

+			stream.avail_out = outBytesLength;
+			stream.total_in = 0;
+
+
 			err = stream.inflateInit();
 			checkError(stream, err, "inflateInit");

 			var outcount:int = 0;
-			while (stream.total_out < data.length && stream.total_in < data.length)
-			{
-				stream.avail_in = stream.avail_out = 1; /* force small buffers */
+			while (true)
+			{
+				// force small buffers
+				stream.avail_in = 1;
+				stream.avail_out = 1;
+
 				err = stream.inflate(JZlib.Z_NO_FLUSH);
-				if (err == JZlib.Z_STREAM_END)
-				{
-					trace("Zlib.uncompress. inflation stream ended");
-					break;
+				switch (err)
+				{
+					case JZlib.Z_STREAM_END:
+						// completed decompression, lets copy data and get out
+						trace("Zlib.uncompress. inflation stream ended");
+						break;
+					case JZlib.Z_BUF_ERROR:
+						stream.next_out_index = 0;
+						stream.avail_out = outBytesLength;
+						break;
+					default:
+						// unknown error
+						if (err != JZlib.Z_OK)
+						{
+							if (stream.msg == null) {
+								trace("Unknown error. Error code : " + err);
+							}
+							else {
+								trace("Unknown error. Error code : " + err + " and message : " + stream.msg);
+							}
+						}
 				}

 				outcount++;
-				trace("Zlib.uncompress. outcount: " + outcount + ", stream.total_out: " + stream.total_out);
+				//trace("Zlib.uncompress. outcount: " + outcount + ", stream.total_out: " + stream.total_out);

 				if (!checkError(stream, err, "inflate"))
 				{
@@ -90,56 +116,15 @@
 			checkError(stream, err, "inflateEnd");

-			// Checking ... is this needed?
-			data.position = 0;
-			for (i = 0; i < data.length; i++)
-			{
-				if (data.readByte() == 0)
-				{
-					break;
-				}
-			}
-
-			uncompressed.position = 0;
-			for (j = 0; j < uncompressed.length; j++)
-			{
-				if (uncompressed.readByte() == 0)
-				{
-					break;
-				}
-			}
-
-			if (i == j)
-			{
-				uncompressed.position = 0;
-				data.position = 0;
-				for (i = 0; i < j; i++)
-				{
-					if (data.readByte() != uncompressed.readByte())
-					{
-						break;
-					}
-				}
-				if (i == j)
-				{
-					trace("inflate(): " + String(uncompressed));
-					//return;
-				}
-			}
-			else
-			{
-				trace("bad inflate");
-			}
-
-
 			trace("Zlib.uncompress. uncompressed.length: " + uncompressed.length);
 			trace("Zlib.uncompress. uncompressed: " + uncompressed.toString());
-
+
+			uncompressed.position = 0;
 			return uncompressed;
 		}

 		/**
-		 * Compress the given ByteArray. Will add Adler32 checksum to the end of the data.
+		 * Compress (deflate) the given ByteArray.
 		 *
 		 * @param	data
 		 * @return Compressed data
@@ -172,7 +157,10 @@
 			var comprLen:int = 40000;
 			while (stream.total_in != data.length && stream.total_out < comprLen)
 			{
-				stream.avail_in = stream.avail_out = 1; // force small buffers
+				// force small buffers
+				stream.avail_in = 1;
+				stream.avail_out = 1;
+
 				err = stream.deflate(JZlib.Z_NO_FLUSH);
 				checkError(stream, err, "deflate");
 			}
@@ -197,7 +185,8 @@

 			trace("Zlib.compress. compressed.length: " + compressed.length);
 			trace("Zlib.compress. compressed: " + compressed.toString());
-
+
+			compressed.position = 0;
 			return compressed;
 		}