2 Replies Latest reply on Sep 6, 2011 10:44 PM by wypcy

    大家帮忙看看那这是不是flex4 tree的一个bug,要怎么解决???

    wypcy

      做了一个tree的例子,代码是直接从tour de flex 中直接复制出来的(在tour de flex也存在同样的问题),用sdk4.0 跑起来的时候,出现item不能选中的问题(sdk3.5上没有该问题)。界面加载完成后(注意:一定要在界面一加载完成的时候,在进行下边操作前不要进行其他的操作,否则就看不到效果了) 做如下操作:
      1、选中“Outbox”;
      2、展开“Inbox”;
      3、点击“Inbox”下的“Marketing”,此时“Marketing”不能被选中
      源代码如下:

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top"

                      horizontalAlign="center" paddingTop="0" viewSourceURL="srcview/index.html">

       

          <mx:Script>

              <![CDATA[

       

                  [Bindable]

                  public var selectedNode:XML;

       

                  // Event handler for the Tree control change event.

                  public function treeChanged(event:Event):void {

                      selectedNode=Tree(event.target).selectedItem as XML;

                  }

              ]]>

          </mx:Script>

       

          <mx:XMLList id="treeData">

              <node label="Mail Box">

                  <node label="Inbox">

                      <node label="Marketing"/>

                      <node label="Product Management"/>

                      <node label="Personal"/>

                  </node>

                  <node label="Outbox">

                      <node label="Professional"/>

                      <node label="Personal"/>

                  </node>

                  <node label="Spam"/>

                  <node label="Sent"/>

              </node>  

          </mx:XMLList>

       

          <mx:Panel title="Tree Control" layout="vertical" color="0xffffff" borderAlpha="0.15" width="500"

                    paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center">

       

              <mx:Label width="100%" color="0x323232"

                        text="Select a node in the Tree control."/>

       

              <mx:HDividedBox width="100%" height="100%" color="0x323232">

                  <mx:Tree id="myTree" width="50%" height="100%" labelField="@label"

                           showRoot="false" dataProvider="{treeData}" change="treeChanged(event)"/>

                  <mx:TextArea height="100%" width="50%"

                               text="Selected Item: {selectedNode.@label}"/>

              </mx:HDividedBox>

       

          </mx:Panel>

      </mx:Application>