DefineScalingGrid

Tag Info
Tag Number: 
78
Tag Type: 
Define
Tag Flash Version: 
8
Unknown SWF Tag: 
This tag is defined by the Flash documentation by Adobe
Brief Description: 

Define scale factors for a window, a button, or other similar objects.

Tag Structure: 
struct swf_definescalinggrid {
	swf_tag				f_tag;		/* 78 */
	unsigned short			f_button_id_ref;
	swf_rect			f_rect;
};

This definition is used so the scaling factors applied on an object affects only the center of the object fully. The borders are only affected in one direction and the corners are not scaled (note, restrictions apply, see below.) This is quite useful to draw a scalable button or window.


Fig 1 — Sample button being scaled with a scaling grid

As we can see in the example, the corners are not being scaled. The vertical borders are scaled vertically only. The horizontal borders are scaled horizontally only. The inner area is scaled both ways.

For your grid to work, there are many restrictions as follow:

  • The referenced object must be a DefineSprite or a DefineButton. Note that any button tag is affected.
  • The referenced object cannot be rotated or skewed. However, it is possible to include the resulting object in a sprite and then use a rotation or skew in the PlaceObject matrix when placing that sprite.
  • Shapes directly defined in the referenced object are affected. If you create a button or sprite made up of sub-sprites, these sub-sprites are not affected.
  • Text is not affected by the grid. It is always scaled as expected.
  • Fills are likely to not work as expected (i.e. bitmaps, images); that is, this tag is likely to have no effect on them
  • When scaling down so much that the inner area represents less than 1 pixel will then affect the borders and corners as if there wasn't a scaling grid.
  • Somehow the Stop action can prevent the grid from working (i.e. insert Shapes, Button, Grid, Action Stop, Resize, Show Frame; the edges are resized as if no grid was there.)
  • [would need more testing] It may be that to work you need to place the resulting button or sprite in another parent sprite. This is how I could make my grid work properly without having to mess around.

The f_button_id_ref needs to specify a button or a sprite.

The f_rect defines the inner area.