Flex:旋转按钮和改变焦点

发布于 2024-09-16 06:44:31 字数 601 浏览 8 评论 0原文

我在 Flex 中旋转按钮时遇到问题。它们似乎污染了其他组件的焦点矩形。
获取以下源代码,这再简单不过了:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:VBox width="100%" height="100%">
        <mx:Spacer height="100" />
        <mx:Button rotation="10" />
        <mx:TextArea rotation="0" />
    </mx:VBox>
</mx:WindowedApplication>

现在执行它。单击文本区域,焦点矩形正确。按两次 Tab 键,围绕 TextArea 的焦点矩形将旋转!

有没有解决这个问题的方法,或者我应该完全避免旋转按钮?

我正在使用 Flex SDK 3.5。

谢谢,

丹尼尔

I've got a problem with rotated buttons in Flex. They seem to contaminate other components' focus rectangles.
Take the following source code, which couldn't be much simpler:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:VBox width="100%" height="100%">
        <mx:Spacer height="100" />
        <mx:Button rotation="10" />
        <mx:TextArea rotation="0" />
    </mx:VBox>
</mx:WindowedApplication>

Now execute it. Click in the text area, the focus rectangle is correct. Press tab twice, the focus rectangle aroung the TextArea is rotated!

Is there a fix for this, or should I avoid rotating buttons altogether?

I'm using Flex SDK 3.5.

Thanks,

Daniel

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

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

发布评论

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

评论(2

所有深爱都是秘密 2024-09-23 06:44:31

我最近也偶然发现了这个错误。这是建议修复的链接

然而,我想知道是否有一个更通用的解决方案,而不是扩展每个组件并覆盖调整焦点矩形。

我想出了扩展 FocusManger 并重写 focusPane 的 getter,如下所示:

override public function get focusPane():Sprite
{
    var fp:Sprite = super.focusPane;
    if (fp && fp.numChildren != 0)
        fp.getChildAt(0).rotation = 0;

    return super.focusPane;
}

并将其设置为应用程序的焦点管理器:

private function onPreinitialize():void
{
    application.focusManager = new FocusManagerEx(this);
}

这似乎有效,但如果一些专家能够告诉我是否存在我不知道的陷阱,那就太好了。

I as well recently stumbled upon this bug. Here's a link to suggested fix.

However, I was wondering if there's a more general solution rather then extending each and every component and overriding adjustFocusRect.

I came up with extending FocusManger and overriding the getter for focusPane as follows:

override public function get focusPane():Sprite
{
    var fp:Sprite = super.focusPane;
    if (fp && fp.numChildren != 0)
        fp.getChildAt(0).rotation = 0;

    return super.focusPane;
}

and set it as application's focus manager:

private function onPreinitialize():void
{
    application.focusManager = new FocusManagerEx(this);
}

This seems to work, though would be nice if some expert could tell if there aren't any pitfalls I'm not aware of.

爱要勇敢去追 2024-09-23 06:44:31

看起来像是 Flex SDK 中的一个错误。我看到下一个选项:

  • 使用 focusSkin="{null}" 禁用焦点矩形
  • 实现您自己的皮肤并正确处理旋转
  • 移动到 Spark,因为 3.5 是(当前)
    第三代的最后一个SDK
  • 尝试自己修复它(我觉得它会
    棘手...)

此外,您可能会在 Adob​​e 的跟踪器中提交错误,但它们已深入到第 4 代 Flex。

更新:3.6 nightly build 也包含此错误。

Seems like a bug in Flex SDK. I see next options:

  • disable focus rectangles with focusSkin="{null}"
  • implement your own skin and handle rotations correctly
  • move to Spark, since 3.5 is the (currently)
    last SDK of third generation
  • try to fix it yourself (I feel it will be
    tricky...)

Also, you may file a bug in Adobe's tracker, but they're deep into 4-th generation of Flex.

Update: 3.6 nightly build contains this bug, too.

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