Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TabNavigator can't handle disabled children in Flex 4.5

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.

like image 984
Daniel Kitachewsky Avatar asked Jun 08 '11 12:06

Daniel Kitachewsky


1 Answers

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

like image 68
Daniel Kitachewsky Avatar answered Nov 15 '22 21:11

Daniel Kitachewsky