2012-10-05 48 views
0

我有一個動態創建的影片剪輯,它包含一個文本字段。中心對齊旋轉的影片剪輯

然後將移動夾旋轉20度。

然後我想把剪輯放在舞臺上。但寬度和高度讀數,以及定位x和y使它位於錯誤的位置,我猜是由於註冊點。

有沒有解決這個問題的方法?

這是flash 8as2

回答

0

中心對齊文本字段,影片剪輯。如果你是動態設置文本和文本字段自動調整大小,記得要重新申請文本字段的中心對齊:

//Assuming mc is your MovieClip instance and tf is the child TextField instance 
var tf = mc.tf; 

//Reading the width and height of the TextField will remain accurate and unchanged by it's parent's rotation as it's rotation remains zero. 
tf._x = -(tf._width/2); 
tf._y = -(tf._height/2); 

如果保持影片剪輯在舞臺的中心,文本領域似乎也將保持中心。無論電影剪輯的旋轉如何。

+0

甜的中間!這很可愛! – Dave

0

代碼,以使具有reg點MC在中間

var mc:movieclip = new movieclip 
mc.graphics.beginFill(0x000000,0); 
mc.graphics.drawRect(-1,-1,2,2); 
mc.graphics.endFill(); 

代碼把這個中心REG點MC在舞臺

mc.x = stage.stageWidth/2; 
mc.y = stage.stageHeight/2;