RES: [flexcoders] Re: currentState question
Did you try to remove the this. Part, when I want to change a state in the component/or application I just put currentState and it works fine. Also check your code to see if you're not pointing any component like Datagrids or comboboxs to an out of range index. Atenciosamente, Daniel Fernandes Credidio Tecnologia da Informação Grupo Santa Clara - Análise e Desenvolvimento. Rua Santa Clara, 100 - Parque Santa Clara Eusébio - CE - 61760-000 T +5585 4006-5613 [EMAIL PROTECTED] De: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Em nome de Nicolas Boulet-Lavoie Enviada em: sexta-feira, 25 de abril de 2008 14:51 Para: flexcoders@yahoogroups.com Assunto: RE: [flexcoders] Re: currentState question 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:[EMAIL PROTECTED] De la part de Derrick Anderson Envoyé : 25 avril 2008 13:41 À : flexcoders@yahoogroups.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:[EMAIL PROTECTED] De la part de Andrew Wetmore Envoyé : 25 avril 2008 12:49 À : flexcoders@yahoogroups.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 , Dmitri Girski [EMAIL PROTECTED] 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 , 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/
RES: [flexcoders] Re: currentState question
It seems that when you call the AddchildAt() you put an index that is out of range. For example: if you have a viewStack with already 2 canvas and is going to add a third one, addchildAt could be used to index it in the 0 And 1 index of the viewStack, if you want it to go to the last you just use Addchild since the index 2 doesn't exists yet. This logic can be used for all the containers. Atenciosamente, Daniel Fernandes Credidio Tecnologia da Informação Grupo Santa Clara - Análise e Desenvolvimento. Rua Santa Clara, 100 - Parque Santa Clara Eusébio - CE - 61760-000 T +5585 4006-5613 [EMAIL PROTECTED] De: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Em nome de Nicolas Boulet-Lavoie Enviada em: sexta-feira, 25 de abril de 2008 15:47 Para: flexcoders@yahoogroups.com Assunto: 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 À :