HaruDestination::setXYZ
Introduction
Non-Text MIME Output
PHP Manual

# Ming (flash)

Table of Contents

- Introduction
- Installing/Configuring
  - Requirements
  - Installation
  - Runtime Configuration
  - Resource Types
- Predefined Constants
- Examples
  - SWFAction Examples
  - SWFSPrite basic examples
- Ming Functions
  - ming_keypress — Returns the action flag for keyPress(char)
  - ming_setcubicthreshold — Set cubic threshold
  - ming_setscale — Set the global scaling factor.
  - ming_setswfcompression — Sets the SWF output compression
  - ming_useconstants — Use constant pool
  - ming_useswfversion — Sets the SWF version
- SWFAction — The SWFAction class
  - SWFAction::__construct — Creates a new SWFAction
- SWFBitmap — The SWFBitmap class
  - SWFBitmap::__construct — Loads Bitmap object
  - SWFBitmap::getHeight — Returns the bitmap's height
  - SWFBitmap::getWidth — Returns the bitmap's width
- SWFButton — The SWFButton class
  - SWFButton::addAction — Adds an action
  - SWFButton::addASound — Associates a sound with a button transition
  - SWFButton::addShape — Adds a shape to a button
  - SWFButton::__construct — Creates a new Button
  - SWFButton::setAction — Sets the action
  - SWFButton::setDown — Alias for addShape(shape, SWFBUTTON_DOWN)
  - SWFButton::setHit — Alias for addShape(shape, SWFBUTTON_HIT)
  - SWFButton::setMenu — enable track as menu button behaviour
  - SWFButton::setOver — Alias for addShape(shape, SWFBUTTON_OVER)
  - SWFButton::setUp — Alias for addShape(shape, SWFBUTTON_UP)
- SWFDisplayItem — The SWFDisplayItem class
  - SWFDisplayItem::addAction — Adds this SWFAction to the given SWFSprite instance
  - SWFDisplayItem::addColor — Adds the given color to this item's color transform
  - SWFDisplayItem::endMask — Another way of defining a MASK layer
  - SWFDisplayItem::getRot — Description
  - SWFDisplayItem::getX — Description
  - SWFDisplayItem::getXScale — Description
  - SWFDisplayItem::getXSkew — Description
  - SWFDisplayItem::getY — Description
  - SWFDisplayItem::getYScale — Description
  - SWFDisplayItem::getYSkew — Description
  - SWFDisplayItem::move — Moves object in relative coordinates
  - SWFDisplayItem::moveTo — Moves object in global coordinates
  - SWFDisplayItem::multColor — Multiplies the item's color transform
  - SWFDisplayItem::remove — Removes the object from the movie
  - SWFDisplayItem::rotate — Rotates in relative coordinates
  - SWFDisplayItem::rotateTo — Rotates the object in global coordinates
  - SWFDisplayItem::scale — Scales the object in relative coordinates
  - SWFDisplayItem::scaleTo — Scales the object in global coordinates
  - SWFDisplayItem::setDepth — Sets z-order
  - SWFDisplayItem::setMaskLevel — Defines a MASK layer at level
  - SWFDisplayItem::setMatrix — Sets the item's transform matrix
  - SWFDisplayItem::setName — Sets the object's name
  - SWFDisplayItem::setRatio — Sets the object's ratio
  - SWFDisplayItem::skewX — Sets the X-skew
  - SWFDisplayItem::skewXTo — Sets the X-skew
  - SWFDisplayItem::skewY — Sets the Y-skew
  - SWFDisplayItem::skewYTo — Sets the Y-skew
- SWFFill — The SWFFill class
  - SWFFill::moveTo — Moves fill origin
  - SWFFill::rotateTo — Sets fill's rotation
  - SWFFill::scaleTo — Sets fill's scale
  - SWFFill::skewXTo — Sets fill x-skew
  - SWFFill::skewYTo — Sets fill y-skew
