| パッケージ | flash.accessibility |
| クラス | public class AccessibilityProperties |
| 継承 | AccessibilityProperties Object |
| サブクラス | UIComponentAccImpl, UIComponentAccProps |
| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
任意の表示オブジェクト に AccessibilityProperties オブジェクトを付加できますが、Flash Player は特定のオブジェクトに関連した AccessibilityProperties オブジェクトだけを読み取ります。これに該当するオブジェクトは、SWF ファイル全体(DisplayObject.root)、コンテナオブジェクト(DisplayObjectContainer とサブクラス)、ボタン(SimpleButton とサブクラス)、およびテキスト(TextField とサブクラス)です。
アクセシビリティ補助はナビゲーションの基本的方法としてオブジェクトの名前をユーザーに提供するため、これらのオブジェクトの name プロパティは指定するプロパティの中で最も重要です。AccessibilityProperties.name と DisplayObject.name を混同しないでください。この 2 つは互いに無関係な別個のプロパティです。AccessibilityProperties.name プロパティはアクセシビリティ補助で読み上げられる名前であるのに対し、DisplayObject.name は基本的に、ActionScript コードでのみ認識される変数名です。
Flash Professional では、AccessibilityProperties オブジェクトのプロパティは、オーサリング時にアクセシビリティパネルで使用できる設定をオーバーライドします。
Flash Player がアクセシビリティ補助をサポートする環境で実行されているかどうかを確認するには、Capabilities.hasAccessibility プロパティを使用します。AccessibilityProperties オブジェクトを変更した場合、変更内容を有効にするには、Accessibility.updateProperties() メソッドを呼び出す必要があります。
関連する API エレメント
flash.display.DisplayObject.accessibilityProperties
flash.display.InteractiveObject.tabIndex
flash.system.Capabilities.hasAccessibility
| プロパティ | 定義元 | ||
|---|---|---|---|
![]() | constructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクター関数への参照です。 | Object | |
| description : String
アクセシビリティ提示におけるこの表示オブジェクトの記述を提供します。 | AccessibilityProperties | ||
| forceSimple : Boolean
true の場合、Flash Player はこの表示オブジェクト内の子オブジェクトをアクセシビリティ提示から除外します。 | AccessibilityProperties | ||
| name : String
アクセシビリティ提示におけるこの表示オブジェクトの名前を提供します。 | AccessibilityProperties | ||
| noAutoLabeling : Boolean
true の場合、Flash Player のデフォルトの自動ラベル機能が無効になります。 | AccessibilityProperties | ||
| shortcut : String
この表示オブジェクトに関連したキーボードショートカットを示します。 | AccessibilityProperties | ||
| silent : Boolean
true の場合、この表示オブジェクトはアクセシビリティ提示から除外されます。 | AccessibilityProperties | ||
| メソッド | 定義元 | ||
|---|---|---|---|
新しい AccessibilityProperties オブジェクトを作成します。 | AccessibilityProperties | ||
![]() |
オブジェクトに指定されたプロパティが定義されているかどうかを示します。 | Object | |
![]() |
Object クラスのインスタンスが、パラメーターとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。 | Object | |
![]() |
指定されたプロパティが存在し、列挙できるかどうかを示します。 | Object | |
![]() |
ループ処理に対するダイナミックプロパティの可用性を設定します。 | Object | |
![]() |
ロケール固有の規則に従って書式設定された、このオブジェクトのストリング表現を返します。 | Object | |
![]() |
指定されたオブジェクトのストリング表現を返します。 | Object | |
![]() |
指定されたオブジェクトのプリミティブな値を返します。 | Object | |
description | プロパティ |
public var description:String| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
アクセシビリティ提示におけるこの表示オブジェクトの記述を提供します。このオブジェクトに関する多くの情報を提示するには、名前を簡潔にして、ほとんどの情報を description プロパティに含めるのが適切です。SWF ファイル全体、コンテナ、ボタンおよびテキストが対象となります。デフォルト値は空のストリングです。
Flash Professional では、このプロパティはアクセシビリティパネルの「詳細」フィールドに対応しています。
forceSimple | プロパティ |
public var forceSimple:Boolean| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
true の場合、Flash Player はこの表示オブジェクト内の子オブジェクトをアクセシビリティ提示から除外します。デフォルト値は false です。SWF ファイル全体とコンテナが対象となります。
name | プロパティ |
public var name:String| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
アクセシビリティ提示におけるこの表示オブジェクトの名前を提供します。SWF ファイル全体、コンテナ、ボタンおよびテキストが対象となります。これと DisplayObject.name を混同しないでください。デフォルト値は空のストリングです。
Flash Professional では、このプロパティはアクセシビリティパネルの「名前」フィールドに対応しています。
noAutoLabeling | プロパティ |
public var noAutoLabeling:Boolean| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
true の場合、Flash Player のデフォルトの自動ラベル機能が無効になります。自動ラベル機能は、ボタン内部のテキストオブジェクトをボタン名として扱い、テキストフィールドの近くのテキストオブジェクトをテキストフィールド名として扱います。デフォルト値は false です。SWF ファイル全体だけが対象となります。
noAutoLabeling プロパティ値は、アクセシビリティ補助が初回に SWF ファイルを調べるより前に指定しない限り、無視されます。noAutoLabeling を true に設定する場合は、コード内のできるだけ早い段階で設定する必要があります。
shortcut | プロパティ |
public var shortcut:String| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
この表示オブジェクトに関連したキーボードショートカットを示します。ショートカットキーに既に関連付けられた UI コントロールに対してのみ、このストリングを提供してください。コンテナ、ボタン、テキストが対象となります。デフォルト値は空のストリングです。
注意:このプロパティを割り当てても、特定のキー操作の組み合わせが自動的にこのオブジェクトに割り当てられるわけではありません。そうするためには、例えば KeyboardEvent をリッスンして手動で指定する必要があります。
このストリングのシンタックスは修飾キーに長い名前を使用し、プラス(+)文字を使ってキー操作の組み合わせを表します。有効なストリングは、例えば "Ctrl+F"、"Ctrl+Shift+Z" などです。
silent | プロパティ |
public var silent:Boolean| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
true の場合、この表示オブジェクトはアクセシビリティ提示から除外されます。デフォルト値は false です。SWF ファイル全体、コンテナ、ボタンおよびテキストが対象となります。
AccessibilityProperties | () | コンストラクター |
public function AccessibilityProperties()| 言語バージョン: | ActionScript 3.0 |
| ランタイムバージョン: | AIR 1.0, Flash Player 9 |
新しい AccessibilityProperties オブジェクトを作成します。
AccessibilityExample、CustomAccessibleButton、CustomSimpleButton、および ButtonDisplayState クラスを使用して、一般的なスクリーンリーダーとの連携が可能なアクセシビリティ準拠メニューを作成します。AccessibilityProperties クラスの主な機能は次のとおりです。
-
configureAssetsを呼び出すことにより、カスタムボタンを作成して、ボタンのラベルと説明を設定します。これらの値はスクリーンリーダーによってエンドユーザーに伝送されます。 setTimeOut()を呼び出すことにより、プロパティの更新前に Flash Player がスクリーンリーダーを検出するために必要な時間を確保します。
メモ: setTimeout() は、Accessibility.active の検査の前に呼び出してください。こうすれば、Flash Player がスクリーンリーダー(使用可能な場合)に接続するのに必要な 2 秒間を確保できます。十分な遅延時間を指定しないと、スクリーンリーダーが使用可能であっても、setTimeout 呼び出しでは、false が返されます。
次の例で Accessibility.updateProperties() メソッドが処理されるのは Accessibility.active 呼び出しが true を返す場合だけです。つまり、Flash Player がアクティブ状態のスクリーンリーダーに現在接続している場合だけです。updateProperties が呼び出されたときにスクリーンリーダーがアクティブ状態でない場合、IllegalOperationError 例外がスローされます。
package {
import flash.display.Sprite;
import flash.accessibility.Accessibility;
import flash.utils.setTimeout;
public class AccessibilityPropertiesExample extends Sprite {
public static const BUTTON_WIDTH:uint = 90;
public static const BUTTON_HEIGHT:uint = 20;
private var gutter:uint = 5;
private var menuLabels:Array = new Array("PROJECTS", "PORTFOLIO", "CONTACT");
private var menuDescriptions:Array = new Array("Learn more about our projects"
, "See our portfolio"
, "Get in touch with our team");
public function AccessibilityPropertiesExample() {
configureAssets();
setTimeout(updateAccessibility, 2000);
}
private function updateAccessibility():void {
trace("Accessibility.active: " + Accessibility.active);
if(Accessibility.active) {
Accessibility.updateProperties();
}
}
private function configureAssets():void {
var child:CustomAccessibleButton;
for(var i:uint; i < menuLabels.length; i++) {
child = new CustomAccessibleButton();
child.y = (numChildren * (BUTTON_HEIGHT + gutter));
child.setLabel(menuLabels[i]);
child.setDescription(menuDescriptions[i]);
addChild(child);
}
}
}
import flash.accessibility.AccessibilityProperties;
import flash.display.Shape;
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextFormat;
import flash.text.TextField;
class CustomAccessibleButton extends Sprite {
private var button:SimpleButton;
private var label1:TextField;
private var description:String;
private var _name:String;
public function CustomAccessibleButton(_width:uint = 0, _height:uint = 0) {
_width = (_width == 0) ? AccessibilityPropertiesExample.BUTTON_WIDTH : _width;
_height = (_height == 0) ? AccessibilityPropertiesExample.BUTTON_HEIGHT : _height;
button = buildButton(_width, _height);
label1 = buildLabel(_width, _height);
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(event:Event):void {
trace("addedHandler: " + name);
var accessProps:AccessibilityProperties = new AccessibilityProperties();
accessProps.name = this._name;
accessProps.description = description;
accessibilityProperties = accessProps;
removeEventListener(Event.ADDED, addedHandler);
}
private function buildButton(_width:uint, _height:uint):SimpleButton {
var child:SimpleButton = new CustomSimpleButton(_width, _height);
addChild(child);
return child;
}
private function buildLabel(_width:uint, _height:uint):TextField {
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.size = 11;
format.color = 0xFFFFFF;
format.align = TextFormatAlign.CENTER;
format.bold = true;
var child:TextField = new TextField();
child.y = 1;
child.width = _width;
child.height = _height;
child.selectable = false;
child.defaultTextFormat = format;
child.mouseEnabled = false;
addChild(child);
return child;
}
public function setLabel(text:String):void {
label1.text = text;
this._name = text;
}
public function setDescription(text:String):void {
description = text;
}
}
class CustomSimpleButton extends SimpleButton {
private var upColor:uint = 0xFFCC00;
private var overColor:uint = 0xCCFF00;
private var downColor:uint = 0x00CCFF;
public function CustomSimpleButton(_width:uint, _height:uint) {
downState = new ButtonDisplayState(downColor, _width, _height);
overState = new ButtonDisplayState(overColor, _width, _height);
upState = new ButtonDisplayState(upColor, _width, _height);
hitTestState = new ButtonDisplayState(upColor, _width, _height);
useHandCursor = true;
}
}
class ButtonDisplayState extends Shape {
private var bgColor:uint;
private var _width:uint;
private var _height:uint;
public function ButtonDisplayState(bgColor:uint, _width:uint, _height:uint) {
this.bgColor = bgColor;
this._width = _width;
this._height = _height;
draw();
}
private function draw():void {
graphics.beginFill(bgColor);
graphics.drawRect(0, 0, _width, _height);
graphics.endFill();
}
}
}
Tue Jun 12 2018, 10:34 AM Z
継承されるパブリックプロパティを隠す
継承されるパブリックプロパティを表示