Hi,

Here is my problem.

I want to make a list with items that expand/collapse when they are
clicked. Everything works until the scrollbar appears.
If i have 5 items.
i click the first that expands. i scroll the list to the last item
that was hidden to see that it is expanded !!! when i scroll up to the
first item, it is collapsed !!!!! And the seconds items seems to be
connected with the fourth...Hope, i am clear.

Here is the code:

<mx:List id="dialturns"
        width="450"
        height="200"
        variableRowHeight="true"
        dataProvider="{dp}"
        itemRenderer="DialTurnRenderer"
/>

the renderer is

<mx:Canvas 
        xmlns:mx="http://www.adobe.com/2006/mxml";
        currentState="{activeState}">
        <mx:Script>
                <![CDATA[
                        
                import flash.events.Event;
                
                [Bindable]
                public var question:String;
                        
                [Bindable]
                public var response:String;
                        
                [Bindable]
                public var activeState:String="";
                        
                
        override public function set data( value:Object ):void
        {

                super.data = value;
                
                this.question = value.question;
                this.response = value.response;
        }
                
        private function switchDisplay( event:Event ):void
        {
        activeState = ( activeState == "expandedState" ) ? "" :
"expandedState";
        }               
                ]]>
        </mx:Script>
        
        <mx:LinkButton x="0" y="0" label="{question}"
click="switchDisplay(event)" />
        
      <mx:states>
        <mx:State name="expandedState">
          <mx:AddChild>
           <mx:Text x="0" y="24" id="txtResponse" text="{response}" />
          </mx:AddChild>
          <mx:SetProperty name="height" value="120" />
        </mx:State>
      </mx:states>
        
</mx:Canvas>

The code is very common...the result less.

Have u got an idea? Feel free to redirect me.

Thanks in advance

Reply via email to