- SWFFont — The SWFFont class
  - SWFFont::__construct — Loads a font definition
  - SWFFont::getAscent — Returns the ascent of the font, or 0 if not available
  - SWFFont::getDescent — Returns the descent of the font, or 0 if not available
  - SWFFont::getLeading — Returns the leading of the font, or 0 if not available
  - SWFFont::getShape — Returns the glyph shape of a char as a text string
  - SWFFont::getUTF8Width — Calculates the width of the given string in this font at full height
  - SWFFont::getWidth — Returns the string's width
- SWFFontChar — The SWFFontChar class
  - SWFFontChar::addChars — Adds characters to a font for exporting font
  - SWFFontChar::addUTF8Chars — Adds characters to a font for exporting font
- SWFGradient — The SWFGradient class
  - SWFGradient::addEntry — Adds an entry to the gradient list
  - SWFGradient::__construct — Creates a gradient object
- SWFMorph — The SWFMorph class
  - SWFMorph::__construct — Creates a new SWFMorph object
  - SWFMorph::getShape1 — Gets a handle to the starting shape
  - SWFMorph::getShape2 — Gets a handle to the ending shape
- SWFMovie — The SWFMovie class
  - SWFMovie::add — Adds any type of data to a movie
  - SWFMovie::addExport — Description
  - SWFMovie::addFont — Description
  - SWFMovie::__construct — Creates a new movie object, representing an SWF version 4 movie
  - SWFMovie::importChar — Description
  - SWFMovie::importFont — Description
  - SWFMovie::labelFrame — Labels a frame
  - SWFMovie::nextFrame — Moves to the next frame of the animation
  - SWFMovie::output — Dumps your lovingly prepared movie out
  - SWFMovie::remove — Removes the object instance from the display list
  - SWFMovie::save — Saves the SWF movie in a file
  - SWFMovie::saveToFile — Description
  - SWFMovie::setbackground — Sets the background color
  - SWFMovie::setDimension — Sets the movie's width and height
  - SWFMovie::setFrames — Sets the total number of frames in the animation
  - SWFMovie::setRate — Sets the animation's frame rate
  - SWFMovie::startSound — Description
  - SWFMovie::stopSound — Description
  - SWFMovie::streamMP3 — Streams a MP3 file
  - SWFMovie::writeExports — Description
- SWFPrebuiltClip — The SWFPrebuiltClip class
  - SWFPrebuiltClip::__construct — Returns a SWFPrebuiltClip object
- SWFShape — The SWFShape class
  - SWFShape::addFill — Adds a solid fill to the shape
  - SWFShape::__construct — Creates a new shape object
  - SWFShape::drawArc — Draws an arc of radius r centered at the current location, from angle startAngle to angle endAngle measured clockwise from 12 o'clock
  - SWFShape::drawCircle — Draws a circle of radius r centered at the current location, in a counter-clockwise fashion
  - SWFShape::drawCubic — Draws a cubic bezier curve using the current position and the three given points as control points
  - SWFShape::drawCubicTo — Draws a cubic bezier curve using the current position and the three given points as control points
  - SWFShape::drawCurve — Draws a curve (relative)
  - SWFShape::drawCurveTo — Draws a curve
  - SWFShape::drawGlyph — Draws the first character in the given string into the shape using the glyph definition from the given font
  - SWFShape::drawLine — Draws a line (relative)
  - SWFShape::drawLineTo — Draws a line
  - SWFShape::movePen — Moves the shape's pen (relative)
  - SWFShape::movePenTo — Moves the shape's pen
  - SWFShape::setLeftFill — Sets left rasterizing color
  - SWFShape::setLine — Sets the shape's line style
  - SWFShape::setRightFill — Sets right rasterizing color
- SWFSound — The SWFSound class
  - SWFSound::__construct — Returns a new SWFSound object from given file
- SWFSoundInstance — The SWFSoundInstance class
  - SWFSoundInstance::loopCount — Description
  - SWFSoundInstance::loopInPoint — Description
  - SWFSoundInstance::loopOutPoint — Description
  - SWFSoundInstance::noMultiple — Description
