2 Replies Latest reply on Aug 8, 2007 6:40 PM by peterent

    Keeping Children Visible Across States

    Scott McAllister Level 1
      I have series of states where each one adds a child element to the page. I would like to have each child stay visible across the various changes in states. My latest idea on how to do this is pasted below. Can anyone provide any insight where I'm going wrong in my thinking? Thanks!

      <mx:states>
      <mx:State name="generalControlPanel">
      <mx:AddChild relativeTo="{generalSpace}" position="lastChild">
      <ns1:generalCP x="2" y="0" width="1252">
      </ns1:generalCP>
      </mx:AddChild>
      <mx:SetProperty target="{treeGrid}" name="y" value="169"/>
      <mx:SetProperty target="{generalSpace}" name="height" value="108"/>
      <mx:SetProperty target="{generalSpace}" name="width" value="1264"/>
      </mx:State>

      <mx:State name="growthControlPanel">
      <mx:SetProperty target="{treeGrid}" name="y" value="169"/>
      <mx:AddChild relativeTo="{growthSpace}" position="lastChild">
      <ns1:growthCP width="1252" x="6">
      </ns1:growthCP>
      </mx:AddChild>
      <mx:SetProperty target="{growthSpace}" name="height" value="108"/>
      <mx:SetProperty target="{growthSpace}" name="width" value="1274"/>
      </mx:State>

      <mx:State name="toleranceControlPanel">
      <mx:SetProperty target="{treeGrid}" name="y" value="169"/>
      <mx:AddChild relativeTo="{toleranceSpace}" position="lastChild">
      <ns1:toleranceCP width="1252" x="6">
      </ns1:toleranceCP>
      </mx:AddChild>
      <mx:SetProperty target="{toleranceSpace}" name="height" value="108"/>
      <mx:SetProperty target="{toleranceSpace}" name="width" value="1274"/>
      </mx:State>

      <mx:State name="featuresControlPanel">
      <mx:SetProperty target="{treeGrid}" name="y" value="169"/>
      <mx:AddChild relativeTo="{featuresSpace}" position="lastChild">
      <ns1:featuresCP width="1252" x="6">
      </ns1:featuresCP>
      </mx:AddChild>
      <mx:SetProperty target="{featuresSpace}" name="height" value="108"/>
      <mx:SetProperty target="{featuresSpace}" name="width" value="1274"/>
      </mx:State>
      </mx:states>
      <mx:ApplicationControlBar x="10" y="10" width="1264" id="applicationcontrolbar1">
      <mx:LinkButton label="General" id="btnGeneral" click="currentState='generalControlPanel'"/>
      <mx:LinkButton label="Growth Characteristics" id="btnGrowth" click="currentState='growthControlPanel'" />
      <mx:LinkButton label="Tolerance of..." id="btnTolerance" click="currentState='toleranceControlPanel'" />
      <mx:LinkButton label="Ornamental Features" id="btnFeatures" click="currentState='featuresControlPanel'" />
      </mx:ApplicationControlBar>

      <mx:Canvas id="generalSpace" width="100%" height="0" y="56">

      </mx:Canvas>
      <mx:Canvas id="growthSpace" width="100%" height="0" y="56">

      </mx:Canvas>
      <mx:Canvas id="toleranceSpace" width="100%" height="0" y="56">

      </mx:Canvas>
      <mx:Canvas id="featuresSpace" width="100%" height="0" y="56">

      </mx:Canvas>