2010
01.26

So Flex 4 is in Beta and we should accept that quirks will occure but this one is driving me a little loopy to the point of even cursing my friend Flex.

The day started like any other until I noticed this unnecessary gap between each of my vertically stacked list’s using the TileLayout, yes it is very possible to take the approach of creating my own layout (that’s why the new Flex 4 Framework is so good) though I opted for looking for a property that might remove this, disaster! disaster! nothing works so next step is to extend tile list and look for this weird occurance.

Best I could do (though not completly happy with) is override the measure() and change the explicit height of the component as it seems explicit height is forcing the constant height.

Hopefully this helps somebody out or even better can direct me to a better fix

package com.skysongs.mediaplayer.view.layouts
{
	import mx.core.ILayoutElement;
 
	import spark.components.supportClasses.GroupBase;
	import spark.layouts.TileLayout;
 
	public class MusicTileLayout extends TileLayout
	{
		/**
		 * Constructor
		 * */
		public function MusicTileLayout()
		{
			super( );
		}
 
		/**
		 * Measure
		 * @inheritDoc
		 */
		override public function measure():void
		{
			var layoutTarget:GroupBase = target;
			layoutTarget.explicitHeight = Math.ceil(rowCount * (rowHeight + verticalGap) - verticalGap);
			super.measure( );
		}
	}
}

Please hurry up Adobe, I want the final release now…

ADDED!!! in case the measure property is not called when resizing is done you can override updateDisplayList and call the measure() function.

/**
		 * Update Display List
		 * @inheritDoc
		 * */
		override public function updateDisplayList(width:Number, height:Number) : void
		{
			super.updateDisplayList( width, height );
 
			/* Force remeasure */
			measure();
		}

Again I would not recommend this as a final solution (will most likely be fixed in an upcoming version of the SDK)

ps.. Logged an issue with Adobe (http://forums.adobe.com/thread/565055)

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Blogplay

5 comments so far

Add Your Comment
  1. Hey Tyrone,
    I’m not sure what the problem is, could you please post a sample app that illustrates the issue? I think that the TileLayout’s horizontalGap and verticalGap properties default to “6″, so maybe you need to set them explicitly to “0″?

    -Evtim

    Like or Dislike: Thumb up 0 Thumb down 0

  2. Hi Evtim

    The problem was not with the VerticalGap between rows, this problem is when you have multiple Lists stacked on top of each other using the TileLayout, When resizing the Application each List seems to have extra space at the bottom (for some reason), I can revert my changes on my current application and show you what I mean?

    Like or Dislike: Thumb up 0 Thumb down 0

  3. As an update to all this, it appears this is a Scroller bug and can be found here http://bugs.adobe.com/jira/browse/SDK-25495, guessing it should be fixed very soon :)

    Like or Dislike: Thumb up 0 Thumb down 0

  4. Thanks for the solution to this problem Tyrone. Works perfectly.

    Like or Dislike: Thumb up 0 Thumb down 0

  5. Thanks this is very useful, saved me a lot of pain trying to figure out why my tile list had an extra row. It seems fine when your number of items is a square number… apparently not a bug though. Seriously Adobe…. :p

    Like or Dislike: Thumb up 0 Thumb down 0