Something to take a look at is that if you've defined your states in design 
view, etc., it is possible that a UI component you're referring to hasn't been 
created yet, or something like that.  What I like to do with states is to 
show/hide or move things around, but not to create or remove UI from the 
display list because you're going to have issues potentially with trying to 
refer to objects not created or have been removed.
 
Remember you could simply have your login form created from the start and off 
to the left, hidden, if you have horizontalScrollPolicy set to "off".  Then 
when you go into the login state, you simply  move the form into view.
 
Jeff
 
-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nicolas 
Boulet-Lavoie
Sent: Friday, April 25, 2008 2:47 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: currentState question



        Hello,

         

        I'm still getting the same error, even if I put the currentState before 
the init method call.

         

        Here is the debug output :

         

        RangeError: Error #2006: L'index indiqué sort des limites.

              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::RemoveChild/remove()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\states\RemoveChild.as:146]

              at 
mx.core::UIComponent/removeState()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:7169]

              at 
mx.core::UIComponent/commitCurrentState()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:7011]

              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]

              at 
ApplicationReception/handFermerSession()[C:\__Projets\__Connect\ApplicationReception\src\ApplicationReception.as:407]

              at flash.events::EventDispatcher/dispatchEventFunction()

              at flash.events::EventDispatcher/dispatchEvent()

              at 
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:168]

              at 
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:191]

              at 
mx.rpc::Responder/result()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:41]

              at 
mx.rpc::AsyncRequest/acknowledge()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]

              at 
DirectHTTPMessageResponder/completeHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:381]

              at flash.events::EventDispatcher/dispatchEventFunction()

              at flash.events::EventDispatcher/dispatchEvent()

              at flash.net::URLLoader/onComplete()

         

         

        Does it gives more infos?

         

        Thanks

         

        Nicolas

         

        De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la part de 
Tim Hoff
        Envoyé : 25 avril 2008 14:18
        À : flexcoders@yahoogroups.com
        Objet : [flexcoders] Re: currentState question

         

        Hey Nicolas,
        
        It douen't look like you're setting a base (starting) state for the 
        application. This would need to happen before creationComplete 
        (initialize); otherwise the application doesn't know which state to 
        render initially. See if this works:
        
        <mx:Application 
        xmlns:mx="http://www.adobe.com/2006/mxml";
        xmlns:perso="components.*"
        layout="absolute" 
        currentState="frmLogin"
        creationComplete="init()">
        
        -TH
        
        --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
