Techniques for WCAG 2.0

Skip to Content (Press Enter)

-

FLASH35: Using script to scroll Flash content, and providing a mechanism to pause it

Applicability

This technique relates to:

User Agent and Assistive Technology Support Notes

See User Agent Support for Flash for general information on user agent support.

Description

The objective of this technique is to provide a way for users to stop scrolling content when the scrolling is created by a script. Scrolling content can be difficult or impossible to read by users with low vision or with cognitive disabilities. The movement can also be distracting for some people making it difficult for them to concentrate on other parts of the Web page.

Examples

Example 1: A toggle button to pause and resume scrolling

In this example, text scrolls from left to right. A toggle button is provided that allows the user to pause and resume the scrolling behavior. Additionally, a checkbox is provided which can be used to slow down the scrolling speed.

Note: Users may prefer a greater variety of scrolling speed options than are offered in this example. Developers might choose to provide several speed choices with a slider or drop down list control in order to accomplish this.

Example Code:

import fl.accessibility.ButtonAccImpl;
import fl.accessibility.CheckBoxAccImpl;

ButtonAccImpl.enableAccessibility();
CheckBoxAccImpl.enableAccessibility();

var scrollInterval: int;
var intervalLength: int = 15;

var expandedViewer: MovieClip = exampleScroller.expandedViewer;
var scrollText: MovieClip = exampleScroller.scrollText;
var scrollViewer: MovieClip = exampleScroller.scrollViewer;

var scrollingPaused: Boolean = true;

scrollStopper.addEventListener(MouseEvent.CLICK, handleBtnClick, false);
slowDown_chk.addEventListener(MouseEvent.CLICK, handleChkClick, false);

function handleBtnClick(e) {
  toggleScroll(false);
  e.target.label = scrollingPaused? "Resume Scrolling": "Stop Scrolling";
}

//slow down scrolling speed
function handleChkClick(e) {
  intervalLength = e.target.selected? 50: 15;
  if (! scrollingPaused) {
    clearTimeout(scrollInterval);
    toggleScroll(true);
  }
}

//pause or resume scrolling
function toggleScroll(noToggle: Boolean) {
  if (noToggle || scrollingPaused)
  scrollInterval = setInterval(moveText, intervalLength); else
  clearTimeout(scrollInterval);
  if (! noToggle)
  scrollingPaused = ! scrollingPaused;
}

function moveText() {
  if (scrollText.x + scrollText.width < scrollViewer.x)
  scrollText.x = scrollViewer.x + scrollViewer.width;
  scrollText.x -= 1;
}

//initiate scrolling
toggleScroll(false);

The technique is demonstrated in the working version of A toggle button to pause and resume scrolling. The source of A toggle button to pause and resume scrolling is available.

Tests

Procedure

When a Flash Movie contains scrolling content:

  1. Confirm that a button is provided that allows users to pause and resume the scrolling behavior

  2. Confirm that pressing the button stops the scrolling

  3. Confirm that pressing the button again restarts the scrolling

Expected Results

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.