Now, if any ancestor chain of BusyIndicator becomes visible, it will start spinning. Fixes bug https://issues.apache.org/jira/browse/FLEX-34701
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/6b25cc3c Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/6b25cc3c Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/6b25cc3c Branch: refs/heads/develop Commit: 6b25cc3cebb2b7201f79e832e2ba8740b170ab50 Parents: efbdca7 Author: OmPrakash Muppirala <[email protected]> Authored: Fri Dec 19 17:40:01 2014 -0800 Committer: Erik de Bruin <[email protected]> Committed: Sat Dec 20 19:46:37 2014 +0100 ---------------------------------------------------------------------- .../spark/src/spark/components/BusyIndicator.as | 54 +++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6b25cc3c/frameworks/projects/spark/src/spark/components/BusyIndicator.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/BusyIndicator.as b/frameworks/projects/spark/src/spark/components/BusyIndicator.as index 1f665ee..259393d 100644 --- a/frameworks/projects/spark/src/spark/components/BusyIndicator.as +++ b/frameworks/projects/spark/src/spark/components/BusyIndicator.as @@ -24,6 +24,7 @@ package spark.components import mx.core.IUIComponent; import mx.core.IVisualElement; import mx.events.FlexEvent; + import mx.events.PropertyChangeEvent; import mx.states.State; import spark.components.supportClasses.SkinnableComponent; @@ -146,10 +147,48 @@ package spark.components ]; } + override protected function commitProperties():void + { + if (effectiveVisibilityChanged) + { + // if visibility changed, re-compute them here + computeEffectiveVisibility(); + + if (canRotate()) + { + currentState = "rotatingState"; + } + else + { + currentState = "notRotatingState"; + } + + invalidateSkinState(); + effectiveVisibilityChanged = false; + } + super.commitProperties(); + } + override protected function getCurrentSkinState():String { return currentState; - } + } + + /** + * @private + * Override so we know when visibility is set. The initialized + * property calls setVisible() with noEvent == true + * so we wouldn't get a visibility event if we just listened + * for events. + */ + override public function setVisible(value:Boolean, + noEvent:Boolean = false):void + { + super.setVisible(value, noEvent); + + effectiveVisibilityChanged = true; + invalidateProperties(); + } private function addedToStageHandler(event:Event):void { @@ -160,8 +199,8 @@ package spark.components if (canRotate()) currentState = "rotatingState"; - addVisibilityListeners(); invalidateSkinState(); + addVisibilityListeners(); } private function removedFromStageHandler(event:Event):void @@ -274,6 +313,17 @@ package spark.components invalidateProperties(); } + override protected function layer_PropertyChange(event:PropertyChangeEvent):void + { + super.layer_PropertyChange(event); + + if (event.property == "effectiveVisibility") + { + effectiveVisibilityChanged = true; + invalidateProperties(); + } + } + } }
