开发者

As3 movie clip resize

开发者 https://www.devze.com 2023-01-14 04:33 出处:网络
Ok so I have 3 movie clips that are setup in rows. I need these movie clips to be positioned in a certain position and each of the elements in side of them in another position. Now in order to do that

Ok so I have 3 movie clips that are setup in rows. I need these movie clips to be positioned in a certain position and each of the elements in side of them in another position. Now in order to do that I have to set the width so that I can put the rows where I need them开发者_开发知识库 however after setting the width and then adding a child to it seems to be resizing the row so that it is no longer the width that I set it. Is there any way around this or am I missing something? Any help is appreciated.


You could set the row positions with fixed values or you could use a variable whose value will be set when you first check for a movieclip width , that is before the movieclip is being resized.

//assuming you're working with three base movie clips , mc1 , mc2 & mc3
//and element movie clips to add inside them
var rowWidth:int;

if( rowWidth == 0 )
  rowWidth = mc1.width;

mc1.addChild(element);

//then you can place your other movie clips
mc2.x = rowWidth;
mc3.x = rowWidth * 2;

//if the row widths are not equal , you will need to create two rowWidth variables
var rowWidth1:int;
var rowWidth2:int;

if( rowWidth1 == 0 )
  rowWidth1 = mc1.width;

if( rowWidth2 == 0 )
  rowWidth2 = mc2.width;

mc1.addChild(element1 );
mc2.addChild(elementN );

mc2.x = rowWidth1;
mc3.x = rowWidth2;

0

精彩评论

暂无评论...
验证码 换一张
取 消