开发者

Flex resize image inside updateDisplayList

开发者 https://www.devze.com 2023-03-15 14:01 出处:网络
I have a custom component开发者_开发问答 which is an HBox & I\'m trying to resize a child which happens to be an image. This is image is inside a VBox which is also a child of the HBox. I have a n

I have a custom component开发者_开发问答 which is an HBox & I'm trying to resize a child which happens to be an image. This is image is inside a VBox which is also a child of the HBox. I have a number of these images so In UpdateDisplayList I call:

myimageArray[0-5].setActualSize(50,50);

but the image is never resized it just stays a large default size. The images source is a url path and I'm wondering if that is what is causing the problem?


You should call setActualSize() for each array item manually:

for each (var uiComponent:UIComponent in myimageArray)
{
    uiComponent.setActualSize(50,50);
}

Or, if you need to resize only first 6 elements:

for (var i:int = 0; i < Math.min(6, myimageArray.length); i++)
{
    myimageArray[i].setActualSize(50,50);
}
0

精彩评论

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