Table of Contents

 

7.1 MML Reference
 
 This section describes the Turbine Media Markup Language (MML) tags.

 

 

 

This chapter describes all the available Turbine MML tags. The tags are listed both alphabetically and in tag groups. Tags specific the <Text> tag can be used for text formatting. Please take some time to review the common attributes which are supported by all the visible tags.
Tag attributes marked with a * are mandatory for such tag. Color attributes can either be in the common HTML color form #RRGGBB or in the form #AARRGGBB, where AA is an extra alpha component.

Turbine supports the common XML features like character escapes, XML comments and CDATA sections. Tag attributes can be enclosed in "..." (double-quotes) or '...' (single-quotes), which is very handy for creating MML from scripting environments like ASP scripts. Although the XML parser is quite tolerant to mismatches like unclosed tags, XML correctness is, of course, strongly advised.

Turbine variables can be freely used anywhere, for example:

<Image src="{location}"/>

On places where the expanded variable value may contain characters like < or > that can cause problems with the XML parser, the {&var} syntax can be used, which will cause the expanded variable value to be properly XML-escaped. For example:

<Text>{&TextValue}</Text>

Any tag errors are listed with the offending line number, for easier and faster problem detection.

Coordinates are expressed in a system where larger Y values go down the screen:

 

Alphabetical Tag List

 


Tag Groups

 General Tags:

 

 Shape Tags:

 

 Button Tags:

 

 Display and Control Tags:

 

 Command Tags:

 

 Data Tags:

 


Text Tags

The following tags are used for text formatting inside <Text>...</Text> tags:

Tag Description
<Font face="fontFace" size="fontSize"
style="bold, italic"
color="#AARRGGBB"> ... </Font>
Defines a new font style and/or size to use on the enclosed tags
<b>...</b> Display enclosed text in bold
<i>...</i> Display enclosed text in italic
<p align="left | center | right | justify" spacing="characterSpacing" leading="lineLeading"> ... </p> Start a paragraph containing the enclosed text
<br/> Do a line break
<Pre> ... </Pre> Emit the enclosed text as-is, respecting all white-space characters

 


<Place> Common Attributes

All the tags that create visible elements, like for example the Image, Text, Shape, MovieClip and Button tags, accept a common set of very useful tag attributes:

Attribute Description
pos="x,y" The position where the element appears, in pixels
depth="depthOrder" The depth where the element will be placed. Increasing depth numbers display above prior depth values. Every element should appear on its own depth. Depth alias names can also be used instead of numeric values.
If used in Create or Load interface commands, depths are local to the MML block
scale="s" - or- scale="sx,sy" A scaling factor (or separate x and y scaling factors) to apply to the element
size="width,height" -or-
size="width," -or-
size=",height" -or-
size="10%,10%" -or-
size="10%"

If one of the values is missing, it means that Turbine will calculate the other value, to maintain original proportions.
A percentage sign means the resulting size is a percentage relative to the native size.
The size attribute is only valid for graphic objects.

angle="a" A rotation to apply over the element
matrix="sx,sk0,sk1,sy,x,y" Alternatively to using pos, scale and angle, an affine transformation matrix can be applied to the element
placepoint="center, left, top, right, bottom, origin" This attribute specifies what location on the object should the pos attribute use. For example if selecting placepoint="center", the element will be placed with its center at the coordinates specified on the pos attribute
alpha="a"

A transparency setting for the element, from 0 (full transparent) to 100 (full opaque).

Transparency is not currently supported when generating to PDF.

brightness="-100->+100" Applies a brightness effect into the element. Accepts values from -100 (negative numbers will darken the element) to +100 (positive numbers will brighten the element)
tint="#RRGGBB:level" Applies a tint effect to the element, specified by the #RRGGBB color and by a level percentage number from 0 to 100 (none to full effect)
instance="instanceName"

Specifies an instance name for this object, that can be used from client-side scripting (Action Script) to access and manipulate the object.

Scripting will be discarded when generating to PDF.

