Prevent Scaleform TileList from filling last row with disabled ItemListRenderer objects?

StackOverflow https://stackoverflow.com/questions/11871298

  •  25-06-2021
  •  | 
  •  

質問

I'm using Actionscript 3 and Scaleform 4.1 to command an instance of a TileList in a Flash project (CS 5.5).

I have got the TileList populating with ListItemRenderer objects (basically buttons).

In my current situation, I need rows of 4, but I need to place 15 buttons (design requirement). The TileList automatically populates the final row with 3 buttons, and one Disabled state button (instead of a blank space).

So the question:

  • Can you prevent the TileList from placing Disabled buttons (ListItemRenderer) in remainder spaces?
  • Is the TileList required to fill a grid to capacity (with Disabled buttons if necessary)?
  • Can you force a TileList to leave remainder spaces empty?

Alternate solutions also welcome, i.e. can you add another state to the ListItemRenderer such as "blank"? If so, how would you force TileList to default to that instead of Disabled?

If there is good documentation available on this, I don't mind an RTFM reply with a link, but I haven't found anything after a couple days scrounging. Thanks!

役に立ちましたか?

解決

It is certainly possible to extend or modify the TileList to suit your needs. That is why we've released CLIK's source. But to answer your question, by Default, the Tilelist is set up to use a blank/disabled renderer for empty tiles.

You can handle this without extending the tilelist, but instead the item renderer itself (much more common anyway for displaying your custom data). The 'disabled' renderer's will all get setdata(null) called on them. Thus just override setdata to toggle the visibility when that is the case:

if ( data != null )
{
    //do stuff with data 
    visible = true; 
}
else
{
    visible = false;
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top