StablexUI
StablexUI copied to clipboard
Button widget, ico property, unable to read from BitmapData
Hello,
I'm trying to create a button widget with an icon. I have the following code:
var icoBmp:Bmp = new Bmp(); icoBmp.bitmapData = Assets.getBitmapData("assets/pic.jpg", false);
var btn = UIBuilder.create(Button, {
text: "Test",
widthPt: 100,
ico: icoBmp,
height: 30,
defaults: 'Default,Settings'
});
I'm expecting the button icon to load from icoBmp, which essentially loads its BitmapData from an image located in the assets folder. However, the button icon is always empty.
When I set the icoBmp.src property (instead of bitmapData), the button loads an icon. Is there any way to achieve the same functionality by using BitmapData instead (since I'm doing some image processing, my image data will come as a BitmapData object)
Thanks.
Try this:
var button = UIBuilder.create(Button, {
ico : {
bitmapData : Assets.getBitmapData("assets/pic.jpg")
},
text : "Test",
widthPt : 100,
height : 30,
defaults : 'Default,Settings'
});