id="elementId" Setting this attribute defines a unique id for the element. The same element can be placed several times with the <Place id="elementId"> tag.
flags="define"

Setting this flags attribute together with the id attribute will not actually display it but rather define the element, to later be placed any number of times with the <Place id="elementId"> tag

background="#aarrggbb"
-or-
background="[color(#aarrggbb)], [border(#aarrggbb,width)], [space(extra)]"
-or-
background="[color(#aarrggbb)], [border(#aarrggbb,width)], [space(left,top,right,bottom)]"

Display a background rectangle, behind the placed element. The color and border sub-attributes describe the fill color and the border color, while the spacing describes the extra or actual spacing between the element's bounds and the background.

 


Tag Reference

<Arc>

 
Displays an arc with a certain center and angle. Uses the current line and fill styles. Used inside a Shape tag.

<Arc  center="x,y"
  startAngle="s"
  endAngle="e"
  size="width,height" -or- radius="hRadius,vRadius"
  scale="sx,sy" />

Appears Inside:

Shape

Media Output:

Flash and PDF.

 

<ArcTo>

 
Displays an arc with a certain center and angle, starting from the current position. Uses the current line and fill styles. Used inside a Shape tag.

<ArcTo  center="x,y" *
  startAngle="s" *
  endAngle="e" *
  size="width,height" -or- radius="hRadius,vRadius" *
  scale="sx,sy" />

Appears Inside:

Shape

Media Output:

Flash and PDF.

 

<Audio>

 
Integrate external audio such as WAV, MP3, FLV, AVI and QuickTime audio.

<Audio  src="location" *
  id="name"
  type="start, event, stop, stream"
  fx="loop(num)"
  encoding="raw,
          adpcm(verylow, low, med, high),
          mp3"
  event="Press|Release|RollOut|RollOver"
  />

Remarks

The Audio tag can integrate audio from the following formats:

  • WAV files (uncompressed)
  • MP3 files (with 11khz, 22khz and 44khz sampling rates)
  • AVI format
  • QuickTime format (the QuickTime runtime must be installed)
  • FLV format (except FlashComm-encoded Nelymoser 8 khz)

Please have the following characteristics or limitations in mind when encoding audio, most of them derived from running on a web server environment:

  • The required audio codecs for AVI or QuickTime must be installed on the machine where Turbine runs - when in doubt over this try to play the video on Media Player or QuickTime player.
  • MP3 and FLV movies are the fastest to be audio-encoded, followed by WAV files; AVI and QuickTime will consume larger system resources.
  • Due to QuickTime SDK limitations, QuickTime audio cannot be encoded in parallel, rather it is sequenced by Turbine.
  • Audio encoding can be a resource-intensive process (although not as much as video encoding), with all the related consequences - for example if running from a web server, the default page timeout (which can be set) can be reached.

 
The following options and quality settings are available on the encode attribute:

Value Description
raw,
adpcm(verylow, low, med, high),
mp3
The encoding quality, either raw samples (that is without compression), or ADPCM compression with one of the possible quality settings.
Turbine does not perform MP3 encoding, which will only be used if the original audio already includes audio on this format

The type attribute can have one of the following values:

Type Meaning
Stream
Audio will be encoded so that it streams with the encoded movie - e.g. it will plays as soon as possible after arriving to the player. All other types are not streamed
Start
Even if the same audio (with the same src attribute) is still playing, a new instance will start to play at this tag
Event
If the same audio (with the same src attribute) is still playing, a new instance will not start to play at this tag
Stop
Stop all audio playing with this src.

With the fx attribute a number of loops to play the audio can be specified.

The event attribute may be used inside buttons only. On this case, the following events are possible, depending on the mouse interaction with the button:

Event State Transition
Press
Over with mouse up to Over with mouse down
Release
Over with mouse down to Over with mouse up
RollOver
Outside to Over state, with mouse up
RollOut
Over to Outside state, with mouse up

This tag may also be used under the name <Sound>.

Media Output:

Flash. Audio is not exported to PDF.

 

