I have a custom component that needs to be able to paint a label on its graphics context without adding a subcomponent for it. I figured out a way to do it, but it seems like a hack. Does anybody know a better way? Here is the code.
// Create an auto-sized text field. var label:IUITextField = new UITextField(); label.autoSize = TextFieldAutoSize.LEFT; label.text = "String I want to render"; // Draw the text into a bitmap. var bm:BitmapData = new BitmapData(label.width, label.height); bm.draw(label); // Draw bitmap on the graphics of the component. comp.graphics.beginBitmapFill(bm, null, false); comp.graphics.drawRect(0, 0, bm.width, bm.height); comp.graphics.endFill(); Any ideas? Thanks, Derek
