     //  Public variables
     //
     //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    //  trackSizeChanges
+    //----------------------------------
+
+    /**
+     * @private
+     */
+    private var _trackSizeChanges:Boolean = false;
+
+    [Inspectable(category="General")]
+
+    /**
+     *  Whether we should actively watch changes to the size of the flash object.  
+     *  If this is set to <code>true</code>, then every frame, the size of the flash 
+     *  object will be determined.  If the size has changed, then the flash object 
+     *  will scale appropriately to fit its explicit bounds (or it will resize and 
+     *  notify its parent if there is no explicit sizing).
+     * 
+     *  <p>Note: Setting this property to <code>true</code> may be expensive because 
+     *  we now are asking the flash object its current size every single frame.</p>
+     * 
+     *  @default false
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 4
+     */
+    public function get trackSizeChanges():Boolean
+    {
+        return _trackSizeChanges;
+    }
+
+    /**
+     *  @private
+     */
+    public function set trackSizeChanges(value:Boolean):void
+    {
+        if (_trackSizeChanges == value)
+            return;
+
+        _trackSizeChanges = value;
+
+        if(_trackSizeChanges)
+        {
+            addEventListener(Event.ENTER_FRAME, trackSizeChangesEnterFrameHandler, false, 0, true);
+        }
+        else
+        {
+            removeEventListener(Event.ENTER_FRAME, trackSizeChangesEnterFrameHandler);
+        }
+    }
+    
+    //----------------------------------
+    //  trackStateChanges
+    //----------------------------------
+
+    /**
+     * @private
+     */
+    private var _trackStateChanges:Boolean = false;
+
+    [Inspectable(category="General")]
+
+    /**
+     *  Whether we should actively watch changes to the label of the flash object.  
+     *  The Flex <code>currentState</code> property depends on this flash label.  
+     *  If this is set to <code>true</code>, then every frame, the label of the flash
+     *  obejct will be quieried.  If the label has changed, that will become the new 
+     *  <code>currentState</code> for the Flex object.
+     * 
+     *  <p>Note: Setting this property to <code>true</code> may be expensive because 
+     *  we now are asking the flash object for is current label every single frame.</p>
+     * 
+     *  @default false
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 4
+     */
+    public function get trackStateChanges():Boolean
+    {
+        return _trackStateChanges;
+    }
+
+    /**
+     *  @private
+     */
+    public function set trackStateChanges(value:Boolean):void
+    {
+        if (_trackStateChanges == value)
+            return;
+
+        _trackStateChanges = value;
+
+        if(_trackStateChanges)
+        {
+            addEventListener(Event.ENTER_FRAME, trackStateChangesEnterFrameHandler, false, 0, true);
+        }
+        else
+        {
+            removeEventListener(Event.ENTER_FRAME, trackStateChangesEnterFrameHandler);
+        }
+    }
     
     //----------------------------------
     //  x

        
        if (x != oldX || y != oldY)
            dispatchMoveEvent();
            
        // Size check.
        if (trackSizeChanges)
        {
            var currentBounds:Rectangle = bounds;
            
            // take secret scale into account as it's our real width/height
            currentBounds.width *= mx_internal::scaleXDueToSizing;
            currentBounds.height *= mx_internal::scaleYDueToSizing;
            
            if (sizeChanged(currentBounds.width, oldWidth) || sizeChanged(currentBounds.height, oldHeight))
            {
                _width = currentBounds.width;
                _height = currentBounds.height;
                validateMeasuredSizeFlag = true;
                notifySizeChanged(); 
                dispatchResizeEvent();
            }
            else if (sizeChanged(width, oldWidth) || sizeChanged(height, oldHeight))
            {
                dispatchResizeEvent();
            }
        }
        else
        {
            removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }
        
    }
    
    /**
     *  The main function that progesses through transitions.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 9
     *  @playerversion AIR 1.1
     *  @productversion Flex 4
     */
    protected function stateEnterFrameHandler(event:Event):void
    {
        // States Change:
        
        // We no longer support this "Current state check".  Setting currentState programatically 
        // still works, but if we magically land on a "foo" labelled frame, we don't return "foo"
        // as the currentState anymore.
        //if (currentLabel && currentLabel.indexOf(":") < 0 && currentLabel != _currentState)
        //    _currentState = currentLabel;
        
        // Play the next frame of the transition, if needed.
        if (transitionDirection != 0)
        {
            var newFrame:Number = currentFrame + transitionDirection;

            if ((transitionDirection > 0 && newFrame >= transitionEndFrame) || 
                (transitionDirection < 0 && newFrame <= transitionEndFrame))
            {
                gotoAndStop(stateMap[transitionEndState].frame);
                transitionDirection = 0;
                removeEventListener(Event.ENTER_FRAME, stateEnterFrameHandler);
            }
            else
            {
                gotoAndStop(newFrame);
            }
        }
    }
    

    //--------------------------------------------------------------------------
    
    /**
     *  This enter frame handler is used when our width, height, x, or y 
     *  value changes.  This is so the change can be delayed so that setting 
     *  x and y at the same time only results in one change event.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 9