, "Nicolas Boulet-Lavoie" 
        <[EMAIL PROTECTED]> wrote:
        >
        > Derrick,
        > 
        > 
        > 
        > Yes, even if I write :
        > 
        > 
        > 
        > this.currentState = 'frmLogin';
        > 
        > 
        > 
        > I'm getting the same error.
        > 
        > 
        > 
        > I will explain further my application design.
        > 
        > 
        > 
        > <mx:Application 
        > 
        > xmlns:mx="http://www.adobe.com/2006/mxml";
        > 
        > xmlns:perso="components.*"
        > 
        > layout="absolute" 
        > 
        > creationComplete="init()">
        > 
        > 
        > 
        > On creationComplete event, it enters the init() method.
        > 
        > 
        > 
        > public function init():void {
        > 
        > this.currentState = 'frmLogin';
        > 
        > // Removed content //
        > 
        > }
        > 
        > 
        > 
        > So, as soon as the application load, it's not in the base state but 
        in
        > another specified state (here, frmLogin). Is this design can cause 
        the above
        > problem?
        > 
        > 
        > 
        > The state switch is called in a callback method of a http service 
        object
        > which is :
        > 
        > 
        > 
        > private function handFermerSession(p_objEvent:ResultEvent):void {
        > 
        > try {
        > 
        > this.currentState = 'frmLogin';
        > 
        > } catch( err:Error ) {
        > 
        > Alert.show(err.message.toString());
        > 
        > }
        > 
        > }
        > 
        > 
        > 
        > I hope it's more clear...
        > 
        > 
        > 
        > Thanks
        > 
        > 
        > 
        > Nicolas
        > 
        > 
        > 
        > 
        > 
        > De : flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
 [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] 
        De la
        > part de Derrick Anderson
        > Envoyé : 25 avril 2008 13:41
        > À : flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
        > Objet : Re: [flexcoders] Re: currentState question
        > 
        > 
        > 
        > i'm with ghus32, if you only have 2 states, why not just use the
        > currentState = 'statename' ? do you still get an error with that?
        > 
        > d.
        > 
        > On Fri, Apr 25, 2008 at 1:22 PM, Nicolas Boulet-Lavoie
        > <[EMAIL PROTECTED]> wrote:
        > 
        > Hello guys,
        > 
        > 
        > 
        > Thank you for your quick reply. I'm still getting the 2006 error 
        even with
        > your suggestions.
        > 
        > 
        > 
        > Here is the structure of my states :
        > 
        > 
        > 
        > - <Base state>
        > 
        > o frmAppGestion
        > 
        > o frmLogin (start)
        > 
        > 
        > 
        > I try to reset the state when I'm in the frmAppGestion state.
        > 
        > 
        > 
        > But, there is something weird with the state stack. In the state 
        manager, as
        > you can see, there are 3 states (base, frmAppGestion and frmLogin).
        > 
        > 
        > 
        > Here is my code :
        > 
        > 
        > 
        > <mx:states>
        > 
        > <mx:State name="frmAppGestion">
        > 
        > // Removed content //
        > 
        > </mx:State>
        > 
        > <mx:State name="frmLogin">
        > 
        > // Removed content // 
        > 
        > </mx:State>
        > 
        > </mx:states>
        > 
        > 
        > 
        > As you can see, they are only 2 states not 3. Maybe, this is the 
        problem?
        > 
        > 
        > 
        > Thanks
        > 
        > 
        > 
        > Nicolas
        > 
        > 
        > 
        > De : flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
 [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] 
        De la
        > part de Andrew Wetmore
        > Envoyé : 25 avril 2008 12:49
        > À : flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
        > Objet : [flexcoders] Re: currentState question
        > 
        > 
        > 
        > The other possibility is that the problem comes from using double
        > quotation marks ("") instead of single(''). currentState likes 
        single
        > quotation marks.
        > 
        > --- In flexcoders@yahoogroups.com 
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
        40yahoogroups.com> ,
        > "Dmitri Girski" <mitek17@> wrote:
        > >
        > > Bonjour,
        > > 
        > > I am pretty sure that this error comes as a consequence of 
        changing
        > > the state. You should check what happens when you change the 
        state -
        > > probably you trying to access an element which does not exist in 
        the
        > > base state.
        > > 
        > > Cheers,
        > > Dmitri.
        > > 
        > > 
        > > 
        > > 
        > > 
        > > --- In flexcoders@yahoogroups.com 
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
        40yahoogroups.com> ,
        > "Nicolas Boulet-Lavoie"
        > > <nicolasboulet@> wrote:
        > > >
        > > > Hello,
        > > > 
        > > > 
        > > > 
        > > > When I try to use this VERY easy command :
        > > > 
        > > > 
        > > > 
        > > > currentState = ""
        > > > 
        > > > 
        > > > 
        > > > I'm getting this error.
        > > > 
        > > > 
        > > > 
        > > > Error #2006: L'index indiqu� sort des limites.
        > > > 
        > > > 
        > > > 
        > > > Any idea why?
        > > > 
        > > > 
        > > > 
        > > > -- 
        > > > 
        > > > Merci et bonne journ�e,
        > > > 
        > > > 
        > > > 
        > > > Nicolas Boulet-Lavoie, Webmestre/Webmaster
        > > > 
        > > > --------------------------------
        > > > 
        > > > L A P R I S E �
        > > > 
        > > > T�l: 248-8886 poste 288
        > > > 
        > > > nicolasboulet@
        > > > 
        > > > 
        > > > 
        > > > http://www.maisonlaprise.com/
        > > > 
        > > > http://www.habitaflex.com/
        > > > 
        > > > http://www.lorendo.com/
        > > > 
        > > > http://www.tomindustries.com/
        > > > 
        > > > --------------------------------
        > > >
        >

        

         

Reply via email to