<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -51,14 +51,5 @@ package fb.util {
       if (obj is InteractiveObject &amp;&amp; !(obj is TextArea))
         (obj as InteractiveObject).tabEnabled = false;
     }
-
-    public static function isVisible(obj:DisplayObject):Boolean {
-      if (!obj.stage) return false;
-      var elder:DisplayObject = obj.parent;
-      do {
-        if (!elder.visible) return false;
-      } while (elder = elder.parent);
-      return true;
-    }
   }
 }</diff>
      <filename>fb/util/FlexUtil.as</filename>
    </modified>
    <modified>
      <diff>@@ -162,6 +162,7 @@
 
     // this override determines if the animation should occur first
     override public function set visible(to:Boolean):void {
+      if (super.visible == to) return;
       animateIn = !data.commentBoxActive &amp;&amp;
         data.filter_key == NileContainer.CurrentFilter;
       animateOut = UFI.count(data) == 0 &amp;&amp;</diff>
      <filename>fbair/nile/renderers/UFI.mxml</filename>
    </modified>
    <modified>
      <diff>@@ -34,10 +34,20 @@ package fbair.util.display {
     [Bindable] public var animate:Boolean = true;
 
     // should animate from 0 when created
-    [Bindable] public var animateIn:Boolean = true;
+    [Bindable] public var _animateIn:Boolean = true;
+    public function get animateIn():Boolean { return _animateIn; }
+    public function set animateIn(to:Boolean):void {
+//      trace(&quot;setting animateIn on &quot;+this);
+      _animateIn = to;
+    }
 
     // should animate to 0 when destroyed
-    [Bindable] public var animateOut:Boolean = false;
+    [Bindable] public var _animateOut:Boolean = false;
+    public function get animateOut():Boolean { return _animateOut; }
+    public function set animateOut(to:Boolean):void {
+//      trace(&quot;setting animateOut on &quot;+this);
+      _animateOut = to;
+    }
 
     // subsequent resize operations are immediate
     [Bindable] public var animateOnce:Boolean = false;
@@ -71,20 +81,21 @@ package fbair.util.display {
     }
 
     private function addedToStage(event:Event):void {
-      animate = animateIn &amp;&amp; Animate &amp;&amp; FlexUtil.isVisible(this);
+      trace(&quot;added to stage &quot;+this+&quot; animateIn:&quot;+animateIn+&quot; Animate:&quot;+Animate+&quot; isVisible:&quot;+isVisible());
+      animate = animateIn &amp;&amp; Animate &amp;&amp; isVisible();
       if (animate) {
         managedHeight = 0;
-        measuredHeight = super.measuredHeight;
+        startAnimation();
       }
     }
 
     public function remove(immediately:Boolean = false):void {
-      if (animateOut &amp;&amp; hasBeenVisible &amp;&amp;
-          !immediately &amp;&amp; FlexUtil.isVisible(this)) {
+      if (animateOut &amp;&amp; hasBeenVisible &amp;&amp; !immediately &amp;&amp; isVisible()) {
         animate = true;
         measuredHeight = 0;
         allowSetHeight = false;
         alpha = 0.3;
+        startAnimation();
         addEventListener(TWEEN_COMPLETE, removeCanvas);
       } else {
         removeCanvas();
@@ -110,28 +121,26 @@ package fbair.util.display {
     override public function get visible():Boolean { return _visible; }
     override public function set visible(to:Boolean):void {
       if (visible == to) return;
-
-      if (to &amp;&amp; measuredHeight) hasBeenVisible = true;
-
-      if (!Animate || !FlexUtil.isVisible(this)) {
-        immediateVisible = to;
-        return;
-      }
-
       _visible = to;
 
-      if (visible &amp;&amp; animateIn) {
+      if (visible) {
+        if (measuredHeight) hasBeenVisible = true;
         immediateVisible = true;
-        animate = true;
-        managedHeight = 0;
-        measuredHeight = super.measuredHeight;
-      } else if (animateOut &amp;&amp; hasBeenVisible) {
-        animate = true;
-        measuredHeight = 0;
-        allowSetHeight = false;
-        addEventListener(TWEEN_COMPLETE, hideCanvas);
+        if (Animate &amp;&amp; animateIn &amp;&amp; isVisible()) {
+          animate = true;
+          managedHeight = 0;
+          startAnimation();
+        }
       } else {
-        immediateVisible = to;
+        if (Animate &amp;&amp; animateOut &amp;&amp; hasBeenVisible &amp;&amp; isVisible()) {
+          animate = true;
+          allowSetHeight = false;
+          super.measuredHeight = 0;
+          startAnimation();
+          addEventListener(TWEEN_COMPLETE, hideCanvas);
+        } else {
+          immediateVisible = false;
+        }
       }
     }
 
@@ -145,36 +154,32 @@ package fbair.util.display {
     }
 
     override public function set measuredHeight(to:Number):void {
+      if (to == 0) return;
       if (visible) hasBeenVisible = true;
-
-      if (!allowSetHeight) return;
-
-      if (!Animate || !FlexUtil.isVisible(this)) {
-        managedHeight = super.measuredHeight = to;
-        return;
-      }
-
-      if (super.measuredHeight == to &amp;&amp; managedHeight == to) return;
+      if ((super.measuredHeight == to &amp;&amp; managedHeight == to) ||
+          !allowSetHeight) return;
 
       super.measuredHeight = to;
-      if (animate) startAnimation();
-      else managedHeight = to;
+      if (isAnimating) return;
+
+      if (!animate || !Animate || !isVisible())
+        managedHeight = to;
+      else
+        startAnimation();
     }
 
     public function startAnimation():void {
       if (isAnimating) return;
-      isAnimating = true;
+      clipContent = isAnimating = true;
       addEventListener(Event.ENTER_FRAME, tweenFrame);
-      clipContent = true;
       frameNum = 0;
       isGrowing = managedHeight &lt; super.measuredHeight;
     }
 
     public function endAnimation():void {
       if (!isAnimating) return;
-      isAnimating = false;
+      clipContent = isAnimating = false;
       removeEventListener(Event.ENTER_FRAME, tweenFrame);
-      clipContent = false;
       managedHeight = super.measuredHeight;
       allowSetHeight = true;
       velocity = 0;
@@ -196,5 +201,15 @@ package fbair.util.display {
       }
       invalidateSize();
     }
+
+    public function isVisible():Boolean {
+      trace(&quot;isVisible? &quot;+this);
+      if (!stage) return false;
+      var elder:DisplayObject = parent;
+      do {
+        if (!elder.visible) return false;
+      } while (elder = elder.parent);
+      return true;
+    }
   }
 }</diff>
      <filename>fbair/util/display/AnimatedCanvas.as</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>69650e2367165288a7889f608b17243c01ae4305</id>
    </parent>
  </parents>
  <author>
    <name>Lee Byron</name>
    <email>leebyron@lbyron.local</email>
  </author>
  <url>http://github.com/jubishop/Facebook-for-Adobe-AIR/commit/a691e27458524afa35d13e90b1698de54111f732</url>
  <id>a691e27458524afa35d13e90b1698de54111f732</id>
  <committed-date>2009-05-13T15:48:43-07:00</committed-date>
  <authored-date>2009-05-13T15:48:43-07:00</authored-date>
  <message>tracing at some points, but the animated canvas cleans up its logic</message>
  <tree>921dbfa70ac974007b0af7500fe5884b108a6422</tree>
  <committer>
    <name>Lee Byron</name>
    <email>leebyron@lbyron.local</email>
  </committer>
</commit>
