title: How to determine whether a DisplayObject has been rendered
body: <p>I'm puzzled about whether the <code>visible</code> property of <code>DisplayObject</code> is:</p>
  
  <ul>
  <li>an <em>indication from Flex</em> of whether the display object is visible.</li>
  <li>an <em>instruction to Flex</em> to display the display object.</li>
  </ul>
  
  <p>I'm asking because I'm automating some Flex tests using Flex Pilot, and I need to know for certain when a display object becomes clickable.  In the application I'm testing, <em>clickable</em> seems to mean <em>rendered.</em></p>
  
  <p>Given the nature of the application and my tests, I don't think it's feasible to watch for the <code>updateCompleted</code> event.  I need a way to detect whether the display object is visible based on the values of its properties and its containers' properties at a given moment.</p>
  
  <p>I understand that even if a display object's <code>visible</code> property is true, it will be visible only if all of its containers are also visible.  This means that I'll have to extend Flex Pilot by writing an ActionScript method to determine whether the display object and its containers all have <code>visible=true</code>.  But I'm concerned that even that method won't tell me for sure that the display object is really rendered, and therefore clickable.</p>
  
  <p>My puzzle comes from reading two descriptions from Adobe.</p>
  
  <p>The <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_advanced_2.html" rel="nofollow">"About creating advanced components"</a> document suggests that the <code>visible</code> property is set by Flex after the display object is rendered.  In this description, it is Flex's job to set the value,
  so that value is thus an <em>indication from Flex</em> of whether the display object is visible.</p>
  
  <p>On the other hand,
  Adobe's <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#visible" rel="nofollow">description of the <code>visible</code> property</a> suggests that the property is writable.  And the code sample suggests that if the application changes the value, Flex will respond by displaying or hiding the display object.  In this description, the application sets the value as an <em>instruction to Flex</em> to display the object.  I'm guessing that in this case Flex re-renders the display object (if <code>visible</code> changes from <code>false</code> to <code>true</code>) or its container (if <code>visible</code> changes from <code>true</code> to <code>false</code>).</p>
  
  <p>So two main questions:</p>
  
  <p><strong>Is the <code>visible</code> property used in both of these ways, both as an indication from Flex about the display object's visibility and an instruction to Flex about whether to display the object?</strong></p>
  
  <p><strong>If the application changes <code>visible</code> from false to true, when does the display object actually become visible?</strong>  Is it visible by the time the setter returns?  Or does setting the property merely schedule the object to become visible during some later event?  If it's the latter, that means there may be a duration during which <code>visible</code> is true, but the display object has not yet been rendered.  If that's the case, I'm at a loss for how to determine, from the state of the display objects at a given instant, whether a display object has been rendered.</p>