StablexUI icon indicating copy to clipboard operation
StablexUI copied to clipboard

Button widget, ico property, unable to read from BitmapData

Open borabilgin opened this issue 11 years ago • 1 comments

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.

borabilgin avatar Jan 08 '14 18:01 borabilgin

Try this:

var button = UIBuilder.create(Button, {
    ico : { 
        bitmapData : Assets.getBitmapData("assets/pic.jpg") 
    },
    text     : "Test",
    widthPt  : 100,
    height   : 30,
    defaults : 'Default,Settings'
});

RealyUniqueName avatar Jan 10 '14 09:01 RealyUniqueName