嘗試使用科林·穆克破解:http://www.moock.org/blog/archives/000292.html
public class SomeMaskedControl extends UIMovieClip
{
protected var mc:MaskedMC;
public function SomeMaskedControl()
{
super();
mc = new MaskedMC();
addChild(mc);
}
public function getVisibleHeight (o:DisplayObject):Number {
var bitmapDataSize:int = 2000;
var bounds:Rectangle;
var bitmapData:BitmapData = new BitmapData(bitmapDataSize, bitmapDataSize, true, 0);
bitmapData.draw(o);
bounds = bitmapData.getColorBoundsRect(0xFF000000, 0x00000000, false);
bitmapData.dispose();
return bounds.y + bounds.height;
}
override public function get height():Number
{
return getVisibleHeight(mc);
}
}
但我不喜歡這種方式。如果你將可以創建掩碼爲影片剪輯,並設置實例名稱,在應用程序,你可以得到mask.height並更換檢測UIMovieclip高度:
public class SomeMaskedControl extends UIMovieClip
{
protected var mc:MaskedMC;
public function SomeMaskedControl()
{
super();
mc = new MaskedMC();
addChild(mc);
}
override public function get height():Number
{
return mc.maskMC.height;
}
}
我想,那是因爲它是一個MovieClip,如果你什麼導出爲SWF,而不是的SWC,也許這可能工作? – Neil 2013-02-27 17:00:09
您可能需要覆蓋該MovieClip的height屬性,並從遮罩對象的邊界與遮罩邊界的交點返回高度。 – Marcela 2013-02-27 18:12:29
嘗試下面的掩碼= 0和movieclip的頂部=「{mask.x}」 – Smolniy 2013-02-27 18:14:34