キャンバスアプリケーションの方向の変更の処理
orientation イベントでは、モバイルデバイスでキャンバスアプリケーションが表示される方向の変更を処理できます。キャンバスアプリケーションをこのイベントに登録すると、親ウィンドウで window.orientation イベントが実行されるたびにこのイベントも実行されます。このイベントは、次の値を含むペイロードを返します。
| 値 | 説明 |
|---|---|
| clientHeight | キャンバスアプリケーションを表示するデバイスに固有のアプリケーションの高さ (ピクセル単位)。 |
| clientWidth | キャンバスアプリケーションを表示するデバイスに固有のアプリケーションの幅 (ピクセル単位)。 |
| orientation | 次のいずれかの値を含みます。
|
次のコードの例は、orientation イベントに登録する方法を示しています。
1swfobject.registerObject("clippy.orientation_event_snippet", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17// Capture the orientation event of the parent window.
18Sfdc.canvas.client.subscribe(sr.client,
19 {name : 'canvas.orientation',
20 onData : function (event) {
21 console.log("Parent's orientation: " + event.orientation +
22 "Canvas app height: " + event.clientHeight +
23 "Canvas app width: " + event. clientWidth);
24 }} );
25});
26