![](/img/trans.png)
[英]Creating MovieClip 'components' that don't add to file size in Flash AS2/AS3
[英]Evenly distribute components relatively their size
假設有一個HGroup
,寬度為100px,其中有兩個圖像: image_1
為20px, image_2
為30px。
我希望image_1
位於前40個像素(從像素11到30)的中心,而image_2
位於其余60像素(從像素56到85)的中心,因為它們將整個100像素寬的空間相對於它們的大小進行了划分。
Spark中是否有允許執行此操作的組件或屬性?
也許我錯了,但是沒有任何方法可以做到這一點。 已經為該示例創建了實例名稱:
// container width = 100
var C:HGroupContainer = new HGroupContainer();
this.addChild(C);
const W1:int = 40;
const W2:int = 60;
var r1:Rect1 = new Rect1();
r1.x = (W1 - r1.width) / 2;
this.addChild(r1);
var r2:Rect2 = new Rect2();
r2.x = W1 + (W2 - r2.width) / 2;
this.addChild(r2);
坐標x = 0,y = 0對應於圖像的左上角。
您必須將圖像包裝在HGroups中,然后將水平對齊方式設置為居中。 這就是Flex的方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.