1

here is the existing chunk of code:

if (status != FlexFieldInfo.EDITABLE) {
            setToolTip(uiComponent, status, entityForm);
            graphics.beginFill(0xFFABC0);
            graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
            graphics.endFill();

i would like to replace the background color with a tiling background-image.

i understand that "graphics." can only fill or draw. i understand the chunk of "graphics." in the code above needs to change to something else, but i am at a loss of how to call the following image: background-image: Embed("images/bg-uneditableField.jpg");

I have searched high and low unsuccessfully. I am a front-end developer just stepping in to our Flex 3 environment and am not a strong javascript/.as person.

Note: our application needs to stay in Flex 3, upgrading is not an option at this time.

Thank you in advance for your help.

Sergey K.
  • 24,894
  • 13
  • 106
  • 174
Caroline
  • 11
  • 1

1 Answers1

1

To get your background image you can use the following code:

var backgroundClass:Class = getStyle("backgroundImage");

Then you can instantiate this class and fill with it (see documentation):

var bitmapAsset:BitmapAsset = new backgroundClass();
var bitmapData:BitmapData = bitmapAsset.bitmapData;

The perform filling (see documentation):

graphics. beginBitmapFill(bitmapData);
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
Constantiner
  • 14,231
  • 4
  • 27
  • 34
  • thank you for this... i'm trying to make it work. i'll let you know when i finally figure it out. i'm just learning how flex3 works and imports and everything else. i'm struggling, but i'm trying to get a successful build. – Caroline Jun 08 '11 at 20:44