更改标题窗口关闭按钮

发布于 2024-08-06 03:53:09 字数 529 浏览 1 评论 0原文

我正在使用 Flex 3.4 SDK。

我需要更改 TitleWindow 中的默认关闭按钮图像。所以我正在做的是定义一个 CSS 选择器,如下所示:


TitleWindow{
    close-button-skin: Embed('assets/close.png');
    border-color: #FFFFFF;
    corner-radius: 10;  
    closeButtonDisabledSkin: ClassReference(null);
    closeButtonDownSkin: ClassReference(null);
    closeButtonOverSkin: ClassReference(null);
    closeButtonUpSkin: ClassReference(null);
}

问题是:结果图像完全被挤压得无法识别。可能是因为图像尺寸为 55x10 像素(比默认的关闭按钮方形尺寸宽得多),并且 flex 强制它适应该尺寸。

有人知道如何解决这个问题吗?

I'm working with Flex 3.4 SDK.

I need to change the default close button image from a TitleWindow. So what I'm doing is defining a CSS selector, like this:


TitleWindow{
    close-button-skin: Embed('assets/close.png');
    border-color: #FFFFFF;
    corner-radius: 10;  
    closeButtonDisabledSkin: ClassReference(null);
    closeButtonDownSkin: ClassReference(null);
    closeButtonOverSkin: ClassReference(null);
    closeButtonUpSkin: ClassReference(null);
}

The problem is: the result image is totally squeezed beyond recognition. Probably because the image dimensions are 55x10 pixels (much wider than the default closebutton square-like dimensions) and flex forces it to fit that size.

Would anyone know how to go about fixing that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

妥活 2024-08-13 03:53:09

似乎在 Panel 类的 createChildren() 方法中宽度和高度设置为 16 像素:

closeButton.explicitWidth = closeButton.explicitHeight = 16;

您可以尝试将explicitWidth 和explicitHeight 设置为窗口中所需的值。不要忘记将 closeButton 的范围设置为 mx_internal,并导入并使用该命名空间。

import mx.core.mx_internal;

use namespace mx_internal;

// in creationComplete for instance
mx_internal::closeButton.explicitWidth = ...;
mx_internal::closeButton.explicitHeight = ...;

It seems like the width and height are set to 16 pixels in the Panel class' createChildren() method:

closeButton.explicitWidth = closeButton.explicitHeight = 16;

You could try setting the explicitWidth and explicitHeight to the values you need in your window. Don't forget to scope closeButton to mx_internal, and import and use that namespace.

import mx.core.mx_internal;

use namespace mx_internal;

// in creationComplete for instance
mx_internal::closeButton.explicitWidth = ...;
mx_internal::closeButton.explicitHeight = ...;
奈何桥上唱咆哮 2024-08-13 03:53:09

如果你想要更简单,请执行此操作,

导入类

import mx.core.mx_internal;

将这 3 行放入creationComplete处理程序中

use namespace mx_internal;

closeButton.$width  = 24; //Change the button width to 24 pixels
closeButton.$height = 24; //Change the button height to 24 pixels

If you want it more simple, do this,

Import the class

import mx.core.mx_internal;

Put these 3 lines in creationComplete handler

use namespace mx_internal;

closeButton.$width  = 24; //Change the button width to 24 pixels
closeButton.$height = 24; //Change the button height to 24 pixels
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文