Flashを紡ぐ

Flash。フラッシュ。今さら人に聞けないActionScript。
<< November 2008 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 >>

Flash の中央寄せ −その2−

 
Flash の中央寄せ−その1− に動きをつける。

--------------------------------------
HTML側の設定
--------------------------------------
width="100%" height="100%"

<param name="scale" value="noScale" />
<param name="salign" value="TL" />

scale="noScale" salign="TL"


(Firefox の場合、さらに)
<style type="text/css">
<!--
html,body { height: 100%; }
//-->
</style>


--------------------------------------
test_mcの基準点がtest_mcの中央にある場合
--------------------------------------
※test_mcに設定する。
//設定
onClipEvent(load){
Stage.scaleMode = "noScale";
Stage.align = "TL";
//中央へ寄るスピード
var speed = 5;
}
//画面のサイズが変更になった時に中央に寄る
onClipEvent(enterFrame){
var myX =Math.floor( Stage.width/2);
var myY =Math.floor(Stage.height/2);
this._x += (myX-this._x)/speed;
this._y += (myY-this._y)/speed;
}

------------------------------------------
test_mcの基準点がtest_mcの左上原点にある場合
------------------------------------------
※test_mcに設定する。
//設定
onClipEvent(load){
Stage.scaleMode = "noScale";
Stage.align = "TL";
//中央へ寄るスピード
var speed = 5;
}
//画面のサイズが変更になった時に中央に寄る
onClipEvent(enterFrame){
var myX =Math.floor( (Stage.width-this._width)/2);
var myY =Math.floor( (Stage.height-this._height)/2);
this._x += (myX-this._x)/speed;
this._y += (myY-this._y)/speed;
}










--------------------------
Flash制作/F (f-sphere)
http://www.f-sphere.com/
Flash ActionScript2.0 | permalink | comments(0) | trackbacks(0)
ARCHIVES
PROFILE
OTHERS