3 Replies Latest reply on May 14, 2013 11:25 AM by UbuntuPenguin

    Air Mobile List Custom Layout

    UbuntuPenguin Level 4

      Hello Everyone,

        I am working with Adobe Air and I am making a mobile app.  I want a custom list layout so I thought I would try some examples I found on the web.  Unfortunately, most of these examples choke.  They generally have code in the updateDisplayList call that resembles this.

       

      override public function updateDisplayList( width:Number, height:Number ):void

      {

           super.updateDisplayList( width, height );

           ....

           var layoutTarget:GroupBase = target;

           ....

           for( var i:int =  0 ; i < layoutTarget.numElements; i++ )

           {

                element = layoutTarget.getElementAt( i ) as IVisualElement;

                CRASHES HERE --> element.setLayoutBoundsSize( NaN , NaN );

                element.setLayoutBoundsPosition( xpos , ypos );

           }

      }

       

      The issue I have found is that even though "layoutTarget.numElements" = 1, layoutTarget.getElementAt( i ) returns null, even when I don't cast it to anything. 

       

       

      I've investigated looking at the TileLayout and VerticalLayout code, but I'm not quite sure I can even devise what is going on in there; they don't appear to be doing the stuff I am accustomed to seeing in the updateDIsplayList call.

       

       

      Any help is greatly appreciated.