<AutoLayout>

 
Defines how elements without a specified position (e.g. without the pos attribute) will be automatically placed.

<AutoLayout  pos="x,y"
  type="horizontal | vertical | off" *
  align="left | top | center | bottom | right"
  spacing="s" />

Remarks:

The type attribute can be one of:

Type Attribute Description
Vertical Elements will be placed in a vertical sucession, along a vertical column
Horizontal Elements will be placed in an horizontal sucession, along an horizontal row
Off AutoLayout is disabled, element positions default to the origin (0,0)

When using Vertical or Horizontal types, we can align the elements column or elements row, with the align attribute, using the usual left, right or center alignments.

Media Output:

Flash and PDF.

 

<AutoImage>

 
Displays a series of images driven by a Turbine DataSet.

<AutoImage  dataSet="dataSetName" *
  defaultSrc="imageLocation" -or-
defaultId="imageId"
  defaultDx="horizontalMove"
  defaultDy="verticalMove"
  cols="numCols"
  defaultPlacePoint="center | left | top | right | bottom" />

Remarks:

The driver DataSet can have the following columns - note that any specified tag attributes already define default values for some of these columns - in any case, default values are used if not specified:

DataSet
Column Name
Description
_src
   -or-

_id
either a location (_src column) or an id (_id) of an image to place; if not specified, the defaultSrc/defaultId attribute value will be used instead
_instance an instance name that the displayed image will use
_x an x position where the image will be placed; otherwise, automatic corrdinates will apply
_y a y position where the image will be placed; otherwise, automatic corrdinates will apply
_width a width value for the image
_height an height value for the image
_scalex an horizontal scale factor
_scaley a vertical scale factor
_angle an angle to rotate the image, specified in degrees
_alpha a transparency value, specified in a percentage
_placepoint the point in the image used for the placing position

The contents of any other DataSet column names are mapped into Flash Action Script variables defined inside each placed image.

The AutoImage tag can work in two modes, in respect to the placement coordinates:

  • with an automatic cursor - this mode is useful for horizontal/vertical image lists and grids
  • with coordinate values specified on the DataSet - this mode is more suitted for applications like images on maps, where coordinates are not structured.


On the automatic cursor mode, with the defaultDy or defaultDy attributes, plus the cols attribute, lists or grids of images can be placed. The following combinations are possible depending on which of these attributes are set:

defaultDx defaultDY cols Description
set unset unset an horizontal image list, with each image separated by defaultDX pixels
unset set unset a vertical image list, with each image separated by defaultDY pixels
set set set a grid of images, filling each horizontal row with cols elements, spaced by defaultDx, and starting a new row after it, with a defaultDy vertical move

AutoImage also allows a new row line to be started from the DataSet by including the "_newline" string as the only value of a that DataSet row.

Media Output:

Flash and PDF.

 

<AutoMedia>

 
Creates a series of elements, as specified by a Turbine DataSet, by synthesizing their MML tags. Alternatively can place other pre-defined elements from their ids.

<AutoMedia  dataSet="dataSetName" *
  defaultTag="tagName"
  defaultAttributes="attr1='value' attr2='value' ..."
  defaultValue="value"
  valueColumn="columnName"
  defaultDx="horizontalMove"
  defaultDy="verticalMove"
  cols="numCols"
  defaultId="elementId" />

Remarks:

AutoMedia can work in two different modes, depending on whether pre-defined element ids are specified (on the DataSet or on the defaultId tag attribute) or are not specified at all. When an id is specified, instances of such id are displayed as commanded by the DataSet rows. But if ids are not specified, Turbine will try to create new elements as instructed by the DataSet and specified <AutoMedia> tag attributes.

The driver DataSet can have the following columns - note that any specified <AutoMedia> tag attributes already define default values for some of these columns; interactions between <AutoMedia> tag attributes and DataSet columns are described on this table:

