Monday, November 17, 2008

Frame, scene or display list

As I said before, the displaying happens when there is a ShowFrame tag in SWF. To display a visual object, one should at first describe it (DefineXXX tags), and then place it on a needed depth with the help of PlaceObject tags. One object can be placed many times, so we have cloning effect. Depending on PlaceObject tag parameters, the instances of a visual object can look absolutely different. The instances are displayed until they are forcibly removed by RemoveObject tag. That allows to determine, place and remove instances of objects in different frames.

Looking at this scheme, one can answer the question what objects are displayed in what frame – one have to make a list of all PlaceObject before the current frame and except those ones which were removed by RemoveObject tag. One should also take into account that PlaceObject can have a flag PlaceFlagMove which indicates that the occupied depth must be cleared, i.e. it's analogous to RemoveObject in one tag.


PlaceObject review

It's the main tag used to indicate what object, where and how should be displayed. As the SWF format was developed, additional parameters were added to this tag. Now there are three "editions": tagPlaceObject, tagPlaceObject2 and tagPlaceObject3.

Key parameters:

  • Depth – the depth where an object is placed. The lager the value is, the "higher" an image is. As this parameter can't be more than 2 bytes, the maximum value is 65535. To be displayed correctly, there shouldn't be other objects on a depth, otherwise one have to set PlaceFlagMove as true.
  • CharacterId – identifier of an existing object.
  • Name – name of object instance. It can be used in ActionScript for programming animation and interactivity.
  • Matrix – the group of parameters for geometric transformation. It includes TranslateX and TranslateY to indicate position (nought in the top left corner), ScaleX and ScaleY for reducing or enlarging, SkewX and SkewY for bevels and rotations.
  • ColorTransform – the group of parameters for color transformation. It includes addR, addG, addB and addA for changing color components by adding specified values; multR, multG, multB, multA for changing color components by multiplying them by specified values.

By setting different parameters in different frames, we have animation. For instance, by changing Translate value, one can create movement. By changing addA or multA, one creates appear and disappear effects.

No comments:

Post a Comment