- SWFSprite — The SWFSprite class
  - SWFSprite::add — Adds an object to a sprite
  - SWFSprite::__construct — Creates a movie clip (a sprite)
  - SWFSprite::labelFrame — Labels frame
  - SWFSprite::nextFrame — Moves to the next frame of the animation
  - SWFSprite::remove — Removes an object to a sprite
  - SWFSprite::setFrames — Sets the total number of frames in the animation
  - SWFSprite::startSound — Description
  - SWFSprite::stopSound — Description
- SWFText — The SWFText class
  - SWFText::addString — Draws a string
  - SWFText::addUTF8String — Writes the given text into this SWFText object at the current pen position, using the current font, height, spacing, and color
  - SWFText::__construct — Creates a new SWFText object
  - SWFText::getAscent — Returns the ascent of the current font at its current size, or 0 if not available
  - SWFText::getDescent — Returns the descent of the current font at its current size, or 0 if not available
  - SWFText::getLeading — Returns the leading of the current font at its current size, or 0 if not available
  - SWFText::getUTF8Width — calculates the width of the given string in this text objects current font and size
  - SWFText::getWidth — Computes string's width
  - SWFText::moveTo — Moves the pen
  - SWFText::setColor — Sets the current text color
  - SWFText::setFont — Sets the current font
  - SWFText::setHeight — Sets the current font height
  - SWFText::setSpacing — Sets the current font spacing
- SWFTextField — The SWFTextField class
  - SWFTextField::addChars — adds characters to a font that will be available within a textfield
  - SWFTextField::addString — Concatenates the given string to the text field
  - SWFTextField::align — Sets the text field alignment
  - SWFTextField::__construct — Creates a text field object
  - SWFTextField::setBounds — Sets the text field width and height
  - SWFTextField::setColor — Sets the color of the text field
  - SWFTextField::setFont — Sets the text field font
  - SWFTextField::setHeight — Sets the font height of this text field font
  - SWFTextField::setIndentation — Sets the indentation of the first line
  - SWFTextField::setLeftMargin — Sets the left margin width of the text field
  - SWFTextField::setLineSpacing — Sets the line spacing of the text field
  - SWFTextField::setMargins — Sets the margins width of the text field
  - SWFTextField::setName — Sets the variable name
  - SWFTextField::setPadding — Sets the padding of this textfield
  - SWFTextField::setRightMargin — Sets the right margin width of the text field
- SWFVideoStream — The SWFVideoStream class
  - SWFVideoStream::__construct — Returns a SWFVideoStream object
  - SWFVideoStream::getNumFrames — Returns the number of frames in the video
  - SWFVideoStream::setDimension — Sets video dimension

# The SWFAction class

## Introduction

SWFAction.

## Class synopsis

SWFAction
class SWFAction {
/* Methods */
__construct ( string `$script` )
}

## Description

The script syntax is based on the C language, but with a lot taken out- the SWF bytecode machine is just too simpleminded to do a lot of things we might like. For instance, we can't implement function calls without a tremendous amount of hackery because the jump bytecode has a hardcoded offset value. No pushing your calling address to the stack and returning- every function would have to know exactly where to return to.

So what's left? The compiler recognises the following tokens:

- break
- for
- continue
- if
- else
- do
- while

There is no typed data; all values in the SWF action machine are stored as strings. The following functions can be used in expressions:

time()
  Returns the number of milliseconds (?) elapsed since the movie started.
random(seed)
  Returns a pseudo-random number in the range 0-seed.
length(expr)
  Returns the length of the given expression.
int(number)
  Returns the given number rounded down to the nearest integer.
concat(expr, expr)
  Returns the concatenation of the given expressions.
ord(expr)
  Returns the ASCII code for the given character
chr(num)
  Returns the character for the given ASCII code
substr(string, location, length)
  Returns the substring of length `length` at location `location` of the given string `string`.

Additionally, the following commands may be used:

duplicateClip(clip, name, depth)
  Duplicate the named movie `clip` (aka sprite). The new movie clip has name `name` and is at depth `depth`.
removeClip(expr)
  Removes the named movie clip.
trace(expr)
  Write the given expression to the trace log. Doubtful that the browser plugin does anything with this.
