1 Reply Latest reply on Jan 13, 2010 1:02 AM by Juanjo-kun

    Changing LinkButton property inside LinkBar with states


      Hi, greetings to everyone


      I have a LinkBar with 4 buttons. I want to create a state that modifies the "enabled" property of the second and third button of the LinkBar. I've tried little variations of this code, but it disables the whole screen instead of the LinkButtons, because target appears to be null!


      <!--This LinkBar ends having 4 buttons-->
      <mx:LinkBar id="messageOptions" dataProvider="{RMMessages.getInstance().messageOptionsList}"/>
           <mx:State name="noMessagesState">
                <mx:SetProperty id="prop1" target="{LinkButton(messageOptions.getChildAt(2))}"
                     name="enabled" value="false"/>
                <mx:SetProperty id="prop2" target="{LinkButton(messageOptions.getChildAt(3))}"
                     name="enabled" value="false"/>



      The problem seems to be that is not a single reference to the button but a reference through a method and casting. I have a workaround that implies to create 4 private LinkButton variables, and in the init event of the container poblate them with the buttons of the LinkBar.


      Is there a way to do this less ugly?


      Thanks in advance!