flash : MC & MC as BG are in the center center (liquid layout 2)

MC & MC as BG are in the center center, liquid layout 2 :ทำให้ flash เราอยู่ตรงกลางหน้า พร้อม bg เคลื่อนไหวได้

งงไหม คือ จะบอกว่า how to นี้จะสอนทำให้...
ตัวเนื้อหาเรา จะอยู่ตรงกลาง browser ตลอด ไม่ว่าจะ resize browser เท่าไหร่ก็ตาม
และ ด้านหลังของเนื้อหา จะเป็น movie clip เคลื่อนไหวได้ และ resize ได้ ... ว้าว วู้ เริ่ด !!!

ก่อนเริ่ม ถ้าใครยังไม่อ่าน howto เก่า ไปอ่านมาก่อนนะ เดี๋ยวจะงง

ไปอ่านทู้เก่าก่อนนะคะ ที่ >> ทู้เก่า flash เต็ม browser

STEP

1) ก่อนอื่นก็โหลด file ตัวอย่างไปก่อน >> เว็บ Mediafire นะ

2) เปิด center.fla มา ก็แงะดูเลย / ดูที่ Library จะมี MC 2 ตัว : (1) ตัวเนื้อหา ชื่อ "noscale_mc" และ (2) ตัว bg ชื่อ "scale_mc" / *** จำไว้ว่า ตอนทำ new symbol เป็น mc ให้เลือก จุดสี่เหลี่ยมดำ ให้อยู่ตรงกลางเสมอ

3) พอทำเสร็จแล้วก็ click ขวา ที่แต่ละ mc เลือก "Linkage" / ติ๊กเลือก "Export for action script" กะ "Export in the first frame" / ใส่ "Identifier" เป็นชื่อ (1) "noscale_mc" ให้เนื้อหา และ "scale_mc" ให้ BG

4) ** อย่าลืมตั้งชื่อ mc ที่ properties ด้วยนะจ๊ะ
noscale_mc คือ เนื้อหา
scale_mc คือ BG

5) เอา code นี้ไปวางที่ stage และ ใส่ action script ที่ frame แรก

**************************************************

function stageResize() {
scale_mc._width = Stage.width;
scale_mc._height = Stage.height;
}
function center() {
noscale_mc._y = Stage.height/2;
noscale_mc._x = Stage.width/2;
scale_mc._y = Stage.height/2;
scale_mc._x = Stage.width/2;

}
Stage.scaleMode = "noScale";
myListener = new Object();
myListener.onResize = function() {
stageResize();
center();
};
Stage.addListener(myListener);

**************************************************

6) ตั้ง Publish setting เหมือนทู้เก่า คือ...

:: HTML tab ::
- Dimensions :: Percent >> width x height: 100x 100 percent
- Flash Alignment :: Left Top

เท่านี้แหล่ะจ้า

ขอบคุณความรู้จากทู้ >> Webmasterworld