It looks like you are trying to put something before the Application 
Control Bar
  <mx:AddChild relativeTo="{mainCB}" position="before">


if you just want to add it after the control bar,  a simple 
<mx:AddChild> will work


if you try to make a lay out with anything before the control bar as in:
<mx:LinkButton label="Button Before Control Bar"  />
    <mx:ApplicationControlBar dock="true" id="mainCB">.....

It puts the button AFTER the control bar


Eugene Louw wrote:
> Hi All,
>
> This should be somehting extremely simple,
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"; 
> xmlns:views="views.*">
>     <mx:states>
>         <mx:State name="NewCapture">
>             <mx:AddChild relativeTo="{mainCB}" position="before">
>                 <views:new_capture width="100%" height="100%">
>                 </views:new_capture>
>             </mx:AddChild>
>         </mx:State>
>         <mx:State name="Login">
>         </mx:State>
>         <mx:State name="Synchronise">
>         </mx:State>
>     </mx:states>
>     <mx:ApplicationControlBar dock="true" id="mainCB">
>         <mx:LinkButton label="Captures" click="currentState=''"/>
>         <mx:LinkButton label="New" click="currentState='NewCapture'"/>
>         <mx:LinkButton label="Synchronise" click="currentState='Login'"/>
>     </mx:ApplicationControlBar>   
> </mx:WindowedApplication>
>
>
> When I run the app and click on <mx:LinkButton label="New" 
> click="currentState='NewCapture'"/> I get the following error,
>
>
> RangeError: Error #2006: The supplied index is out of bounds.
>     at flash.display::DisplayObjectContainer/addChildAt()
>     at 
> mx.core::Container/addChildAt()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\Container.as:2206]
>     at 
> mx.states::AddChild/apply()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\states\AddChild.as:377]
>     at 
> mx.core::UIComponent/applyState()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]
>     at 
> mx.core::UIComponent/commitCurrentState()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:7019]
>     at 
> mx.core::UIComponent/setCurrentState()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:6948]
>     at mx.core::UIComponent/set 
> currentState()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:4260]
>
>
> Any ideas?
>
> -- 
> ------------------------------------------------
> Eugene Louw
> ------------------------------------------------
> 
> Checked by AVG - http://www.avg.com 
> Version: 8.0.138 / Virus Database: 270.5.10/1587 - Release Date: 8/2/2008 
> 5:30 PM
>   

Reply via email to