01 April 2009

Place Movie Clip On Specific Area

I have one movieclip or MC, and I want to have it on top of the page. Maybe it would be so easy to do so. You just make an movie clip in flash lite, and then put it whit align help panel to set it right in the center area.

Done.

But how if you dont know the size of mobile screen size. It has different size, from 240*320, 176*208, 352*416, and so on. First, you need to get information about size. You can use Stage.width; (get width) and Stage.height; (to get its height). So for example, you make stageWidth_txt text with variable name : stageWidth_txt. Then in first frame you type :

onEnterFrame = function()
{
stageWidth_txt.text = Stage.width;
}

Then it will tell the width of the screen size.

With this information, when you make a movie clip with name : box_mc, you can set it to get middle and top of screen with :

onEnterFrame = function()
{
setProperty( "box_mc", _y, 0 );
setProperty( "box_mc", _x, (Stage.width/2) );

}




PPL IAIN Syekh Nurjati Cirebon

Jika ditanya apa yang kau suka dari kehadiran mereka? Mereka punya jawabannya : semangat yang tinggi dengan keingintahuan yang tipikal mahas...