title: Flex - Binding ViewStack selectedChild Property Using a String Value
body: <p>The attached code example (pseudo code) compiles, but throws this Run-Time Error:</p>
  
  <pre><code>TypeError: Error #2007: Parameter child must be non-null.
      at flash.display::DisplayObjectContainer/getChildIndex()
      at mx.core::Container/getChildIndex()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\Container.as:2409]
      at mx.containers::ViewStack/set selectedChild()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\containers\ViewStack.as:557]
  
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&gt;
      &lt;mx:Script&gt;
          &lt;![CDATA[
              [Bindable]
              private var targetViewName:String = "content";
          ]]&gt;
      &lt;/mx:Script&gt;
  
      &lt;mx:ViewStack id="viewStack" width="100%" height="100%" 
          selectedChild="{Container(viewStack.getChildByName(targetViewName))}"&gt;
          &lt;mx:Panel id="welcome" width="100%" height="100%" /&gt;
  
          &lt;mx:Panel id="content" width="100%" height="100%" /&gt;
      &lt;/mx:ViewStack&gt;
  &lt;/mx:Application&gt;
  </code></pre>
  
  <p>Is there some way I can get this to work without having to call a function to set the selectedChild?</p>
  
  <p>Thanks.</p>