Reorganizing thumbnail columns on Browser resize


I am currently using an xml gallery with the thumbnails being loaded dynamically.
They are basically organized using these variables when the movie loads:

var widthThumb:Number = 80; // thumb width
var heightThumb:Number = 80; // thumb height
var sepThumb:Number = 5; // separation between thumbs
var col:Number = 8 // columns amount

Currently, the thumbnails column number is predetermined by the COL variable.
I came up with this line, which is working, but only in when the movie first loads:

col = Math.round(Stage.width/60)-1;

The result? The thumbnails column number is determined depending on your browser’s width, in order for you not to see a long line of thumbnails loading outside of the screen.

I would like to have this behavior to occur when you resize the browser as well.
I tried to use a StageListener.onResize, which is most likely what will be needed in the end. However, it is not that simple. I think it is because the thumbnails are loaded dynamically from an XML file, so they are stuck with the initial column number. I don’t know how to achieve this. Any idea?

On good working example is:
in the portfolio section