2010-09-03 124 views
0

好吧,我有3個影片剪輯設置在行中。我需要將這些影片剪輯放置在某個位置,並將其中每個元素放置在另一個位置。現在爲了做到這一點,我必須設置寬度,以便我可以將行放在需要它們的位置,但是在設置寬度後添加一個子對象似乎在調整行的大小,以致它不再是寬度我設定了它。有沒有辦法解決這個問題,或者我錯過了什麼?任何幫助表示讚賞。As3影片剪輯調整大小

回答

3

您可以使用固定值設置行位置,或者您可以使用首次檢查動畫片段寬度時(即動畫片段大小調整前)設置值的變量。

 
//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;