startDrag(target, lock, [left, top, right, bottom])
  Start dragging the movie clip `target`. The `lock` argument indicates whether to lock the mouse (?)- use 0 (`FALSE`) or 1 (`TRUE`). Optional parameters define a bounding area for the dragging.
stopDrag()
  Stop dragging my heart around. And this movie clip, too.
callFrame(expr)
  Call the named frame as a function.
getURL(url, target, [method])
  Load the given URL into the named target. The `target` argument corresponds to HTML document targets (such as "_top" or "_blank"). The optional `method` argument can be POST or GET if you want to submit variables back to the server.
loadMovie(url, target)
  Load the given URL into the named target. The `target` argument can be a frame name (I think), or one of the magical values "_level0" (replaces current movie) or "_level1" (loads new movie on top of current movie).
nextFrame()
  Go to the next frame.
prevFrame()
  Go to the last (or, rather, previous) frame.
play()
  Start playing the movie.
stop()
  Stop playing the movie.
toggleQuality()
  Toggle between high and low quality.
stopSounds()
  Stop playing all sounds.
gotoFrame(num)
  Go to frame number `num`. Frame numbers start at 0.
gotoFrame(name)
  Go to the frame named `name`. Which does a lot of good, since I haven't added frame labels yet.
setTarget(expr)
  Sets the context for action. Or so they say- I really have no idea what this does.

And there's one weird extra thing. The expression frameLoaded(num) can be used in if statements and while loops to check if the given frame number has been loaded yet. Well, it's supposed to, anyway, but I've never tested it and I seriously doubt it actually works. You can just use /:framesLoaded instead.

Movie clips (all together now- aka sprites) have properties. You can read all of them (or can you?), you can set some of them, and here they are:

- x
- y
- xScale
- yScale
- currentFrame - (read-only)
- totalFrames - (read-only)
- alpha - transparency level
- visible - 1=on, 0=off (?)
- width - (read-only)
- height - (read-only)
- rotation
- target - (read-only) (???)
- framesLoaded - (read-only)
- name
- dropTarget - (read-only) (???)
- url - (read-only) (???)
- highQuality - 1=high, 0=low (?)
- focusRect - (???)
- soundBufTime - (???)

So, setting a sprite's x position is as simple as /box.x = 100;. Why the slash in front of the box, though? That's how flash keeps track of the sprites in the movie, just like a Unix filesystem- here it shows that box is at the top level. If the sprite named box had another sprite named biff inside of it, you'd set its x position with /box/biff.x = 100;. At least, I think so; correct me if I'm wrong here.

# The SWFBitmap class

## Introduction

SWFBitmap.

## Class synopsis

SWFBitmap
class SWFBitmap {
/* Methods */
__construct ( mixed `$file` [, mixed `$alphafile` ] )
float getHeight ( void )
float getWidth ( void )
}

# The SWFButton class

## Introduction

SWFButton.

## Class synopsis

SWFButton
class SWFButton {
/* Methods */
void addAction ( SWFAction `$action` , int `$flags` )
SWFSoundInstance addASound ( SWFSound `$sound` , int `$flags` )
void addShape ( SWFShape `$shape` , int `$flags` )
__construct ( void )
void setAction ( SWFAction `$action` )
void setDown ( SWFShape `$shape` )
void setHit ( SWFShape `$shape` )
void setMenu ( int `$flag` )
void setOver ( SWFShape `$shape` )
void setUp ( SWFShape `$shape` )
}

# The SWFDisplayItem class

## Introduction

SWFDisplayItem.

## Class synopsis

SWFDisplayItem
class SWFDisplayItem {
/* Methods */
void addAction ( SWFAction `$action` , int `$flags` )
void addColor ( int `$red` , int `$green` , int `$blue` [, int `$a` ] )
void endMask ( void )
float getRot ( void )
float getX ( void )
float getXScale ( void )
float getXSkew ( void )
float getY ( void )
float getYScale ( void )
float getYSkew ( void )
void move ( float `$dx` , float `$dy` )
void moveTo ( float `$x` , float `$y` )
void multColor ( float `$red` , float `$green` , float `$blue` [, float `$a` ] )
void remove ( void )
void rotate ( float `$angle` )
void rotateTo ( float `$angle` )
void scale ( float `$dx` , float `$dy` )
void scaleTo ( float `$x` [, float `$y` ] )
void setDepth ( int `$depth` )
void setMaskLevel ( int `$level` )
void setMatrix ( float `$a` , float `$b` , float `$c` , float `$d` , float `$x` , float `$y` )
void setName ( string `$name` )
void setRatio ( float `$ratio` )
void skewX ( float `$ddegrees` )
void skewXTo ( float `$degrees` )
void skewY ( float `$ddegrees` )
void skewYTo ( float `$degrees` )
}

