Tuesday, June 12, 2007

Exception after TileList resize

Does this exception look familiar to you:

TypeError: Error #1010: A term is undefined and has no properties. at mx.controls.listClasses::TileBase/mx.controls.listClasses:TileBase::scrollVertically() at mx.controls.listClasses::ListBase/set verticalScrollPosition() at AssetViewerListStandardThumbnails/::OnPage() at AssetViewerListStandardThumbnails/__next_click()

I got it when trying to scroll within a TileList after it was resized. Hotfix 2 doesn't fix the problem. The following trick solved the problem for me: calling the executeBindings() method on the TileList component in the resize event. I hope it does the trick for you as well.

7 comments:

Alli said...

THANK YOU!!! This had me stumped for about 6 hours. Such a simple fix as well.

Boon said...

You saved my life!

I had set up a state change and transitions to fire on the TileList component, and it clearly wasn't working out.

What worked for me was setting the

enterState="segmentSelection.executeBindings(true);"

in the state tags, and the same in the transition tag for mx:Resize tag on the tweenUpdate and effectStart events.

I wasted almost 1 day on this, and almost came close to implementing a "thread safe" solution using tokens and event handlers. It was messy, and I doubt it would've worked anyway.

Anonymous said...

I have this problem as well.
I tried what you suggested. i put in the tileList:

resize="{executeBindings()}"

and it didn't work.
after the resize there is a margin between the tile, and then it crashes on scroll.
any suggestions?

redrony said...

I have the same problem.
i tried your solution, and id didn't help:

resize="executeBindings()" - with true & false.

after i resize, i'm havine a margin between the tiles. and after that, when i scroll, it crashes. any suggestion?

Palmero Tom said...

Make sure to specify the component name when calling the executeBindings(). Example: myTileList.executeBindings(true); If that doesn't do the trick you can try with invalidateList() (to force a redraw of the tiles) and validateNow(). Both have in some cases helped me a lot...

Unknown said...

I had a similar problem... TileList seemed to work fine until I filtered out some items from the dataprovider then tried to scroll the TileList -- crashed with error #1010 in TileBase.as.

It turned out to be my own coding error... in my custom item renderer for the TileList, I had overriden the set data function. In that setter I was assigning the new value to a var I had defined as the source for data binding. Since I was not binding to the data property anywhere in my renderer, I neglected to assign anything to it, so data was always null. Once I added the following line to function set data, all was fine:
super.data = value

Unknown said...

I had a similar problem, turned out to be my own coding error...

I use a custom item renderer on the TileList that overrides the set data function to assign new values to my own variable used for data binding in the renderer. Since I was not using the data property for anything, I neglected to assign value to it.

Evidently data is important to Flex's TileBase.as code, as the problem was fixed when I added the following to the set data function:
super.data = value;

I hope this saves someone else some aggraviation.