tags:

views:

50

answers:

1

Hi,

I have flexlib WindowShade component in repeater in my Flex + AIR application.

<mx:XML id="mainMenuXML">
    <items>
        <item value="abc" />
        <item value="xyz" />
        <item value="lmn" />
    </items>
</mx:XML>

<mx:VBox width="100%" height="100%">
        <mx:Button label="Button" click="button1_clickHandler(event)"/>
    <mx:Repeater id="rep" dataProvider="{mainMenuXML.item}">
        <flexlib:WindowShade label="{rep.currentItem.@value}" width="50%" opened="{rep.currentItem.@open}">
            <mx:Label text="xxxxxxxxxx" />
        </flexlib:WindowShade>
    </mx:Repeater>
</mx:VBox>

Now in button1 click handler I am appending child in XML(mainMenuXML) resulting adding one more windowshade instance. But the problem is it opens all the windowshade intances.

I need to maintain the opened states after adding a new windowshade instance. For example: Initially I get 3 windoshades with labels: abc, xyz, lmn all opened. Now I close the xyz windowshade instance(by clicking on the header) Now I click on button which appends child in mainMenuXML and also add a windowshade instance with some label "pqr". But now I see all the windowshade instances opened. But it should be like abc, lmn, pqr should be opened & xyz closed(property opened="false").

Please help me in maintaining the opened true/false state of windowshade instances.

I tried to add a property in dataprovider Bindable to opened property of windhowshade but didn't worked for me.

Thanks in advance

A: 

If you want the opened value to be persisted, you'll need to change the underlying dataprovider. So you are pretty much correct with that. If I remember the WindowShade component correctly, it didn't dispatch events when it opened and closed, so you may need to extend the component to add this. I doubt binding will work as you've got a circular dependency between the two values.

Gregor Kiddie