DataSet
Column Name
Description
_tag the name of the element tag to place - for example text, image, audio. If not specified, the value of the defaultTag attribute is used
_value
-or-
column name specified on the valueColumn attribute
if the placed element is represented by an open tag, this column holds the value of the open tag; for example if synthesizing a <Text>letters</Text> tag, this value could have "letters".
If not specified, the defaultValue tag attribute is used, if defined
_* any DataSet columns that start by an underscore will be defined as attributes of the tag being synthesized, without the initial underscore. For example if this column is named _font, a font="value" attribute is added to the element being created on this DataSet row. In addition, any attributes specified on the defaultAttributes <AutoMedia> attribute are also added
_id an element id to display with teh attributes specified on this DataSet row
_x an x position where the element will be placed; otherwise, automatic coordinates will apply
_y a y position where the element will be placed; otherwise, automatic coordinates will apply
_dx the horizontal cursor displacement to add to current position *after* placing this element
_dy the horizontal cursor displacement to add to current position *after* placing this element
_offsetx an horizontal internal offset, with respect to current cursor position, that affects where the element is placed
_offsety a vertical internal offset, with respect to current cursor position, that affects where the element is placed

The contents of any other DataSet column names are mapped into Flash Action Script variables defined inside each placed image.

The AutoImage tag can work in two modes, in respect to the placement coordinates:

  • with an automatic cursor - this mode is useful for horizontal/vertical image lists and grids
  • with coordinate values specified on the DataSet - this mode is more suitted for applications like images on maps, where coordinates are not structured.


On the automatic cursor mode, with the defaultDy or defaultDy attributes, plus the cols attribute, lists or grids of images can be placed. The following combinations are possible depending on which of these attributes are set:

defaultDx defaultDY cols Description
set unset unset an horizontal image list, with each image separated by defaultDX pixels
unset set unset a vertical image list, with each image separated by defaultDY pixels
set set set a grid of images, filling each horizontal row with cols elements, spaced by defaultDx, and starting a new row after it, with a defaultDy vertical move

AutoMedia also allows a new row line to be started from the DataSet by including the "_newline" string as the only value of the _dx or _dy DataSet columns.

In addition, specifying a "_here" string on the _dx and _dy columns of a DataSet row, will cause the cursor not to automatically advance - this is very useful when composing elements on top of each other - for example creating an image with a caption and a border shape.

Media Output:

Flash and PDF.

 

<AutoMovieClip>

 
Displays a series of movie clips, driven by a Turbine DataSet.

<AutoMovieClip  dataSet="dataSetName" *
  defaultId="movieClipId"
  defaultDx="horizontalMove"
  defaultDy="verticalMove"
  cols="numCols"
  defaultPlacePoint="center | left | top | right | bottom" />

Remarks

The driver DataSet can have the following columns - note that any specified tag attributes already define default values for some of these columns - in any case, default values are used if not specified:

DataSet
Column Name
Description
_id the id of a movie clip to display; if not specified, the defaultId attribute value will be used instead
_instance an instance name that the displayed movie clip will use
_x an x position where the movie clip will be placed; otherwise, automatic coordinates will apply
_y a y position where the movie clip will be placed; otherwise, automatic coordinates will apply
_width a width value for the movie clip
_height an height value for the movie clip 
_scalex an horizontal scale factor
_scaley a vertical scale factor
_angle an angle to rotate the movie clip, specified in degrees
_alpha a transparency value, specified in a percentage
_placepoint the point in the movie clip used for placing position

The contents of any other DataSet column names are mapped into Flash Action Script variables defined inside each placed movie clip.

The AutoMovieClip tag can work in two modes, in respect to the placement coordinates:

  • with an automatic cursor - this mode is useful for horizontal/vertical lists and grids
  • with coordinate values specified on the DataSet - this mode is more suitted for applications like hot-spots on maps, where coordinates are not structured.

 
On the automatic cursor mode, with the defaultDy or defaultDy attributes, plus the cols attribute, lists or grids of movie clips can be placed. The following combinations are possible depending on which of these attributes are set:

