views:

17

answers:

1

Hello;

I have a bit of a problem with actionscript 3.0 dynamic movieclip placement.

The scenario is like this:

I have a 16x16 grid generated by actionscript inside a movieclip. (let's name it gridContainer).

The tiles of the grid should have constant height and width; it should not scale with its parent's height/width changes. Also, I want this gridContainer MC to be stretched all the way to the right and bottom of stage.

The problem arises when i resize the stage. In the gridContainer's resize event listener, I set the gridContainer's H/W to stage's H/W. Then of course, tiles are scaled. I rescale down the tiles in their respective resize listeners. But, when I do this, I lose the container's width and height.

My ultimate goal for now is to draw a border around the tiles, even if the number of tiles fall short of the gridContainer's area.

What approach, you flash gurus suggest? How is the static width/height achieved?

Thanks in advance.

A: 

A parent display object will always take the area of the largest element within it. Are the tiles the only children of gridContainer? If so, gridContainer will shrink to fit the tiles when they're resized.

I think you'd need to create a transparent background child element to sit behind the grid and resize when the stage's dimensions change. So when the stage changes, you resize the tiles appropriately, but let the background element scale naturally.

DHuntrods