# The SWFFill class

## Introduction

The SWFFill object allows you to transform (scale, skew, rotate) bitmap and gradient fills.

swffill objects are created by the SWFShape::addFill method.

## Class synopsis

SWFFill
class SWFFill {
/* Methods */
void moveTo ( float `$x` , float `$y` )
void rotateTo ( float `$angle` )
void scaleTo ( float `$x` [, float `$y` ] )
void skewXTo ( float `$x` )
void skewYTo ( float `$y` )
}

# The SWFFont class

## Introduction

The SWFFont object represent a reference to the font definition, for us with SWFText::setFont and SWFTextField::setFont.

## Class synopsis

SWFFont
class SWFFont {
/* Methods */
__construct ( string `$filename` )
float getAscent ( void )
float getDescent ( void )
float getLeading ( void )
string getShape ( int `$code` )
float getUTF8Width ( string `$string` )
float getWidth ( string `$string` )
}

# The SWFFontChar class

## Introduction

SWFFontChar.

## Class synopsis

SWFFontChar
class SWFFontChar {
/* Methods */
void addChars ( string `$char` )
void addUTF8Chars ( string `$char` )
}

# The SWFGradient class

## Introduction

SWFGradient.

## Class synopsis

SWFGradient
class SWFGradient {
/* Methods */
void addEntry ( float `$ratio` , int `$red` , int `$green` , int `$blue` [, int `$alpha` = 255 ] )
__construct ( void )
}

# The SWFMorph class

## Introduction

The methods here are sort of weird. It would make more sense to just have newSWFMorph(shape1, shape2);, but as things are now, shape2 needs to know that it's the second part of a morph. (This, because it starts writing its output as soon as it gets drawing commands- if it kept its own description of its shapes and wrote on completion this and some other things would be much easier.)

## Class synopsis

SWFMorph
class SWFMorph {
/* Methods */
__construct ( void )
SWFShape getShape1 ( void )
SWFShape getShape2 ( void )
}

# The SWFMovie class

## Introduction

SWFMovie is a movie object representing an SWF movie.

## Class synopsis

SWFMovie
class SWFMovie {
/* Methods */
mixed add ( object `$instance` )
void addExport ( SWFCharacter `$char` , string `$name` )
mixed addFont ( SWFFont `$font` )
__construct ([ int `$version` ] )
SWFSprite importChar ( string `$libswf` , string `$name` )
SWFFontChar importFont ( string `$libswf` , string `$name` )
void labelFrame ( string `$label` )
void nextFrame ( void )
int output ([ int `$compression` ] )
void remove ( object `$instance` )
int save ( string `$filename` [, int `$compression` = -1 ] )
int saveToFile ( resource `$x` [, int `$compression` = -1 ] )
void setbackground ( int `$red` , int `$green` , int `$blue` )
void setDimension ( float `$width` , float `$height` )
void setFrames ( int `$number` )
void setRate ( float `$rate` )
SWFSoundInstance startSound ( SWFSound `$sound` )
void stopSound ( SWFSound `$sound` )
int streamMP3 ( mixed `$mp3file` [, float `$skip` = 0 ] )
void writeExports ( void )
}

# The SWFPrebuiltClip class

## Introduction

SWFPrebuiltClip.

## Class synopsis

SWFPrebuiltClip
class SWFPrebuiltClip {
/* Methods */
__construct ( mixed `$file` )
}

# The SWFShape class

## Introduction

SWFShape.

## Class synopsis