defaultDx defaultDY cols Description
set unset unset an horizontal movie clip list, with each movie clip separated by defaultDX pixels
unset set unset a vertical movie clip list, with each movie clip separated by defaultDY pixels
set set set a grid of movie clips, filling each horizontal row with cols elements, spaced by defaultDx, and starting a new row after it, with a defaultDy vertical move

AutoImage also allows a new row line to be started from the DataSet by including the "_newline" string as the only value of a that DataSet row.

Media Output:

Flash and PDF.

 

<BaseDepth>

 
Sets a base depth, causing elements placed inside or after this tag to be grouped in terms of their depth. By using different BaseDepth commands one can guarantee that groups of elements will always be above other groups of elements.

<BaseDepth  depth="d" * >

Remarks:

Can be used hierarchically as open tag, or sequentially as a closed tag.

Media Output:

Flash and PDF.

 

<Button>

 
Creates a button or hot-spot element.

<Button type="push|push" >

<State type="..."> ... </State>
...
<Script event="..."> ... </Script>
...
<Audio event="..." ...>
 

</Button>

Remarks

Button elements can be used to create clickable hot-spots for anything from normal buttons to dragging areas and a lot more.
The type attribute specifies how the button will behave:

  • With push type the mouse is captured, all events are sent to the button, for example clicking on a push button and dragging outside will still affect the button.
  • With menu type, as soon as the mouse cursor leaves the button area it is ignored by the button, which returns to its normal state.

See the included tags below for more information:

Can Include

State , Script and Audio tags

Media Output:

Flash and PDF. Buttons are outputted to PDF by showing only its "up" state. Associated audio and script are not exported.

 

<Chart>

 
If you're looking into generating impressive animated and interactive Flash charts, please see Rich Chart Server.

Displays a chart from the values contained in a Turbine DataSet.

<Chart  type="chartType" *
  dataSet="dataSetName" *
 

labelColumn="columnName" *

 

valueColumn="columnName"

 

urlColumn="columnName"

 

tooltipColumn="columnName"

 

colorColumn="columnName"

  bounds="width,height"
 

defaultColor="#AARRGGBB"

  yPrecision="decimalPlaces"
  yMarks="numMarks"
  yMin="yAxisMinValue"
  yMax="yAxisMaxValue"
 

drawBackground="true | false"

 

threeDDepth="3d_depth"

 

threeDAngle="3d_angle" />


Remarks:

The type attribute can be one of:
- Area
- Area3d
- Column
- Column3d
- CoolColumn
- Glass
- Line
- Line3d
- LineMarker
- Pie
- Pie3d
- Plain
- Scatter
- Stick
- Triangle
- Triangle3d

Chart types are built in a plug-able way - you can build your own by writing the respective MML definition files.
Custom chart types must be copied into the /chart directory inside the Turbine installation directory.

Several charts can be layered by placing at the same position several <Chart> tags with the drawBackground attribute set to false, with the bottommost <Chart> tag having drawBackground set to true, to display the chart background.

To control the size of the whole chart, the size common attribute can be used, however when layering chart commands with the drawBackground attribute, the bounds attribute should be used instead, to specify the width and height of the chart's main area, so that successive charts placed above each other match perfectly.

Media Output:

Flash and PDF. Interactivity of PDF charts is not available such as links, sounds and rollovers.

 

<Circle>

 
Draws a circle using the current line and fill styles. Used inside a Shape tag.

<Circle  center="x,y" *
  radius="r" -or- diameter="d" * />

Appears Inside:

Shape

Media Output:

Flash and PDF.

 

<Curve>

 
Displays a curve from a number of on-line and off-line (control) points using the current line and fill styles. Used inside a Shape tag.

<Curve  type="quadratic | bezier"
  path="x0,y0; x1,y1; x2,y2..." * />

Remarks:

If the type attribute is not specified, curve type defaults to quadratic.
Quadratic curves are specified by one on-line point, followed by an off-line control point, followed by an on-line point and so on.
Bezier curves must be specified by an on-line point, followed by two control points, followed by an on-line point, then two control points and so on.

