开发者

TabNavigator can't handle disabled children in Flex 4.5

开发者 https://www.devze.com 2023-03-11 16:46 出处:网络
I\'ve got a problem while migrating my TabNavigator from Flex 3 to Flex 4.5. Stripped to the bare minimum the following code will produce the bug, namely that the second child of the TabNavigator fail

I've got a problem while migrating my TabNavigator from Flex 3 to Flex 4.5. Stripped to the bare minimum the following code will produce the bug, namely that the second child of the TabNavigator fails to be created properly:

<?xml version="1.0" encoding="utf-8"?>
<s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    >
    <fx:Script>
        <![CDATA[
            protected function over():void
            {
                trace('over');
            }

            protected function content_one_init():void
            {
                content_one.enabled = true;
                navigator.selectedIndex = 1;
            }

        ]]>
    </fx:Script>
    <mx:TabNavigator
        id="navigator"
        creationPolicy="auto"
        width="100%" height="100%"
        >
        <mx:VBox
            id="content_one"
            enabled="false"
            creationComplete="content_one_init()"
            label="One"
            mouseOver="over()"
            />
        <mx:VBox label="Two">
            <mx:Label text="Content Two" />
        </mx:VBox>
    </mx:TabNavigator>
</s:Application>

What I see, upon launching, is a TabNavigator with its second tab selected but no content instead of the expected "Content Two" label. The navigator.selectedIndex = 1; instruction is there just for comfort, the bug appears also if you select the second tab with the mouse after launching.

Now comes the fun part: if I do any of the following, the second child gets created:

  • set 开发者_开发技巧creationPolicy="all" on content_one (this is expected),
  • comment content_one.enabled = true,
  • remove enabled="false" on content_one,
  • remove mouseOver="over()" from content_one (this one is really really weird, as the handler is never called anyway)

Is this really a Flex bug, or is there something I'm missing? I'm using Flex 4.5.0.20967, and all of this worked well in Flex 3.5.

Thanks.


This has been confirmed as a bug at Adobe's and filed in their bug database

0

精彩评论

暂无评论...
验证码 换一张
取 消