(注)今回追加した「モバイル端末回転を知らせるイベント」[event key=orientation]を予約しておくと、「config.anprjに設定した縦横幅」にリサイズします。暫定仕様です。
イベント予約とそういう処理は分けるべきだなぁとリリースしてから気付きました……。
●ANBooks更新(
公開先)
0.16
* chg:AIRNovel 3.24に更新
* add:ANBooksで画面サイズ変更・回転をサポート。イベント発生、変数も設定。
※ただし現状[l]において回転イベントが発生しない。[s]なら発生。
これはANBooksでのみの現象。実機やコマンドライン開発環境なら問題なし。
Btn= はホームボタンの方向。縦長に普通に持ったときに手前、下に来る方を指す。

※回転イベントの
テストデータ有り。以下は引用。
[call label=*rotate]
[event global=false call=true key=orientation label=*rotate]
ans[span layout='fontSize="18"'] -- ver
&const.flash.desktop.NativeApplication.nativeApplication.applicationDescriptor.versionNumber@str&[l][r]
[s]
*rotate
; デバイス横・縦幅(初期依存)
; &const.flash.system.Capabilities.screenResolutionX&、
; &const.flash.system.Capabilities.screenResolutionY&[r]
; デバイスによってサポートされている方向
; DLRU=
; &const.Stage.supportedOrientations.default&、
; &const.Stage.supportedOrientations.rotatedLeft&、
; &const.Stage.supportedOrientations.rotatedRight&、
; &const.Stage.supportedOrientations.upsideDown&[r]
; (現在の)ステージ横・縦幅
&const.flash.display.Stage.stageWidth&、
&const.flash.display.Stage.stageHeight&[r]
&const.Stage.deviceOrientation&、 ; デバイス方向
; &const.Stage.orientation&[r] ; ステージ方向
; &const.StageOrientationEvent.beforeOrientation&、 ; ステージ方向の前回値
; &const.StageOrientationEvent.afterOrientation&[r] ; ステージ方向と同じ値
[return]
●リリース
Ans&
桜、
an_sdk、
Android、
ChromeOS、
iPad、
iPhone(
全ソース)
3.24
* chg:Android版、(ホームボタンなどで)ホームに戻っただけではアプリが終わらない仕様にした。(ホームボタン長押しで個別に終わらせる)
* add:[
event]にモバイル端末回転を知らせるイベント key=orientation を追加。
* add:config.anprj に設定した画面サイズを取得する変数
const.an.xmlConfig.window.width、〜height 追加。
* add:デバイス回転状態の変数追加。
const.Stage.deviceOrientation ; デバイス方向(iOSでは冒頭、unknown)
const.Stage.orientation ; ステージ方向
const.StageOrientationEvent.beforeOrientation ; ステージ方向の前回値(初期NULL)
const.StageOrientationEvent.afterOrientation ; ステージ方向と同じ値(初期NULL)
* add:デバイスによってサポートされている方向を調べる変数追加。値はtrueかNULL。
const.Stage.supportedOrientations.default
const.Stage.supportedOrientations.rotatedLeft
const.Stage.supportedOrientations.rotatedRight
const.Stage.supportedOrientations.upsideDown
* chg:center等で位置決定時にscaleの絶対値を画像サイズに掛ける修正。
* add:[window]で画面サイズ変更後にTrans.asのresizeCache()実行。
* chg:[let]など変数に値をセットする処理でエラー時のメッセージが分かりにくかったのを修正。例えば以下のように。
以前:
Error #1009: Cannot access a property or method of a null object reference.
修正後:
例外 mes=[変数に値セット] 変数[const.flash.display.Stage.stageWidth]は書き換え不可です
★回転とモバイル端末画面サイズ関係の変数追加。整理すると以下になる。
・const.flash.system.Capabilities.screenResolutionX、〜Y は、
ハードウェアが表示可能な最大画面解像度を返す。回転しても不変。
PCではモニタ、モバイルでは端末の最大表示可能ドット数。
デバイスにより癖がある。
iPhone……ホームボタンが下になる縦長の状態での縦横で固定。
Android……アプリ起動直後の状態での縦横による。
・const.an.xmlConfig.window.width、〜height は、config.anprj 内のXMLに
設定した値。回転しても不変。
・const.flash.display.Stage.stageWidth、〜stageHeight はステージ、
すなわちアプリ表示領域のサイズ。
回転後に縦横を考慮し const.an.xmlConfig.window.width、〜height をセットし直す。
・const.Stage.deviceOrientation はデバイス方向現わす文字列。
const.Stage.orientation は(画像や文字を表示する)ステージの向き。
回転後にも変化。内容は以下を参照。(標準的持ち方の方向が「default」)
Stage - Adobe® Flash® Platform 用 ActionScript® 3.0 リファレンスガイド デバイスを左に回転(反時計回りに 90度)すると、
&const.Stage.deviceOrientation = "rotatedLeft"
ステージはユーザーに向くよう逆方向に(時計回りに 90度)回転するので
&const.Stage.orientation = "rotatedRight"
※以下が分かりやすい(要 Flash)
Flexponential » orientation and deviceOrientation in Flex Mobile apps ※ただし、回転すると(<fullScreen>true</fullScreen>にて)隠してた
通知バー(ステータスバー)が表示されてしまう不具合有り。
※回転はアプリケーション設定ファイルに <autoOrients>true</autoOrients>。
<前>
<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>
<後>
<autoOrients>true</autoOrients>
通知バー消去(ただし回転すると表示されてしまう不具合有り。恐らくAdobe AIRに。バグ報告投げました)
<fullScreen>true</fullScreen>