Flex 3尝试将对角线图像添加到网格上的字段中



这里是现有的代码块:

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

我想用平铺的背景图像替换背景颜色。

我知道"图形"只能填充或绘制。我理解上面代码中的"图形"部分。需要更改为其他内容,但我不知道如何调用以下图像:background-image: Embed("images/bg-uneditableField.jpg");

我到处找都没找到。我是一名前端开发人员,刚刚进入Flex3环境,并不是一个强javascript/.as的人。

注意:我们的应用程序需要停留在Flex 3中,此时不能进行升级。

提前感谢您的帮助。

要获取背景图像,可以使用以下代码:

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

然后您可以实例化这个类并填充它(请参阅文档):

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

执行填充(参见文档):

graphics. beginBitmapFill(bitmapData);
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();

最新更新