View Full Version : Problem with view states
cadju
01-23-2007, 10:10 AM
How can we change the current state to another state wich isn't the one it's based on?
For example:how to change from results to the base state.If i try it i get erros when running the application
base
-tabs
-results
It seems like it's not possible to return to a state wich didn't call the currentstate, I'm right?
u use currentState
so to go to he state names 'tabs' use
currentState = "tabs"
to go back to the base state use
currentState = "";
cadju
01-23-2007, 12:40 PM
I've no problem using that... but when I try calling the base state from the ''results" state, i got errors when running the application.
i got errors when running the application.what errors are u getting?
cadju
01-23-2007, 06:57 PM
what errors are u getting?
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.containers::Accordion/::drawHeaderFocus()
at mx.containers::Accordion/::commitSelectedIndex()
at mx.containers::Accordion/mx.containers:Accordion::commitProperties()
at mx.core::UIComponent/validateProperties()
at mx.managers::LayoutManager/::validateProperties()
at mx.managers::LayoutManager/::doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/::callLaterDispatcher2()
at mx.core::UIComponent/::callLaterDispatcher()
dr_zeus
01-23-2007, 07:09 PM
There are no restrictions on state changes in Flex. You should be able to change from any arbitrary state to another. It's probably an issue with a "missing" component from the previous state that is expected in your code somewhere. Can we see some of your code? Unfortunately, the error isn't enough.
DangerAhead
01-23-2007, 11:47 PM
there is a component in the state you're calling. it doesn't exist yet if you haven't been to that state yet.
one thing you can do is create an updateComponent() function in the main mxml
and on the component.
and put it on the component in the non-base state:
<mx:Component .... creationComplete="updateComponent()" />
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.