State Change Event

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

State Change Event

bilbosax
I'm looking for help finding the right event to listen for, if there actually
is one.

My application has several states, with a custom component that displays in
each of the individual states.  In one of the components, I have a webview
that shows a google map with a list next to it.  Webviews are always on top
in the z-order, so when I move to another state, I actually have to change
the visibility of the map to false because it doesn't disappear when I leave
the state where the map exists.  The problem is that when I leave the state
where the map exists, the map disappears first, then the rest of the state
transition happens which makes it look very clumsy and lazy.

What I would like to do is find an event that fires when the transition from
one state to the other is complete.  Then I could immediately react to that
and change the map visibility.  This would make the state and the map
disappear at the same time.  Is there an event that fires when a state
change is 100% complete, or when the displaylist is done updating for a new
state???

I already tried reacting to the stateChangeComplete event in my main
application where the states are defined, but it is firing long before the
display list is actually updated.  So is there an event that fires when the
display list is actually done generating the display after a state is
entered???

Thanks!!



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: State Change Event

bilbosax
I don't know if this how anybody else would do it, but it seems to be working
at this point.  I have a list in the state that I am moving to from the
state that contains the map.  I listen to the updateComplete event on the
list, and when that fires, I dispatch an event that hides the map.  This has
the effect of making it look like the map and the new state change at the
same time, which is what I wanted.  Even though this is working, I am
curious if there is a more standard event that most people would react to.
Let me know if you have any thoughts.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: State Change Event

OmPrakash Muppirala
I was going to suggest using the `updateComplete` event.  Looks like you
did the same :-)

Thanks,
Om

On Tue, Jan 9, 2018 at 2:23 PM, bilbosax <[hidden email]> wrote:

> I don't know if this how anybody else would do it, but it seems to be
> working
> at this point.  I have a list in the state that I am moving to from the
> state that contains the map.  I listen to the updateComplete event on the
> list, and when that fires, I dispatch an event that hides the map.  This
> has
> the effect of making it look like the map and the new state change at the
> same time, which is what I wanted.  Even though this is working, I am
> curious if there is a more standard event that most people would react to.
> Let me know if you have any thoughts.
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>
Reply | Threaded
Open this post in threaded view
|

Re: State Change Event

Erik J. Thomas
In reply to this post by bilbosax
Yes, I frequently listen for updateComplete event to hide a spinner showing busy states, especially if the lists are long and use complex item renderers, anything that makes them slow to update onscreen. It's reliable if (and only if) you have records in the underlying dataProvider. I found through trial and error though, that if the dataProvider list is empty, then updateComplete doesn't get fired. Again, for initial loading of lists, or if you are updating the underlying collection in a way that will cause the list to update.

For example:
<s:DataGroup width="100%" dataProvider="{_dataProvider}"
             contentBackgroundAlpha="0"
             itemRenderer="{itemRenderer}" updateComplete="Alert.hideBusy()">
Cheers,

Erik

On Jan 9, 2018, at 2:23 PM, bilbosax <[hidden email]> wrote:

I don't know if this how anybody else would do it, but it seems to be working
at this point.  I have a list in the state that I am moving to from the
state that contains the map.  I listen to the updateComplete event on the
list, and when that fires, I dispatch an event that hides the map.  This has
the effect of making it look like the map and the new state change at the
same time, which is what I wanted.  Even though this is working, I am
curious if there is a more standard event that most people would react to.
Let me know if you have any thoughts.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/