tags:

views:

21

answers:

1

im new to flex, so naturally I would just create a dynamic sprite using the drawing api and put it behind the text... but my app is really buggy using the rawChildren to addChild.

So is there a better way to have a bg for a piece of text though actionscript? like modifying an existing component?

A: 

I would place the text inside a canvas, and then apply a custom borderSkin to the canvas it's inside. ie:

css:

.textBubbleBackground{
    borderSkin: Embed(source="img/textBubble.png",
                            scaleGridTop="10", scaleGridBottom="100",
                            scaleGridLeft="10", scaleGridRight="150");
}

mxml:

<mx:Canvas styleName="textBubbleBackground">
    <mx:Text text="my text" />
</mx:Canvas>

Obviously that's a bit over simplified and you'll need to apply the proper 9 grid scaling to the background image (or I'd draw it programatically using degrafa, but that's a bit more complicated to explain)

quoo
oh, that's for flex 3 - might be slightly different w/ flex 4.
quoo
let me try it, im using flex3
Adam