- It is set to true by default. There are a few instances where they are not virtualized, however. If you have the list sizing to fit its contents, I don't believe virtualization occurs. If I am not mistaken, virtualization only occurs when an
ItemRenderer
leaves theviewport
of the parentList
control. So if you have a list on a page and that page is controlling the scrolling and not the list, I don't believe virutalization occurs. That is what I have seen in the past. Not sure if that is how it actually works, but that is the impression I have gotten. Easy way to find out is to throw a trace statement in yourDataChange
handler. If it traces out after initialization, you know virtualization is working - I'm not sure you can control this. You may be able to write a custom layout that does it, but that is likely more trouble than it is worth
- The
TileLayout
itself is likely not the issue you are having, it is theItemRenderer
.- On mobile, do not extend any
ItemRenderer
class exceptLabelItemRenderer
andIconItemRenderer
. - Do not write a renderer in MXML. Write in AS3.
- Utilize the proper renderer life-cycle. This means you should do very little in your constructor. Maybe set a few properties, but do not instantiate any
DisplayObject
. Instead, overridecreateChildren()
and do it there. OverridelayoutContents()
for positioning and sizing. OverridedrawBackground()
for handling the background. I highly suggest reading this post from Flextras (you'll see him going by Reboog77 on SO) about writing mobile item renderers. https://www.flextras.com/blog/index.cfm/2011/6/24/Building-a-Mobile-ItemRenderer-in-Flex - Keep the renderers as simple as possible. If you can get away with drawing directly into the object using the
Graphics
class, do that instead of using aRect
or similar. - Text is slow to render. Do not change it often and keep the text seen in the renderer to a minimum
- Use
ContentCache
for any images outside of theiconDisplay
inIconItemRenderer
. ContentCache will negate the need for reloading images every single time.(iconDisplay
/icon
already utilizes this by default)
- On mobile, do not extend any
Tips to boost performance of TileLayout?
-
29-08-2022 - |
Question
I am targeting mobile using FlashBuilder, I am using TileLayout
to view items of data, I am setting useVirtualLayout
to "true"
I have some questions please:
- Is item renderer resued by default? or shall I set it to true my self?
- How can I control the range of items being virtualized?
- Is there any tips on boosting performance of building child items of
TileLayout
?
If native TileLayout
is slow, is there alternative control to use? if building my own would be better, is there any example to build custom layout?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow