Skip navigation
Currently Being Moderated

Air Mobile List Custom Layout

May 13, 2013 5:19 PM

Tags: #flex-mobile #layout #list #air3

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.

  • Currently Being Moderated
    May 13, 2013 8:56 PM   in reply to UbuntuPenguin

    The code shows an “as IVisualElement”.  If the elements is not an IVisualElement then element will be assigned null.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points