Appears Inside:

Shape

Media Output:

Flash and PDF.

 

<CurveTo>

 
Displays a curve from a number of on-line and off-line (control) points, where the initial on-line point is the current cursor position. Uses the current line and fill styles. Used inside a Shape tag.

<CurveTo  type="quadratic | bezier"
  path="x1,y1; x2,y2..." * />

Remarks:

If the type attribute is not specified, curve type defaults to quadratic.
Quadratic curves are specified by one on-line point (on this tag this point is not specified on the path attribute, instead it's assumed to be the current cursor position), followed by an offline control point, followed by an on-line point and so on.
Bezier curves must be specified by an on-line point (on this tag this point is not specified on the path attribute, instead it's assumed to be the current cursor position), followed by two control points, followed by an on-line point, then two control points and so on.

Appears Inside:

Shape

Media Output:

Flash and PDF.

 

<DataSet>

 
Loads or creates a Turbine DataSet. Can load from local disk or a remote HTTP location. DataSets can be in XML or simple line-based format.

To load a Turbine DataSet:

<DataSet  dataSet="dataSetName" *
  src="location" *
  rowTag=""
  columnTags="" />

To directly create a Turbine DataSet, an open tag should be used:

<DataSet  dataSet="dataSetName" *
  rowTag="rowTag"
  columnTags="columnTag,columnTag,..." >
  ...
</DataSet>

Remarks:

Turbine DataSets, both from a file or directly on the MML (using the open form of the tag) can be expressed either in XML or in a line-based format. When loading or creating a DataSet from an XML document, the rowTag and columnTags attributes must be used:

rowTag is the name of the XML tag to use to start a new DataSet Row - it must be a non empty tag, with other tags inside, to be used for the rows,
columnTag is a comma separated list of tags and/or tag parameters to use (once parsing inside a rowTag tag) to create DataSet columns. To address all the expressiveness of XML these formats can be used on this attribute:

columnTags Effect
"" (empty) The text immediately after the start of each rowTag will be used for the only column in the DataSet, this column will be named after the rowTag name
"tag1, tag2, tag3,..". The DataSet will feature the specified columns, composed by the text immediately inside each of these tags, for each rowTag
"tag1#attr1, tag2#attr2"

Each tag marked with an hash will contribute with the text of the attr1 or attr2 attribute inside the respective tag, for example:
<tag1 attr1="some"/> <tag2 attr2="times"/>
would use the text "some" and "times" for successive columns inside the created DataSet. The created DataSet columns would be called "tag1#attr2" and "tag2#attr2"

"tag1#attr1=alias1, tag2#attr2=alias2" Just like the above, but the columns will be defined on the DataSet with the column name specified in alias1 and alias2. This is important for some tags that depend on column names like the AutoMedia, AutoImage or AutoMovieClip tags

Turbine DataSets can also be created from a simple, line-based tabular format - the first line must contain the column names, separated by commas and enclosed in < ... , while the next lines should contain comma-separated quoted values for each of those columns. An example of a DataSet expressed in this way would be (extra spaces for easier visualization only):

<name,             address,           age>
"John Doe",        "Street Nine 7",   41
"Carl Zundapp",    "Naples Blvd 15",  17
"Maria Callahari", "Progress St. 03", 32

When loading DataSets from an external file or remote HTTP location, files can be encoded in ASCII, UTF-8 and Unicode (both little-endian and big-endian) file formats.

Media Output:

Flash and PDF.

 

<DefaultText>

 
Sets the default text attributes that will be used from this point on.

<DefaultText  font/face="fontName"
  fontSize/size="size"
  fontStyle/style="bold | italic"
  color="#AARRGGBB"
  align="left | right | center | justify"
  leading="lineLeading"
  spacing="characterSpacing"/>

Media Output:

Flash and PDF.

 

<Ellipse>

 
Draws an ellipse using the current line and fill styles. Used inside a Shape tag.

<Ellipse  center="x,y" *