title: Titanium: Creating a view with dynamic height
body: <p>I ran into some problems when trying to create a view with a dynamic height.</p>
  
  <p>"post_comment" is my label where text will be displayed. The length of text has to be dynamic, and the "containComment" view will have to adjust its height to be able to display this label. </p>
  
  <pre><code>var post_comment = Titanium.UI.createLabel({
          color:'#000',
          text:L(randomText),
          top:10,
          bottom:30,
          left:4,
          width:220,
          height:'auto',
          font: { fontSize:11 },
      });
  
      var comment_height = 100;
  
      post_comment.addEventListener('postlayout', function(e) {
          comment_height = e.source.rect.height;
          alert(comment_height); &lt;--------- 1
      });
  
      var containComment = Titanium.UI.createView({
          layout :'horizontal',
          contentWidth:'100%',
          height: comment_height,
      });
      alert(comment_height);  &lt;-------- 2
  </code></pre>
  
  <p>I used postlayout to get the height but for some reason I cannot get the same value outside to the function.</p>
  
  <p>I tested the "comment_height" at the 2 locations indicated by the arrows. In 1, the height is shown to be correct. But at 2, the height is always the default value of 100. I was thinking that it was due to "comment_height" not being global so i sent it to the head of the script but it still does not fix the issue.</p>
  
  <p>Any help would be appreciated.</p>