-
button.addEventListener(MouseEvent.MOUSE_DOWN, buttonPress);
-
button.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
-
button.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
-
button.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
-
function buttonPress(e:MouseEvent):void {
-
//the button is pressed, set a MOUSE_UP event on the button's parent stage
-
//to caputre the onReleaseOutside event.
-
button.parent.stage.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
-
}
-
function buttonRelease(e:MouseEvent):void {
-
//remove the parent stage event listener
-
button.parent.stage.removeEventListener(MouseEvent.MOUSE_UP, buttonRelease);
-
//if the events currentTarget doesn't equal the button we
-
//know the mouse was released outside.
-
if (e.currentTarget != button) {
-
trace('onReleasedOutside');
-
} else {
-
//the events currentTarget property equals the button instance therefore
-
//the mouse was released over the button.
-
trace('onRelease');
-
}
-
}
-
function buttonOver(e:MouseEvent):void {
-
if (e.buttonDown) {
-
//if the mouse button is selected when the cursor is
-
//over our button trigger the onDragOver functionality
-
trace('onDragOver');
-
} else {
-
//if the mouse button isn't selected trigger the standard
-
//onRollOver functionality
-
trace('onRollOver');
-
}
-
}
-
function buttonOut(e:MouseEvent):void {
-
if (e.buttonDown) {
-
//if the mouse button is selected when the cursor is
-
//moves off of our button trigger the onDragOut functionality
-
trace('onDragOut');
-
} else {
-
//if the mouse button isn't selected trigger the standard
-
//onRollOut functionality
-
trace('onRollOut');
-
}
-
}
Tags: AS3
FlexSDK3.2以前では大きな画像をImageコンポーネントに表示すると縮小時にスムージングが行われず、輪郭や文字等がジャギジャギに劣化する。
スムージングができないか調べていたらFlexSDK3.4以降??か定かではないんですが、smoothBitmapContentプロパティなるものが増えていて、このプロパティ値をtrueに設定するとスムージングするらしい。実際やってみましたが、autoLoadプロパティtrueで何度もurlプロパティ設定すると、スムージングが効かなくなる。。。
以下のページを参考に、Imageクラスを継承したSmoothImageクラスを作成して利用したところ、無事スムージングするようになりました。
- Smooth Image(Adobe Developer Connection)
- SmoothImage(GoogleCode)
追記:以下のような書き方でもOKみたい。
-
private function image3LoadCompleteHandler(e:Event):void
-
{
-
var bmp:Bitmap = image3.content as Bitmap;
-
if (bmp) {
-
bmp.smoothing = true;
-
}
-
}
-
-
-
<mx:Image id="image3" source="./images/Sample2.jpg" x="840" y="80" smoothBitmapContent="true" width="255" height="360" complete="image3LoadCompleteHandler(event);"/>
吉岡さんの以下のPDFはとても参考になります。
http://ciruelo.jp/doc/yoshioka_report0124.pdf
ヒムカンパニーの永井さんの以下のブログはAIR for Androidの情報満載です。
http://himco.jp/air-for-android/
Tags: AIR, AIR for Android, Android
以下の設定で自動スケールを止めて、stage.stageWidthとstage.stageHeightで表示可能サイズを取得できるようです。
-
stage.scaleMode = StageScaleMode.NO_SCALE;
-
stage.align = StageAlign.TOP_LEFT;
-
trace("表示サイズ 幅:" + stage.stageWidth + "/高さ:" + stage.stageHeight);
この表示サイズの数値を使って、AS内で表示サイズの処理を自分で実装すれば、どの解像度の端末でもリキッドレイアウトできれいに表示するアプリが開発できるはず。。。
Tags: AIR, AIR for Android, Android, GalaxyTab
FlashコンテンツとJSコンテンツでエンコード文字列を共有する場合、
<Flash(AS2)>
エンコード:escapeメソッド
デコード:unescapeメソッド
<Javascript>
エンコード:encodeURIComponentメソッド
デコード:decodeURIComponentメソッド
Tags: flash, javascript
同僚から教えてもらったTips
■リンクやテキストボックスをタップしたときにまわりがオレンジ色になる。
alpha を 0 にすることで消すことはできた
#hoge1 {
-webkit-tap-highlight-color:rgba(0,0,0,0);
}
Tags: Android

http://www.chizuyado.com