Applicability
- Adobe Flash Professional version MX and higher
- Adobe Flex
Adobe has plans to stop updating and distributing the Flash Player at the end of 2020, and encourages authors interested in creating accessible web content to use HTML.
This technique relates to Success Criterion 2.2.1: Timing Adjustable (Sufficient).
Description
The objective of this technique is to notify users that they are almost out of time to complete an interaction. When scripts provide functionality that has time limits, the script can include functionality to warn the user of imminent time limits and provide a mechanism to request more time. 20 seconds or more before the time limit occurs, the script provides a confirm dialog that states that a time limit is imminent and asks if the user needs more time. If the user answers "yes" then the time limit is reset. If the user answers "no" or does not respond, the time limit is allowed to expire.
This technique involves time limits set with the setTimeout() method. If, for example, the time limit should be 60 seconds, you can set the time limit for 40 seconds (20 seconds less than the desired timeout) and show a confirm dialog. The confirm dialog sets a new timeout for the remaining 20 seconds. If the user requests more time, a new timeout is set. However, if the 20-second "grace period time limit" expires (meaning 60 seconds have now elapsed), the action appropriate for the expiry of the 60 second time limit in the original design is taken.
Examples
Example 1: Using ActionScript to offer a time limit extension before the timeout expires
This is a basic AS2 example of a time limit that can be extended by the user. An alert is shown after 40 seconds of inactivity, warning that the session is about to expire. The user is given 20 seconds to press the space bar or click on the "Yes" button. Note that the 40 second duration would be insufficient for most tasks and is artificially short for ease of demonstration.
import mx.controls.Alert; import flash.accessibility.Accessibility; mx.accessibility.AlertAccImpl.enableAccessibility(); var sessionTimeout; var sessionNotificationTimeout; var timeLimit: Number = 60000; var sessionAlert: Alert; resetTimeout(); testField.addEventListener("change", resetTimeout); function resetTimeout() { clearTimeout(sessionTimeout); clearTimeout(sessionNotificationTimeout); sessionTimeout = setTimeout(endSession, timeLimit); sessionNotificationTimeout = setTimeout(showTimeoutAlert, timeLimit - 20000); } function showTimeoutAlert() { sessionAlert = Alert.show("Click the YES button to extend your session", "Your login session is about to expire, do you need more time?", Alert.YES | Alert.NO, null, handleAlertClick); } function endSession() { sessionAlert.deletePopUp(); Alert.show("please log in again", "Your session has expired"); } function handleAlertClick(e) { if (e && e.detail && e.detail == Alert.YES) resetTimeout(); }
For a demonstration, see a working example of Using ActionScript to offer a time limit extension before the timeout expires. The source of Using ActionScript to offer a time limit extension before the timeout expires is available.
Tests
Procedure
- load the page and start a timer that is 20 seconds less than the time limit.
- when the timer expires, check that a confirmation dialog is displayed warning of the impending time limit and allows the user to extend the limit within 20 seconds.
Expected Results
Check #2 is true