1 Reply Latest reply on Oct 27, 2010 11:28 PM by Devtron

    Coverflow hide children ?

    Devtron Level 3

      Hello


      I am using a coverflow, which has 26 panels inside of it. I set all 26 panels to visible=false, yet they still display.

       

      I have looked at the "extended" code, and see where visibilty gets set, but if I change it, it does not affect the coverflow control. All 26 panels still display.

       

      Does anyone have any experience with children controls in a coverflow and setting their visibility?

       

      Any help is appreciated. This is such a cool control, so I am hoping I can get it to behave correctly

        • 1. Re: Coverflow hide children ?
          Devtron Level 3

          ok, I found a few interesting things with coverwheel control...

           

          I was able to change the visibility in the main extended class, where it displays children. that did work, but I was getting some really crazy behaviour if I used all 26 panels. Like some panels would get stuck at the top, while others disappeared and would not reappear until you click in the missing area. It was bizarre.

           

          Anyways, I got real frustrated and realized I could just move all 26 panels to a different container, so they would reside elsewhere. I removed them from layout (includeinlayout=false) and was able to reference them and add them to the coverwheel that way.

           

          Doing that made it work much better, pretty much flawless now. In the coverwheel example, in the source code I downloaded from doug mccune, it had panels defined INSIDE the coverflow control. I could not set those to visible=false, without altering the extended code classes, so I simply moved the contained panels to a different container.

           

          In doing some of this, I ran into a problem where you cannot find nested container children. Children references only go one level deep (as far as I understand, I could be wrong), but I had a hell of a time setting the values and properties of the UI controls inside my 26 panels.

           

          Here is a function I found and altered to get all children inside a container (this is pretty slick):

           

                      private function getChildByNameRecursive(name:String, container:DisplayObjectContainer):Object
                      {
                         
                          var child:Object = container.getChildByName(name);
                          if (child)
                              return child as Object;
                         
                          for (var i:uint=0; i < container.numChildren; i++) {
                             
                              if (container.getChildAt(i) is DisplayObjectContainer)
                              {
                                 
                                  child = getChildByNameRecursive(name, container.getChildAt(i) as DisplayObjectContainer);
                                  if (child)
                                      return child as Object;
                              }
                             
                          }
                         
                          return child as Object;
                         
                      }

           

           

           

          Using this I was able to get to the UI controls embedded deep inside the panels, inside the coverflow control, and set their values (amongst other things).

           

          coverflow.png

           

           

          This has eliminated my need for using the Tab Navigator control, which sucks to work with by the way. This 3D coverflow is much nicer and really impressed everyone Ive shown I just thought I would share my solution, in case somebody one day could use some of it. Cheers.