FLEX-34738 Fix BusyIndicator so the skin / timer is removed when it's removed from stage while still spinning.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/cd45ebd2 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/cd45ebd2 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/cd45ebd2 Branch: refs/heads/develop Commit: cd45ebd253dbc44f45515d607c4324a4871b5679 Parents: d175d2c Author: Justin Mclean <[email protected]> Authored: Tue Nov 8 10:55:12 2016 +1100 Committer: Justin Mclean <[email protected]> Committed: Tue Nov 8 10:55:12 2016 +1100 ---------------------------------------------------------------------- .../src/spark/skins/ios7/BusyIndicatorSkin.as | 20 ++++++++++++++----- .../src/spark/skins/spark/BusyIndicatorSkin.as | 21 ++++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/cd45ebd2/frameworks/projects/mobiletheme/src/spark/skins/ios7/BusyIndicatorSkin.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/mobiletheme/src/spark/skins/ios7/BusyIndicatorSkin.as b/frameworks/projects/mobiletheme/src/spark/skins/ios7/BusyIndicatorSkin.as index 805887b..a4fe64f 100644 --- a/frameworks/projects/mobiletheme/src/spark/skins/ios7/BusyIndicatorSkin.as +++ b/frameworks/projects/mobiletheme/src/spark/skins/ios7/BusyIndicatorSkin.as @@ -153,6 +153,16 @@ package spark.skins.ios7 symbolColorChanged = true; invalidateDisplayList(); } + if (styleProp == "styleName") { + var value:String = getStyle("styleName"); + + // We're being removed from the stage + if (value == null) { + stopRotation(); + busyIndicatorBackground = null; + busyIndicator = null; + } + } super.styleChanged(styleProp); } @@ -206,15 +216,15 @@ package spark.skins.ios7 event.updateAfterEvent(); } - private var rotationMatrix:Matrix; private function rotate(obj:DisplayObject, angle:Number, aroundX:Number, aroundY:Number):void { - rotationMatrix = new Matrix(); - rotationMatrix.translate(-aroundX,-aroundY); + var center:Number = Math.min(aroundX, aroundY); // stop wobbling if not square + var rotationMatrix:Matrix = new Matrix(); + rotationMatrix.translate(-center,-center); rotationMatrix.rotate(Math.PI*angle/180); - rotationMatrix.translate(aroundX,aroundY); + rotationMatrix.translate(center,center); obj.transform.matrix = rotationMatrix; } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/cd45ebd2/frameworks/projects/spark/src/spark/skins/spark/BusyIndicatorSkin.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/skins/spark/BusyIndicatorSkin.as b/frameworks/projects/spark/src/spark/skins/spark/BusyIndicatorSkin.as index c1c98e5..b0feef0 100644 --- a/frameworks/projects/spark/src/spark/skins/spark/BusyIndicatorSkin.as +++ b/frameworks/projects/spark/src/spark/skins/spark/BusyIndicatorSkin.as @@ -239,6 +239,18 @@ package spark.skins.spark symbolColorChanged = true; invalidateDisplayList(); } + + if (styleProp == "styleName") { + var value:String = getStyle("styleName"); + + // We're being removed from the stage + if (value == null) { + stopRotation(); + busyIndicatorBackground = null; + busyIndicator = null; + } + } + super.styleChanged(styleProp); } @@ -326,16 +338,17 @@ package spark.skins.spark event.updateAfterEvent(); } - private var rotationMatrix:Matrix; private function rotate(obj:DisplayObject, angle:Number, aroundX:Number, aroundY:Number):void { - rotationMatrix = new Matrix(); - rotationMatrix.translate(-aroundX,-aroundY); + var center:Number = Math.min(aroundX, aroundY); // stop wobbling if not square + var rotationMatrix:Matrix = new Matrix(); + rotationMatrix.translate(-center,-center); rotationMatrix.rotate(Math.PI*angle/180); - rotationMatrix.translate(aroundX,aroundY); + rotationMatrix.translate(center,center); obj.transform.matrix = rotationMatrix; } } } +