SWFShape
class SWFShape {
/* Methods */
SWFFill addFill ( int `$red` , int `$green` , int `$blue` [, int `$alpha` = 255 ] )
__construct ( void )
void drawArc ( float `$r` , float `$startAngle` , float `$endAngle` )
void drawCircle ( float `$r` )
int drawCubic ( float `$bx` , float `$by` , float `$cx` , float `$cy` , float `$dx` , float `$dy` )
int drawCubicTo ( float `$bx` , float `$by` , float `$cx` , float `$cy` , float `$dx` , float `$dy` )
int drawCurve ( float `$controldx` , float `$controldy` , float `$anchordx` , float `$anchordy` [, float `$targetdx` ], float `$targetdy` )
int drawCurveTo ( float `$controlx` , float `$controly` , float `$anchorx` , float `$anchory` [, float `$targetx` ], float `$targety` )
void drawGlyph ( SWFFont `$font` , string `$character` [, int `$size` ] )
void drawLine ( float `$dx` , float `$dy` )
void drawLineTo ( float `$x` , float `$y` )
void movePen ( float `$dx` , float `$dy` )
void movePenTo ( float `$x` , float `$y` )
void setLeftFill ( SWFGradient `$fill` )
void setLine ( SWFShape `$shape` )
void setRightFill ( SWFGradient `$fill` )
}

# The SWFSound class

## Introduction

SWFSound.

## Class synopsis

SWFSound
class SWFSound {
/* Methods */
__construct ( string `$filename` [, int `$flags` = 0 ] )
}

# The SWFSoundInstance class

## Introduction

SWFSoundInstance objects are returned by the SWFSprite::startSound and SWFMovie::startSound methods.

## Class synopsis

SWFSoundInstance
class SWFSoundInstance {
/* Methods */
void loopCount ( int `$point` )
void loopInPoint ( int `$point` )
void loopOutPoint ( int `$point` )
void noMultiple ( void )
}

# The SWFSprite class

## Introduction

An SWFSprite is also known as a "movie clip", this allows one to create objects which are animated in their own timelines. Hence, the sprite has most of the same methods as the movie.

## Class synopsis

SWFSprite
class SWFSprite {
/* Methods */
void add ( object `$object` )
__construct ( void )
void labelFrame ( string `$label` )
void nextFrame ( void )
void remove ( object `$object` )
void setFrames ( int `$number` )
SWFSoundInstance startSound ( SWFSound `$sount` )
void stopSound ( SWFSound `$sount` )
}

# The SWFText class

## Introduction

SWFText.

## Class synopsis

SWFText
class SWFText {
/* Methods */
void addString ( string `$string` )
void addUTF8String ( string `$text` )
__construct ( void )
float getAscent ( void )
float getDescent ( void )
float getLeading ( void )
float getUTF8Width ( string `$string` )
float getWidth ( string `$string` )
void moveTo ( float `$x` , float `$y` )
void setColor ( int `$red` , int `$green` , int `$blue` [, int `$a` = 255 ] )
void setFont ( SWFFont `$font` )
void setHeight ( float `$height` )
void setSpacing ( float `$spacing` )
}

# The SWFTextField class

## Introduction

SWFTextField.

## Class synopsis

SWFTextField
class SWFTextField {
/* Methods */
void addChars ( string `$chars` )
void addString ( string `$string` )
void align ( int `$alignement` )
__construct ([ int `$flags` ] )
void setBounds ( float `$width` , float `$height` )
void setColor ( int `$red` , int `$green` , int `$blue` [, int `$a` = 255 ] )
void setFont ( SWFFont `$font` )
void setHeight ( float `$height` )
void setIndentation ( float `$width` )
void setLeftMargin ( float `$width` )
void setLineSpacing ( float `$height` )
void setMargins ( float `$left` , float `$right` )
void setName ( string `$name` )
void setPadding ( float `$padding` )
void setRightMargin ( float `$width` )
}

# The SWFVideoStream class

## Introduction

SWFVideoStream.

## Class synopsis

SWFVideoStream
class SWFVideoStream {
/* Methods */
__construct ([ string `$file` ] )
int getNumFrames ( void )
void setDimension ( int `$x` , int `$y` )
}