2 Replies Latest reply on Sep 1, 2009 3:02 AM by Andrew Rosewarn

    question about ViewStack




      How can i get a pointer(or the id) of the element which is being showing in a ViewStack?

        • 1. Re: question about ViewStack
          Andrew Rosewarn Level 3

          This will return the object that is displayed.


          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
                      import mx.controls.Alert;
                      private function showObject():void {
              <mx:ViewStack x="574" y="222" id="viewstack1" width="200" height="200">
                  <mx:Canvas id="one" label="View 1" width="100%" height="100%">
                  <mx:Canvas id="two" label="View 2" width="100%" height="100%">
              <mx:ToggleButtonBar x="574" y="178" dataProvider="viewstack1">
              <mx:Button x="574" y="450" label="Button" click="showObject()"/>

          • 2. Re: question about ViewStack
            Barna Biro Level 3



            The ViewStack has a property called selectedChild wich will return a reference to the currently selected/visible component. Or you could use selectedIndex to check the index and then with getChildAt get the corresponding component ( there are quite a few ways but selectedChild should be the most straight forward solution ).


            With kind regards,

            Barna Biro


            EDIT: Sorry, it's called selectedChild not selectedItem.