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
------------------------------------------------

Reply via email to