I need to implement some sort of data locking in a Flex application I'm developin开发者_如何学Gog. A user clicks a specific button to "check out" the data set, and other users must wait until they are finished before they can make edits. After a period of inactivity, the application will release the lock to someone else.
What I'm after is an easy way to determine if the user is still interacting with the application so they don't have to manually keep clicking "yes I want to continue editing". For example, I could handle all mouse clicks for the entire application and add 5 minutes to the timeout every time they click something. Are there any better options for doing something like this? Is there something built in to check for last interaction time?
Here's an answer I gave to a similar questions: Flex Web Application Timeout after a specific time...
In a nutshell, I create a timer that gets reset every time a mouse move is detected.
Hope that helps.
Do a search for the FlexEvent.IDLE event. We only used it for an AIR application, and I'm just blabbing, but I seem to remember it working much better for a AIR/WindowedApplication than a plain ol' Application.
Hope that helps. Best of luck, Jeremy
精彩评论