JavaScript Editor Javascript debugger     Website design 

Ming functions for Flash

Warning:

This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.

Introduction

First of all: Ming is not an acronym. Ming is an open-source (LGPL) library which allows you to create SWF ("Flash") format movies. Ming supports almost all of Flash 4's features, including: shapes, gradients, bitmaps (pngs and jpegs), morphs ("shape tweens"), text, buttons, actions, sprites ("movie clips"), streaming mp3, and color transforms --the only thing that's missing is sound events.

Note that all values specifying length, distance, size, etc. are in "twips", twenty units per pixel. That's pretty much arbitrary, though, since the player scales the movie to whatever pixel size is specified in the embed/object tag, or the entire frame if not embedded.

Ming offers a number of advantages over the existing PHP/libswf module. You can use Ming anywhere you can compile the code, whereas libswf is closed-source and only available for a few platforms, Windows not one of them. Ming provides some insulation from the mundane details of the SWF file format, wrapping the movie elements in PHP objects. Also, Ming is still being maintained; if there's a feature that you want to see, just let us know at » http://ming.sourceforge.net/.

Ming was added in PHP 4.0.5.

Requirements

To use Ming with PHP, you first need to build and install the Ming library. Source code and installation instructions are available at the Ming home page: » http://ming.sourceforge.net/ along with examples, a small tutorial, and the latest news.

Download the ming archive. Unpack the archive. Go in the Ming directory. make. make install.

This will build libming.so and install it into /usr/lib/, and copy ming.h into /usr/include/. Edit the PREFIX= line in the Makefile to change the installation directory.

Installation

Example 1331. built into PHP (Unix)



    mkdir <phpdir>/ext/ming
    cp php_ext/* <phpdir>/ext/ming
    cd <phpdir>
    ./buildconf 
    ./configure --with-ming <other config options>

    


Build and install PHP as usual, restart web server if necessary.

Now either just add extension=php_ming.so to your php.ini file, or put dl('php_ming.so'); at the head of all of your Ming scripts.

Runtime Configuration

This extension has no configuration directives defined in php.ini.

Resource Types

Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

MING_NEW (integer)
MING_ZLIB (integer)
SWFBUTTON_HIT (integer)
SWFBUTTON_DOWN (integer)
SWFBUTTON_OVER (integer)
SWFBUTTON_UP (integer)
SWFBUTTON_MOUSEUPOUTSIDE (integer)
SWFBUTTON_DRAGOVER (integer)
SWFBUTTON_DRAGOUT (integer)
SWFBUTTON_MOUSEUP (integer)
SWFBUTTON_MOUSEDOWN (integer)
SWFBUTTON_MOUSEOUT (integer)
SWFBUTTON_MOUSEOVER (integer)
SWFFILL_RADIAL_GRADIENT (integer)
SWFFILL_LINEAR_GRADIENT (integer)
SWFFILL_TILED_BITMAP (integer)
SWFFILL_CLIPPED_BITMAP (integer)
SWFTEXTFIELD_HASLENGTH (integer)
SWFTEXTFIELD_NOEDIT (integer)
SWFTEXTFIELD_PASSWORD (integer)
SWFTEXTFIELD_MULTILINE (integer)
SWFTEXTFIELD_WORDWRAP (integer)
SWFTEXTFIELD_DRAWBOX (integer)
SWFTEXTFIELD_NOSELECT (integer)
SWFTEXTFIELD_HTML (integer)
SWFTEXTFIELD_ALIGN_LEFT (integer)
SWFTEXTFIELD_ALIGN_RIGHT (integer)
SWFTEXTFIELD_ALIGN_CENTER (integer)
SWFTEXTFIELD_ALIGN_JUSTIFY (integer)
SWFACTION_ONLOAD (integer)
SWFACTION_ENTERFRAME (integer)
SWFACTION_UNLOAD (integer)
SWFACTION_MOUSEMOVE (integer)
SWFACTION_MOUSEDOWN (integer)
SWFACTION_MOUSEUP (integer)
SWFACTION_KEYDOWN (integer)
SWFACTION_KEYUP (integer)
SWFACTION_DATA (integer)

Predefined Classes

The classes below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

Table of Contents

SWFAction — SWFAction Class
SWFAction->__construct() — Creates a new SWFAction
SWFBitmap — SWFBitmap Class
SWFBitmap->__construct() — Loads Bitmap object
SWFBitmap->getHeight() — Returns the bitmap's height
SWFBitmap->getWidth() — Returns the bitmap's width
SWFButton — SWFButton Class
SWFButton->__construct() — Creates a new Button
SWFButton->addAction() — Adds an action
SWFButton->addASound() — Associates a sound with a button transition
SWFButton->addShape() — Adds a shape to a 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 — 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()
SWFDisplayItem->getX()
SWFDisplayItem->getXScale()
SWFDisplayItem->getXSkew()
SWFDisplayItem->getY()
SWFDisplayItem->getYScale()
SWFDisplayItem->getYSkew()
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 — 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 — 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 — SWFFontChar Class
SWFFontChar->addChars() — Adds characters to a font for exporting font
SWFFontChar->addUTF8Chars() — Adds characters to a font for exporting font
SWFGradient — SWFGradient Class
SWFGradient->__construct() — Creates a gradient object
SWFGradient->addEntry() — Adds an entry to the gradient list
SWFMorph — 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 — SWFMovie Class
SWFMovie->__construct() — Creates a new movie object, representing an SWF version 4 movie
SWFMovie->add() — Adds any type of data to a movie
SWFMovie->addExport()
SWFMovie->addFont()
SWFMovie->importChar()
SWFMovie->importFont()
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()
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()
SWFMovie->stopSound()
SWFMovie->streamMP3() — Streams a MP3 file
SWFMovie->writeExports()
SWFPrebuiltClip — SWFPrebuiltClip Class
SWFPrebuiltClip->__construct() — Returns a SWFPrebuiltClip object
SWFShape — SWFShape Class
SWFShape->__construct() — Creates a new shape object
SWFShape->addFill() — Adds a solid fill to the shape
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 — SWFSound Class
SWFSound — Returns a new SWFSound object from given file
SWFSoundInstance — SWFSoundInstance Class
SWFSoundInstance->loopCount()
SWFSoundInstance->loopInPoint()
SWFSoundInstance->loopOutPoint()
SWFSoundInstance->noMultiple()
SWFSprite — SWFSprite Class
SWFSprite->__construct() — Creates a movie clip (a sprite)
SWFSprite->add() — Adds an object to 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()
SWFSprite->stopSound()
SWFText — SWFText Class
SWFText->__construct() — Creates a new SWFText object
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->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 — SWFTextField Class
SWFTextField->__construct() — Creates a text field object
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->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 — SWFVideoStream Class
SWFVideoStream->__construct() — Returns a SWFVideoStream object
SWFVideoStream->getNumFrames()
SWFVideoStream->setDimension()
ming_keypress — Returns the action flag for keyPress(char)
ming_setcubicthreshold — Set cubic threshold
ming_setscale — Set scale
ming_setswfcompression — Sets the SWF output compression
ming_useconstants — Use constant pool
ming_useswfversion — Sets the SWF version