Ming (flash)

目录

简介

SWFAction.

类摘要

SWFAction

class SWFAction {

/* 方法 */

__construct ( string $script )

}

说明

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

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.

SWFAction::__construct

Creates a new SWFAction

说明

SWFAction::__construct ( string $script )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Creates a new SWFAction and compiles the given script in it.

参数

script
An ActionScript snippet to associate with the SWFAction. See SWFAction for more details.

简介

SWFBitmap.

类摘要

SWFBitmap

class SWFBitmap {

/* 方法 */

__construct ( mixed $file [, mixed $alphafile ] )

float getHeight ( void )

float getWidth ( void )

}

SWFBitmap::__construct

Loads Bitmap object

说明

SWFBitmap::__construct ( mixed $file [, mixed $alphafile ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Creates the new SWFBitmap object from the given file.

参数

For both parameters you can provide a file pointer returned by fopen or the image data, as a binary string.

file

Note:

We can only deal with baseline (frame 0) jpegs, no baseline optimized or progressive scan jpegs!

You can't import png images directly, though- have to use the png2dbl utility to make a dbl ("define bits lossless") file from the png. The reason for this is that I don't want a dependency on the png library in ming- autoconf should solve this, but that's not set up yet.

alphafile
An MSK file to be used as an alpha mask for a JPEG image.

范例

示例 #1 Importing a DBL file

<?php
$s = new SWFShape();
$f = $s->addFill(new SWFBitmap(file_get_contents("image.dbl")));
$s->setRightFill($f);

$s->drawLine(32, 0);
$s->drawLine(0, 32);
$s->drawLine(-32, 0);
$s->drawLine(0, -32);

$m = new SWFMovie();
$m->setDimension(32, 32);
$m->add($s);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

示例 #2 Using an alpha mask

<?php

$s = new SWFShape();

// .msk file generated with "gif2mask" utility
$f = $s->addFill(new SWFBitmap(file_get_contents("alphafill.jpg"), file_get_contents("alphafill.msk")));
$s->setRightFill($f);

$s->drawLine(640, 0);
$s->drawLine(0, 480);
$s->drawLine(-640, 0);
$s->drawLine(0, -480);

$c = new SWFShape();
$c->setRightFill($c->addFill(0x99, 0x99, 0x99));
$c->drawLine(40, 0);
$c->drawLine(0, 40);
$c->drawLine(-40, 0);
$c->drawLine(0, -40);

$m = new SWFMovie();
$m->setDimension(640, 480);
$m->setBackground(0xcc, 0xcc, 0xcc);

// draw checkerboard background
for ($y=0; $y<480; $y+=40) {
  for ($x=0; $x<640; $x+=80) {
    $i = $m->add($c);
    $i->moveTo($x, $y);
  }

  $y+=40;

  for ($x=40; $x<640; $x+=80) {
    $i = $m->add($c);
    $i->moveTo($x, $y);
  }
}

$m->add($s);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

SWFBitmap::getHeight

Returns the bitmap's height

说明

float SWFBitmap::getHeight ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Returns the bitmap's height.

返回值

Returns the bitmap height in pixels.

参见

  • SWFBitmap::getWidth

SWFBitmap::getWidth

Returns the bitmap's width

说明

float SWFBitmap::getWidth ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Returns the bitmap's width.

返回值

Returns the bitmap width in pixels.

参见

  • SWFBitmap::getHeight

简介

SWFButton.

类摘要

SWFButton

class SWFButton {

/* 方法 */

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 )

}

SWFButton::addAction

Adds an action

说明

void SWFButton::addAction ( SWFAction $action , int $flags )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Adds the given action to the button for the given conditions.

参数

action
An SWFAction, returned by SWFAction::__construct.

flags
The following flags are valid: SWFBUTTON_MOUSEOVER, SWFBUTTON_MOUSEOUT, SWFBUTTON_MOUSEUP, SWFBUTTON_MOUSEUPOUTSIDE, SWFBUTTON_MOUSEDOWN, SWFBUTTON_DRAGOUT and SWFBUTTON_DRAGOVER.

返回值

没有返回值。

参见

SWFButton::addASound

Associates a sound with a button transition

说明

SWFSoundInstance SWFButton::addASound ( SWFSound $sound , int $flags )

Warning

本函数还未编写文档,仅有参数列表。

SWFButton::addShape

Adds a shape to a button

说明

void SWFButton::addShape ( SWFShape $shape , int $flags )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Adds the given shape to the button.

参数

shape
An SWFShape instance

flags
The following flags are valid: SWFBUTTON_UP, SWFBUTTON_OVER, SWFBUTTON_DOWN and SWFBUTTON_HIT.

SWFBUTTON_HIT isn't ever displayed, it defines the hit region for the button. That is, everywhere the hit shape would be drawn is considered a "touchable" part of the button.

返回值

没有返回值。

SWFButton::__construct

Creates a new Button

说明

SWFButton::__construct ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Creates a new Button.

范例

This simple example will show your usual interactions with buttons : rollover, rollon, mouseup, mousedown, noaction.

示例 #1 Usual interactions with buttons

<?php

$f = new SWFFont("_serif");

$p = new SWFSprite();

function label($string) 
{
  global $f;

  $t = new SWFTextField();
  $t->setFont($f);
  $t->addString($string);
  $t->setHeight(200);
  $t->setBounds(3200, 200);
  return $t;
}

function addLabel($string) 
{
  global $p;

  $i = $p->add(label($string));
  $p->nextFrame();
  $p->remove($i);
}

$p->add(new SWFAction("stop();"));
addLabel("NO ACTION");
addLabel("SWFBUTTON_MOUSEUP");
addLabel("SWFBUTTON_MOUSEDOWN");
addLabel("SWFBUTTON_MOUSEOVER");
addLabel("SWFBUTTON_MOUSEOUT");
addLabel("SWFBUTTON_MOUSEUPOUTSIDE");
addLabel("SWFBUTTON_DRAGOVER");
addLabel("SWFBUTTON_DRAGOUT");

function rect($r, $g, $b) 
{
  $s = new SWFShape();
  $s->setRightFill($s->addFill($r, $g, $b));
  $s->drawLine(600, 0);
  $s->drawLine(0, 600);
  $s->drawLine(-600, 0);
  $s->drawLine(0, -600);

  return $s;
}

$b = new SWFButton();
$b->addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT);
$b->addShape(rect(0, 0xff, 0), SWFBUTTON_OVER);
$b->addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN);

$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"),
          SWFBUTTON_MOUSEUP);

$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"),
      SWFBUTTON_MOUSEDOWN);

$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"),
      SWFBUTTON_MOUSEOVER);

$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"),
      SWFBUTTON_MOUSEOUT);

$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"),
      SWFBUTTON_MOUSEUPOUTSIDE);

$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"),
      SWFBUTTON_DRAGOVER);

$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"),
      SWFBUTTON_DRAGOUT);

$m = new SWFMovie();
$m->setDimension(4000, 3000);

$i = $m->add($p);
$i->setName("label");
$i->moveTo(400, 1900);

$i = $m->add($b);
$i->moveTo(400, 900);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

This simple example will enables you to drag draw a big red button on the windows. No drag-and-drop, just moving around.

示例 #2 Drag example

<?php

$s = new SWFShape();
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->drawLine(1000,0);
$s->drawLine(0,1000);
$s->drawLine(-1000,0);
$s->drawLine(0,-1000);

$b = new SWFButton();
$b->addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);

$b->addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse
      SWFBUTTON_MOUSEDOWN);

$b->addAction(new SWFAction("stopDrag();"),
      SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE);

$p = new SWFSprite();
$p->add($b);
$p->nextFrame();

$m = new SWFMovie();
$i = $m->add($p);
$i->setName('test');
$i->moveTo(1000,1000);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

SWFButton::setAction

Sets the action

说明

void SWFButton::setAction ( SWFAction $action )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the action to be performed when the button is clicked.

This is a shortcut for SWFButton::addAction called with the SWFBUTTON_MOUSEUP flag.

参数

action
An SWFAction, returned by SWFAction::__construct.

返回值

没有返回值。

参见

SWFButton::setDown

Alias for addShape(shape, SWFBUTTON_DOWN)

说明

void SWFButton::setDown ( SWFShape $shape )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfbutton::setdown alias for addShape(shape, SWFBUTTON_DOWN).

返回值

没有返回值。

参见

SWFButton::setHit

Alias for addShape(shape, SWFBUTTON_HIT)

说明

void SWFButton::setHit ( SWFShape $shape )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfbutton::sethit alias for addShape(shape, SWFBUTTON_HIT).

返回值

没有返回值。

参见

SWFButton::setMenu

Enable track as menu button behaviour

说明

void SWFButton::setMenu ( int $flag )

Warning

本函数还未编写文档,仅有参数列表。

参数

flag
This parameter can be used for a slight different behavior of buttons. You can set it to 0 (off) or 1 (on).

返回值

没有返回值。

SWFButton::setOver

Alias for addShape(shape, SWFBUTTON_OVER)

说明

void SWFButton::setOver ( SWFShape $shape )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfbutton::setover alias for addShape(shape, SWFBUTTON_OVER).

返回值

没有返回值。

参见

SWFButton::setUp

Alias for addShape(shape, SWFBUTTON_UP)

说明

void SWFButton::setUp ( SWFShape $shape )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfbutton::setup alias for addShape(shape, SWFBUTTON_UP).

返回值

没有返回值。

参见

简介

SWFDisplayItem.

类摘要

SWFDisplayItem

class SWFDisplayItem {

/* 方法 */

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 )

}

SWFDisplayItem::addAction

Adds this SWFAction to the given SWFSprite instance

说明

void SWFDisplayItem::addAction ( SWFAction $action , int $flags )

Warning

本函数还未编写文档,仅有参数列表。

参数

action
An SWFAction, returned by SWFAction::__construct.

flags

返回值

没有返回值。

参见

SWFDisplayItem::addColor

Adds the given color to this item's color transform

说明

void SWFDisplayItem::addColor ( int $red , int $green , int $blue [, int $a ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::addcolor adds the color to this item's color transform. The color is given in its RGB form.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

返回值

没有返回值。

SWFDisplayItem::endMask

Another way of defining a MASK layer

说明

void SWFDisplayItem::endMask ( void )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFDisplayItem::getRot

说明

float SWFDisplayItem::getRot ( void )

Warning

本函数还未编写文档,仅有参数列表。

SWFDisplayItem::getX

说明

float SWFDisplayItem::getX ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFDisplayItem::getY

SWFDisplayItem::getXScale

说明

float SWFDisplayItem::getXScale ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFDisplayItem::getYScale

SWFDisplayItem::getXSkew

说明

float SWFDisplayItem::getXSkew ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFDisplayItem::getYSkew

SWFDisplayItem::getY

说明

float SWFDisplayItem::getY ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFDisplayItem::getX

SWFDisplayItem::getYScale

说明

float SWFDisplayItem::getYScale ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFDisplayItem::getXScale

SWFDisplayItem::getYSkew

说明

float SWFDisplayItem::getYSkew ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFDisplayItem::getXSkew

SWFDisplayItem::move

Moves object in relative coordinates

说明

void SWFDisplayItem::move ( float $dx , float $dy )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::move moves the current object by (dx,dy) from its current position.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::moveTo

SWFDisplayItem::moveTo

Moves object in global coordinates

说明

void SWFDisplayItem::moveTo ( float $x , float $y )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::moveto moves the current object to (x,y) in global coordinates.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::move

SWFDisplayItem::multColor

Multiplies the item's color transform

说明

void SWFDisplayItem::multColor ( float $red , float $green , float $blue [, float $a ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::multcolor multiplies the item's color transform by the given values.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

参数

These parameters are floats between 0.0 and 1.0:

red
Value of red component

green
Value of green component

blue
Value of blue component

a
Value of alpha component

返回值

没有返回值。

范例

This simple example will modify your picture's atmosphere to Halloween (use a landscape or bright picture).

示例 #1 swfdisplayitem::multcolor example

<?php

$b = new SWFBitmap(file_get_contents("backyard.jpg"));
// note use your own picture :-)
$s = new SWFShape();
$s->setRightFill($s->addFill($b));
$s->drawLine($b->getWidth(), 0);
$s->drawLine(0, $b->getHeight());
$s->drawLine(-$b->getWidth(), 0);
$s->drawLine(0, -$b->getHeight());

$m = new SWFMovie();
$m->setDimension($b->getWidth(), $b->getHeight());

$i = $m->add($s);

for ($n=0; $n<=20; ++$n) {
  $i->multColor(1.0-$n/10, 1.0, 1.0);
  $i->addColor(0xff*$n/20, 0, 0);
  $m->nextFrame();
}

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

SWFDisplayItem::remove

Removes the object from the movie

说明

void SWFDisplayItem::remove ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::remove removes this object from the movie's display list.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFMovie::add

SWFDisplayItem::rotate

Rotates in relative coordinates

说明

void SWFDisplayItem::rotate ( float $angle )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::rotate rotates the current object by angle degrees from its current rotation.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::rotateTo

SWFDisplayItem::rotateTo

Rotates the object in global coordinates

说明

void SWFDisplayItem::rotateTo ( float $angle )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::rotateto set the current object rotation to angle degrees in global coordinates.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

范例

This example bring three rotating string from the background to the foreground. Pretty nice.

示例 #1 swfdisplayitem::rotateto example

<?php
$thetext =  "ming!";

$f = new SWFFont("Bauhaus 93.fdb");

$m = new SWFMovie();
$m->setRate(24.0);
$m->setDimension(2400, 1600);
$m->setBackground(0xff, 0xff, 0xff);

// functions with huge numbers of arbitrary
// arguments are always a good idea!  Really!

function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string) 
{
  global $f, $m;

  $t = new SWFText();
  $t->setFont($f);
  $t->setColor($r, $g, $b, $a);
  $t->setHeight(960);
  $t->moveTo(-($f->getWidth($string))/2, $f->getAscent()/2);
  $t->addString($string);

  // we can add properties just like a normal PHP var,
  // as long as the names aren't already used.
  // e.g., we can't set $i->scale, because that's a function

  $i = $m->add($t);
  $i->x = $x;
  $i->y = $y;
  $i->rot = $rot;
  $i->s = $scale;
  $i->rotateTo($rot);
  $i->scale($scale, $scale);

  // but the changes are local to the function, so we have to
  // return the changed object.  kinda weird..

  return $i;
}

function step($i) 
{
  $oldrot = $i->rot;
  $i->rot = 19*$i->rot/20;
  $i->x = (19*$i->x + 1200)/20;
  $i->y = (19*$i->y + 800)/20;
  $i->s = (19*$i->s + 1.0)/20;

  $i->rotateTo($i->rot);
  $i->scaleTo($i->s, $i->s);
  $i->moveTo($i->x, $i->y);

  return $i;
}

// see?  it sure paid off in legibility:

$i1 = text(0xff, 0x33, 0x33, 0xff, 900, 1200, 800, 0.03, $thetext);
$i2 = text(0x00, 0x33, 0xff, 0x7f, -560, 1200, 800, 0.04, $thetext);
$i3 = text(0xff, 0xff, 0xff, 0x9f, 180, 1200, 800, 0.001, $thetext);

for ($i=1; $i<=100; ++$i) {
  $i1 = step($i1);
  $i2 = step($i2);
  $i3 = step($i3);

  $m->nextFrame();
}

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

参见

  • SWFDisplayItem::rotate

SWFDisplayItem::scale

Scales the object in relative coordinates

说明

void SWFDisplayItem::scale ( float $dx , float $dy )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::scale scales the current object by (dx,dy) from its current size.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::scaleTo

SWFDisplayItem::scaleTo

Scales the object in global coordinates

说明

void SWFDisplayItem::scaleTo ( float $x [, float $y ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::scaleto scales the current object to (x,y) in global coordinates.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::scale

SWFDisplayItem::setDepth

Sets z-order

说明

void SWFDisplayItem::setDepth ( int $depth )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::setdepth sets the object's z-order to depth. Depth defaults to the order in which instances are created (by adding a shape/text to a movie)- newer ones are on top of older ones. If two objects are given the same depth, only the later-defined one can be moved.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

SWFDisplayItem::setMaskLevel

Defines a MASK layer at level

说明

void SWFDisplayItem::setMaskLevel ( int $level )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFDisplayItem::setMatrix

Sets the item's transform matrix

说明

void SWFDisplayItem::setMatrix ( float $a , float $b , float $c , float $d , float $x , float $y )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFDisplayItem::setName

Sets the object's name

说明

void SWFDisplayItem::setName ( string $name )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::setname sets the object's name to name, for targetting with action script. Only useful on sprites.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

SWFDisplayItem::setRatio

Sets the object's ratio

说明

void SWFDisplayItem::setRatio ( float $ratio )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::setratio sets the object's ratio to ratio. Obviously only useful for morphs.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

范例

This simple example will morph nicely three concentric circles.

示例 #1 swfdisplayitem::setname example

<?php

$p = new SWFMorph();

$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(0.16, 0xff, 0xff, 0xff);
$g->addEntry(0.32, 0, 0, 0);
$g->addEntry(0.48, 0xff, 0xff, 0xff);
$g->addEntry(0.64, 0, 0, 0);
$g->addEntry(0.80, 0xff, 0xff, 0xff);
$g->addEntry(1.00, 0, 0, 0);

$s = $p->getShape1();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.05);
$s->setLeftFill($f);
$s->movePenTo(-160, -120);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);

$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(0.16, 0xff, 0, 0);
$g->addEntry(0.32, 0, 0, 0);
$g->addEntry(0.48, 0, 0xff, 0);
$g->addEntry(0.64, 0, 0, 0);
$g->addEntry(0.80, 0, 0, 0xff);
$g->addEntry(1.00, 0, 0, 0);

$s = $p->getShape2();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.05);
$f->skewXTo(1.0);
$s->setLeftFill($f);
$s->movePenTo(-160, -120);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);

$m = new SWFMovie();
$m->setDimension(320, 240);
$i = $m->add($p);
$i->moveTo(160, 120);

for ($n=0; $n<=1.001; $n+=0.01) {
    $i->setRatio($n);
    $m->nextFrame();
}

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

SWFDisplayItem::skewX

Sets the X-skew

说明

void SWFDisplayItem::skewX ( float $ddegrees )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::skewx adds ddegrees to current x-skew.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::skewXTo
  • SWFDisplayItem::skewY
  • SWFDisplayItem::skewYTo

SWFDisplayItem::skewXTo

Sets the X-skew

说明

void SWFDisplayItem::skewXTo ( float $degrees )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::skewxto sets the x-skew to degrees. For degrees is 1.0, it means a 45-degree forward slant. More is more forward, less is more backward.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::skewX
  • SWFDisplayItem::skewY
  • SWFDisplayItem::skewYTo

SWFDisplayItem::skewY

Sets the Y-skew

说明

void SWFDisplayItem::skewY ( float $ddegrees )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::skewy adds ddegrees to current y-skew.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::skewYTo
  • SWFDisplayItem::skewX
  • SWFDisplayItem::skewXTo

SWFDisplayItem::skewYTo

Sets the Y-skew

说明

void SWFDisplayItem::skewYTo ( float $degrees )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfdisplayitem::skewyto sets the y-skew to degrees. For degrees is 1.0, it means a 45-degree forward slant. More is more upward, less is more downward.

The object may be a swfshape, a swfbutton, a swftext or a swfsprite object. It must have been added using the swfmovie::add.

返回值

没有返回值。

参见

  • SWFDisplayItem::skewY
  • SWFDisplayItem::skewX
  • SWFDisplayItem::skewXTo

简介

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

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

类摘要

SWFFill

class SWFFill {

/* 方法 */

void moveTo ( float $x , float $y )

void rotateTo ( float $angle )

void scaleTo ( float $x [, float $y ] )

void skewXTo ( float $x )

void skewYTo ( float $y )

}

SWFFill::moveTo

Moves fill origin

说明

void SWFFill::moveTo ( float $x , float $y )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Moves the fill origin to the given global coordinates.

参数

x
X-coordinate

y
Y-coordinate

返回值

没有返回值。

SWFFill::rotateTo

Sets fill's rotation

说明

void SWFFill::rotateTo ( float $angle )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the fill rotation to the given angle.

参数

angle
The rotation angle, in degrees.

返回值

没有返回值。

SWFFill::scaleTo

Sets fill's scale

说明

void SWFFill::scaleTo ( float $x [, float $y ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the fill scale to the given coordinates.

参数

x
X-coordinate

y
Y-coordinate

返回值

没有返回值。

SWFFill::skewXTo

Sets fill x-skew

说明

void SWFFill::skewXTo ( float $x )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the fill x-skew to x.

参数

x
When x is 1.0, it is a 45-degree forward slant. More is more forward, less is more backward.

返回值

没有返回值。

参见

  • SWFFill::skewYTo

SWFFill::skewYTo

Sets fill y-skew

说明

void SWFFill::skewYTo ( float $y )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the fill y-skew to y.

参数

y
When y is 1.0, it is a 45-degree upward slant. More is more upward, less is more downward.

返回值

没有返回值。

参见

  • SWFFill::skewXTo

简介

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

类摘要

SWFFont

class SWFFont {

/* 方法 */

__construct ( string $filename )

float getAscent ( void )

float getDescent ( void )

float getLeading ( void )

string getShape ( int $code )

float getUTF8Width ( string $string )

float getWidth ( string $string )

}

SWFFont::__construct

Loads a font definition

说明

SWFFont::__construct ( string $filename )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

If filename is the name of an FDB file (i.e., it ends in ".fdb"), load the font definition found in said file. Otherwise, create a browser-defined font reference.

FDB ("font definition block") is a very simple wrapper for the SWF DefineFont2 block which contains a full description of a font. One may create FDB files from SWT Generator template files with the included makefdb utility- look in the util directory off the main ming distribution directory.

Browser-defined fonts don't contain any information about the font other than its name. It is assumed that the font definition will be provided by the movie player. The fonts _serif, _sans, and _typewriter should always be available. For example:

<?php
$f = newSWFFont("_sans"); 
?>

will give you the standard sans-serif font, probably the same as what you'd get with <font name="sans-serif"> in HTML.

SWFFont::getAscent

Returns the ascent of the font, or 0 if not available

说明

float SWFFont::getAscent ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFFont::getDescent

SWFFont::getDescent

Returns the descent of the font, or 0 if not available

说明

float SWFFont::getDescent ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFFont::getAscent

SWFFont::getLeading

Returns the leading of the font, or 0 if not available

说明

float SWFFont::getLeading ( void )

Warning

本函数还未编写文档,仅有参数列表。

SWFFont::getShape

Returns the glyph shape of a char as a text string

说明

string SWFFont::getShape ( int $code )

Warning

本函数还未编写文档,仅有参数列表。

SWFFont::getUTF8Width

Calculates the width of the given string in this font at full height

说明

float SWFFont::getUTF8Width ( string $string )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFFont::getWidth

SWFFont::getWidth

Returns the string's width

说明

float SWFFont::getWidth ( string $string )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swffont::getwidth returns the string string's width, using font's default scaling. You'll probably want to use the swftext version of this method which uses the text object's scale.

参见

  • SWFFont::getUTF8Width

简介

SWFFontChar.

类摘要

SWFFontChar

class SWFFontChar {

/* 方法 */

void addChars ( string $char )

void addUTF8Chars ( string $char )

}

SWFFontChar::addChars

Adds characters to a font for exporting font

说明

void SWFFontChar::addChars ( string $char )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

参见

  • SWFFontChar::addUTF8Chars

SWFFontChar::addUTF8Chars

Adds characters to a font for exporting font

说明

void SWFFontChar::addUTF8Chars ( string $char )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

参见

  • SWFFontChar::addChars

简介

SWFGradient.

类摘要

SWFGradient

class SWFGradient {

/* 方法 */

void addEntry ( float $ratio , int $red , int $green , int $blue [, int $alpha = 255 ] )

__construct ( void )

}

SWFGradient::addEntry

Adds an entry to the gradient list

说明

void SWFGradient::addEntry ( float $ratio , int $red , int $green , int $blue [, int $alpha = 255 ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfgradient::addentry adds an entry to the gradient list. ratio is a number between 0 and 1 indicating where in the gradient this color appears. Thou shalt add entries in order of increasing ratio.

red, green, blue is a color (RGB mode).

返回值

没有返回值。

SWFGradient::__construct

Creates a gradient object

说明

SWFGradient::__construct ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfgradient creates a new SWFGradient object.

After you've added the entries to your gradient, you can use the gradient in a shape fill with the swfshape::addfill method.

SWFGradient has the following methods : swfgradient::addentry.

This simple example will draw a big black-to-white gradient as background, and a reddish disc in its center.

示例 #1 swfgradient example

<?php

  $m = new SWFMovie();
  $m->setDimension(320, 240);

  $s = new SWFShape();

  // first gradient- black to white
  $g = new SWFGradient();
  $g->addEntry(0.0, 0, 0, 0);
  $g->addEntry(1.0, 0xff, 0xff, 0xff);

  $f = $s->addFill($g, SWFFILL_LINEAR_GRADIENT);
  $f->scaleTo(0.01);
  $f->moveTo(160, 120);
  $s->setRightFill($f);
  $s->drawLine(320, 0);
  $s->drawLine(0, 240);
  $s->drawLine(-320, 0);
  $s->drawLine(0, -240);

  $m->add($s);

  $s = new SWFShape();

  // second gradient- radial gradient from red to transparent
  $g = new SWFGradient();
  $g->addEntry(0.0, 0xff, 0, 0, 0xff);
  $g->addEntry(1.0, 0xff, 0, 0, 0);

  $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
  $f->scaleTo(0.005);
  $f->moveTo(160, 120);
  $s->setRightFill($f);
  $s->drawLine(320, 0);
  $s->drawLine(0, 240);
  $s->drawLine(-320, 0);
  $s->drawLine(0, -240);

  $m->add($s);

  header('Content-type: application/x-shockwave-flash');
  $m->output();
?>

简介

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.)

类摘要

SWFMorph

class SWFMorph {

/* 方法 */

__construct ( void )

SWFShape getShape1 ( void )

SWFShape getShape2 ( void )

}

SWFMorph::__construct

Creates a new SWFMorph object

说明

SWFMorph::__construct ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Creates a new SWFMorph object.

Also called a "shape tween". This thing lets you make those tacky twisting things that make your computer choke. Oh, joy!

范例

This simple example will morph a big red square into a smaller blue black-bordered square.

示例 #1 swfmorph example

<?php
  $p = new SWFMorph();

  $s = $p->getShape1();
  $s->setLine(0, 0, 0, 0);

  /* Note that this is backwards from normal shapes (left instead of right).
     I have no idea why, but this seems to work.. */

  $s->setLeftFill($s->addFill(0xff, 0, 0));
  $s->movePenTo(-1000,-1000);
  $s->drawLine(2000,0);
  $s->drawLine(0,2000);
  $s->drawLine(-2000,0);
  $s->drawLine(0,-2000);

  $s = $p->getShape2();
  $s->setLine(60,0,0,0);
  $s->setLeftFill($s->addFill(0, 0, 0xff));
  $s->movePenTo(0,-1000);
  $s->drawLine(1000,1000);
  $s->drawLine(-1000,1000);
  $s->drawLine(-1000,-1000);
  $s->drawLine(1000,-1000);

  $m = new SWFMovie();
  $m->setDimension(3000,2000);
  $m->setBackground(0xff, 0xff, 0xff);

  $i = $m->add($p);
  $i->moveTo(1500,1000);

  for ($r=0.0; $r<=1.0; $r+=0.1) {
    $i->setRatio($r);
    $m->nextFrame();
  }

  header('Content-type: application/x-shockwave-flash');
  $m->output();
?>

SWFMorph::getShape1

Gets a handle to the starting shape

说明

SWFShape SWFMorph::getShape1 ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Gets the morph's starting shape.

返回值

Returns a SWFShape object.

参见

  • SWFMorph::getShape2

SWFMorph::getShape2

Gets a handle to the ending shape

说明

SWFShape SWFMorph::getShape2 ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Gets the morph's ending shape.

返回值

Returns a SWFShape object.

参见

  • SWFMorph::getShape1

简介

SWFMovie is a movie object representing an SWF movie.

类摘要

SWFMovie

class SWFMovie {

/* 方法 */

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 )

}

SWFMovie::add

Adds any type of data to a movie

说明

mixed SWFMovie::add ( object $instance )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Adds an SWF object instance to the current movie.

参数

instance
Any type of object instance, like SWFShape, SWFText, SWFFont.

返回值

For displayable types (shape, text, button, sprite), this returns an SWFDisplayItem, a handle to the object in a display list. Thus, you can add the same shape to a movie multiple times and get separate handles back for each separate instance.

参见

  • SWFMovie::remove

SWFMovie::addExport

说明

void SWFMovie::addExport ( SWFCharacter $char , string $name )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFMovie::addFont

说明

mixed SWFMovie::addFont ( SWFFont $font )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFMovie::__construct

Creates a new movie object, representing an SWF version 4 movie

说明

SWFMovie::__construct ([ int $version ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Creates a new movie object, representing an SWF movie.

参数

version
The desired SWF version. Default is 4.

SWFMovie::importChar

说明

SWFSprite SWFMovie::importChar ( string $libswf , string $name )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFMovie::importFont

SWFMovie::importFont

说明

SWFFontChar SWFMovie::importFont ( string $libswf , string $name )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFMovie::importChar

SWFMovie::labelFrame

Labels a frame

说明

void SWFMovie::labelFrame ( string $label )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFMovie::nextFrame

Moves to the next frame of the animation

说明

void SWFMovie::nextFrame ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Moves to the next frame of the animation.

返回值

没有返回值。

SWFMovie::output

Dumps your lovingly prepared movie out

说明

int SWFMovie::output ([ int $compression ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Dumps the SWFMovie.

Don't forget to send the Content-Type HTTP header file before using this function, in order to display the movie in a browser.

参数

compression
The compression level can be a value between 0 and 9, defining the SWF compression similar to gzip compression.

This parameter is only available as of Flash MX (6).

返回值

Return the number of bytes written or FALSE on error.

范例

示例 #1 Displaying your $movie in a browser

<?php
header('Content-type: application/x-shockwave-flash'); 
$movie->output();
?>

参见

  • SWFMovie::save
  • SWFMovie::saveToFile

SWFMovie::remove

Removes the object instance from the display list

说明

void SWFMovie::remove ( object $instance )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Removes the given object instance from the display list.

返回值

没有返回值。

参见

  • SWFMovie::add

SWFMovie::save

Saves the SWF movie in a file

说明

int SWFMovie::save ( string $filename [, int $compression = -1 ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Saves the SWF movie to the specified filename.

参数

filename
The path to the saved SWF document.

compression
The compression level can be a value between 0 and 9, defining the SWF compression similar to gzip compression.

This parameter is only available as of Flash MX (6).

返回值

Return the number of bytes written or FALSE on error.

参见

  • SWFMovie::output
  • SWFMovie::saveToFile

SWFMovie::saveToFile

说明

int SWFMovie::saveToFile ( resource $x [, int $compression = -1 ] )

Warning

本函数还未编写文档,仅有参数列表。

参数

X

compression
The compression level can be a value between 0 and 9, defining the SWF compression similar to gzip compression.

This parameter is only available as of Flash MX (6).

返回值

Return the number of bytes written or FALSE on error.

参见

  • SWFMovie::output
  • SWFMovie::save

SWFMovie::setbackground

Sets the background color

说明

void SWFMovie::setbackground ( int $red , int $green , int $blue )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the background color.

Why is there no rgba version? Think about it, you might want to let the HTML background show through. There's a way to do that, but it only works on IE4. Search the » http://www.macromedia.com/ site for details.

参数

These parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF:

red
Value of red component

green
Value of green component

blue
Value of blue component

返回值

没有返回值。

SWFMovie::setDimension

Sets the movie's width and height

说明

void SWFMovie::setDimension ( float $width , float $height )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the movie's dimension to the specified width and height.

参数

width
The movie width.

height
The movie height.

返回值

没有返回值。

SWFMovie::setFrames

Sets the total number of frames in the animation

说明

void SWFMovie::setFrames ( int $number )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the total number of frames in the animation to the given number.

参数

number
The number of frames.

返回值

没有返回值。

SWFMovie::setRate

Sets the animation's frame rate

说明

void SWFMovie::setRate ( float $rate )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Sets the frame rate to the specified rate.

Animation will slow down if the player can't render frames fast enough- unless there's a streaming sound, in which case display frames are sacrificed to keep sound from skipping.

参数

rate
The frame rate, in frame per seconds.

返回值

没有返回值。

SWFMovie::startSound

说明

SWFSoundInstance SWFMovie::startSound ( SWFSound $sound )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFMovie::stopSound

SWFMovie::stopSound

说明

void SWFMovie::stopSound ( SWFSound $sound )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

参见

  • SWFMovie::startSound

SWFMovie::streamMP3

Streams a MP3 file

说明

int SWFMovie::streamMP3 ( mixed $mp3file [, float $skip = 0 ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Streams the given MP3 file mp3file.

This method is not very robust in dealing with oddities (can skip over an initial ID3 tag, but that's about it).

Note that the movie isn't smart enough to put enough frames in to contain the entire mp3 stream- you'll have to add (length of song * frames per second) frames to get the entire stream in.

参数

mp3file
Can be a file pointer returned by fopen or the MP3 data, as a binary string.

skip
Number of seconds to skip.

返回值

Return number of frames.

更新日志

版本说明
5.2.0skip added

范例

示例 #1 Streaming example

<?php
$m = new SWFMovie();
$m->setRate(12.0);
$m->streamMp3(file_get_contents("distortobass.mp3"));
// use your own MP3

// The file is 11.85 seconds at 12.0 fps = 142 frames
$m->setFrames(142);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

SWFMovie::writeExports

说明

void SWFMovie::writeExports ( void )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

简介

SWFPrebuiltClip.

类摘要

SWFPrebuiltClip

class SWFPrebuiltClip {

/* 方法 */

__construct ( mixed $file )

}

SWFPrebuiltClip::__construct

Returns a SWFPrebuiltClip object

说明

SWFPrebuiltClip::__construct ( mixed $file )

Warning

本函数还未编写文档,仅有参数列表。

简介

SWFShape.

类摘要

SWFShape

class SWFShape {

/* 方法 */

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 )

}

SWFShape::addFill

Adds a solid fill to the shape

说明

SWFFill SWFShape::addFill ( int $red , int $green , int $blue [, int $alpha = 255 ] )

SWFFill addFill ( SWFBitmap $bitmap [, int $flags ] )

SWFFill addFill ( SWFGradient $gradient [, int $flags ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

SWFShape::addFill adds a solid fill to the shape's list of fill styles. SWFShape::addFill accepts three different types of arguments.

red, green, blue is a color (RGB mode).

The bitmap argument is an SWFBitmap object. The flags argument can be one of the following values: SWFFILL_CLIPPED_BITMAP, SWFFILL_TILED_BITMAP, SWFFILL_LINEAR_GRADIENT or SWFFILL_RADIAL_GRADIENT. Default is SWFFILL_TILED_BITMAP for SWFBitmap and SWFFILL_LINEAR_GRADIENT for SWFGradient.

The gradient argument is an SWFGradient object. The flags argument can be one of the following values : SWFFILL_RADIAL_GRADIENT or SWFFILL_LINEAR_GRADIENT. Default is SWFFILL_LINEAR_GRADIENT. I'm sure about this one. Really.

SWFShape::addFill returns an SWFFill object for use with the SWFShape::setLeftFill and SWFShape::setRightFill functions described below.

范例

This simple example will draw a frame on a bitmap. Ah, here's another buglet in the flash player- it doesn't seem to care about the second shape's bitmap's transformation in a morph. According to spec, the bitmap should stretch along with the shape in this example..

示例 #1 SWFShape::addFill example

<?php

$p = new SWFMorph();

$b = new SWFBitmap(file_get_contents("alphafill.jpg"));
// use your own bitmap
$width = $b->getWidth();
$height = $b->getHeight();

$s = $p->getShape1();
$f = $s->addFill($b, SWFFILL_TILED_BITMAP);
$f->moveTo(-$width/2, -$height/4);
$f->scaleTo(1.0, 0.5);
$s->setLeftFill($f);
$s->movePenTo(-$width/2, -$height/4);
$s->drawLine($width, 0);
$s->drawLine(0, $height/2);
$s->drawLine(-$width, 0);
$s->drawLine(0, -$height/2);

$s = $p->getShape2();
$f = $s->addFill($b, SWFFILL_TILED_BITMAP);

// these two have no effect!
$f->moveTo(-$width/4, -$height/2);
$f->scaleTo(0.5, 1.0);

$s->setLeftFill($f);
$s->movePenTo(-$width/4, -$height/2);
$s->drawLine($width/2, 0);
$s->drawLine(0, $height);
$s->drawLine(-$width/2, 0);
$s->drawLine(0, -$height);

$m = new SWFMovie();
$m->setDimension($width, $height);
$i = $m->add($p);
$i->moveTo($width/2, $height/2);

for ($n=0; $n<1.001; $n+=0.03) {
    $i->setRatio($n);
    $m->nextFrame();
}

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

参见

  • SWFShape::setLeftFill
  • SWFShape::setRightFill

SWFShape::__construct

Creates a new shape object

说明

SWFShape::__construct ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Created a new SWFShape object.

范例

This simple example will draw a big red elliptic quadrant.

示例 #1 swfshape example

<?php
$s = new SWFShape();
$s->setLine(40, 0x7f, 0, 0);
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->movePenTo(200, 200);
$s->drawLineTo(6200, 200);
$s->drawLineTo(6200, 4600);
$s->drawCurveTo(200, 4600, 200, 200);

$m = new SWFMovie();
$m->setDimension(6400, 4800);
$m->setRate(12.0);
$m->add($s);
$m->nextFrame();

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

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

说明

void SWFShape::drawArc ( float $r , float $startAngle , float $endAngle )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

参见

  • SWFShape::drawCircle

SWFShape::drawCircle

Draws a circle of radius r centered at the current location, in a counter-clockwise fashion

说明

void SWFShape::drawCircle ( float $r )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFShape::drawCubic

Draws a cubic bezier curve using the current position and the three given points as control points

说明

int SWFShape::drawCubic ( float $bx , float $by , float $cx , float $cy , float $dx , float $dy )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFShape::drawCubicTo

SWFShape::drawCubicTo

Draws a cubic bezier curve using the current position and the three given points as control points

说明

int SWFShape::drawCubicTo ( float $bx , float $by , float $cx , float $cy , float $dx , float $dy )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFShape::drawCubic

SWFShape::drawCurve

Draws a curve (relative)

说明

int SWFShape::drawCurve ( float $controldx , float $controldy , float $anchordx , float $anchordy [, float $targetdx ], float $targetdy )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfshape::drawcurve draws a quadratic curve (using the current line style,set by swfshape::setline) from the current pen position to the relative position (anchorx,anchory) using relative control point (controlx,controly). That is, head towards the control point, then smoothly turn to the anchor point.

With 6 parameters, it draws a cubic bezier to point (x+targetdx, x+targetdy) with control points (x+controldx, y+controldy) and (x+anchordx, y+anchordy).

参见

  • SWFShape::drawCurve

SWFShape::drawCurveTo

Draws a curve

说明

int SWFShape::drawCurveTo ( float $controlx , float $controly , float $anchorx , float $anchory [, float $targetx ], float $targety )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfshape::drawcurveto draws a quadratic curve (using the current line style, set by swfshape::setline) from the current pen position to (anchorx,anchory) using (controlx,controly) as a control point. That is, head towards the control point, then smoothly turn to the anchor point.

With 6 parameters, it draws a cubic bezier to point (targetx, targety) with control points (controlx, controly) and (anchorx, anchory).

参见

  • SWFShape::drawCurveTo

SWFShape::drawGlyph

Draws the first character in the given string into the shape using the glyph definition from the given font

说明

void SWFShape::drawGlyph ( SWFFont $font , string $character [, int $size ] )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFShape::drawLine

Draws a line (relative)

说明

void SWFShape::drawLine ( float $dx , float $dy )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfshape::drawline draws a line (using the current line style set by swfshape::setline) from the current pen position to displacement (dx,dy).

返回值

没有返回值。

参见

  • SWFShape::drawLineTo

SWFShape::drawLineTo

Draws a line

说明

void SWFShape::drawLineTo ( float $x , float $y )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfshape::setrightfill draws a line (using the current line style, set by swfshape::setline) from the current pen position to point (x,y) in the shape's coordinate space.

返回值

没有返回值。

参见

  • SWFShape::drawLine

SWFShape::movePen

Moves the shape's pen (relative)

说明

void SWFShape::movePen ( float $dx , float $dy )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfshape::setrightfill move the shape's pen from coordinates (current x,current y) to (current x + dx, current y + dy) in the shape's coordinate space.

返回值

没有返回值。

参见

  • SWFShape::movePenTo

SWFShape::movePenTo

Moves the shape's pen

说明

void SWFShape::movePenTo ( float $x , float $y )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfshape::setrightfill move the shape's pen to (x,y) in the shape's coordinate space.

返回值

没有返回值。

参见

  • SWFShape::movePen

SWFShape::setLeftFill

Sets left rasterizing color

说明

void SWFShape::setLeftFill ( SWFGradient $fill )

void setLeftFill ( int $red , int $green , int $blue [, int $a ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

What this nonsense is about is, every edge segment borders at most two fills. When rasterizing the object, it's pretty handy to know what those fills are ahead of time, so the swf format requires these to be specified.

swfshape::setleftfill sets the fill on the left side of the edge- that is, on the interior if you're defining the outline of the shape in a counter-clockwise fashion. The fill object is an SWFFill object returned from one of the addFill functions above.

This seems to be reversed when you're defining a shape in a morph, though. If your browser crashes, just try setting the fill on the other side.

Shortcut for $swfshape->setleftfill($s->addfill($r, $g, $b [, $a]));.

返回值

没有返回值。

参见

  • SWFShape::setRightFill

SWFShape::setLine

Sets the shape's line style

说明

void SWFShape::setLine ( SWFShape $shape )

void setLine ( int $width , int $red , int $green , int $blue [, int $a ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfshape::setline sets the shape's line style. width is the line's width. If width is 0, the line's style is removed (then, all other arguments are ignored). If width > 0, then line's color is set to red, green, blue. Last parameter a is optional.

You must declare all line styles before you use them (see example).

返回值

没有返回值。

范例

This simple example will draw a big "!#%*@", in funny colors and gracious style.

示例 #1 swfshape::setline example

<?php
$s = new SWFShape();
$f1 = $s->addFill(0xff, 0, 0);
$f2 = $s->addFill(0xff, 0x7f, 0);
$f3 = $s->addFill(0xff, 0xff, 0);
$f4 = $s->addFill(0, 0xff, 0);
$f5 = $s->addFill(0, 0, 0xff);

// bug: have to declare all line styles before you use them
$s->setLine(40, 0x7f, 0, 0);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->setLine(40, 0, 0x7f, 0);
$s->setLine(40, 0, 0, 0x7f);

$f = new SWFFont('Techno.fdb');

$s->setRightFill($f1);
$s->setLine(40, 0x7f, 0, 0);
$s->drawGlyph($f, '!');
$s->movePen($f->getWidth('!'), 0);

$s->setRightFill($f2);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->drawGlyph($f, '#');
$s->movePen($f->getWidth('#'), 0);

$s->setRightFill($f3);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->drawGlyph($f, '%');
$s->movePen($f->getWidth('%'), 0);

$s->setRightFill($f4);
$s->setLine(40, 0, 0x7f, 0);
$s->drawGlyph($f, '*');
$s->movePen($f->getWidth('*'), 0);

$s->setRightFill($f5);
$s->setLine(40, 0, 0, 0x7f);
$s->drawGlyph($f, '@');

$m = new SWFMovie();
$m->setDimension(3000,2000);
$m->setRate(12.0);
$i = $m->add($s);
$i->moveTo(1500-$f->getWidth("!#%*@")/2, 1000+$f->getAscent()/2);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

返回值

没有返回值。

SWFShape::setRightFill

Sets right rasterizing color

说明

void SWFShape::setRightFill ( SWFGradient $fill )

void setRightFill ( int $red , int $green , int $blue [, int $a ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Shortcut for $swfshape->setrightfill($s->addfill($r, $g, $b [, $a]));.

返回值

没有返回值。

参见

  • SWFShape::setLeftFill

简介

SWFSound.

类摘要

SWFSound

class SWFSound {

/* 方法 */

__construct ( string $filename [, int $flags = 0 ] )

}

SWFSound::__construct

Returns a new SWFSound object from given file

说明

SWFSound::__construct ( string $filename [, int $flags = 0 ] )

Warning

本函数还未编写文档,仅有参数列表。

简介

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

类摘要

SWFSoundInstance

class SWFSoundInstance {

/* 方法 */

void loopCount ( int $point )

void loopInPoint ( int $point )

void loopOutPoint ( int $point )

void noMultiple ( void )

}

SWFSoundInstance::loopCount

说明

void SWFSoundInstance::loopCount ( int $point )

Warning

本函数还未编写文档,仅有参数列表。

参数

point

返回值

没有返回值。

参见

  • SWFSoundInstance::loopOutPoint

SWFSoundInstance::loopInPoint

说明

void SWFSoundInstance::loopInPoint ( int $point )

Warning

本函数还未编写文档,仅有参数列表。

参数

point

返回值

没有返回值。

参见

  • SWFSoundInstance::loopOutPoint

SWFSoundInstance::loopOutPoint

说明

void SWFSoundInstance::loopOutPoint ( int $point )

Warning

本函数还未编写文档,仅有参数列表。

参数

point

返回值

没有返回值。

参见

  • SWFSoundInstance::loopInPoint

SWFSoundInstance::noMultiple

说明

void SWFSoundInstance::noMultiple ( void )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

简介

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.

类摘要

SWFSprite

class SWFSprite {

/* 方法 */

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 )

}

SWFSprite::add

Adds an object to a sprite

说明

void SWFSprite::add ( object $object )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfsprite::add adds a swfshape, a swfbutton, a swftext, a swfaction or a swfsprite object.

For displayable types (swfshape, swfbutton, swftext, swfaction or swfsprite), this returns a handle to the object in a display list.

返回值

没有返回值。

SWFSprite::__construct

Creates a movie clip (a sprite)

说明

SWFSprite::__construct ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Creates a new SWFSprite object.

SWFSprite::labelFrame

Labels frame

说明

void SWFSprite::labelFrame ( string $label )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFSprite::nextFrame

Moves to the next frame of the animation

说明

void SWFSprite::nextFrame ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfsprite::setframes moves to the next frame of the animation.

返回值

没有返回值。

SWFSprite::remove

Removes an object to a sprite

说明

void SWFSprite::remove ( object $object )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfsprite::remove remove a swfshape, a swfbutton, a swftext, a swfaction or a swfsprite object from the sprite.

返回值

没有返回值。

SWFSprite::setFrames

Sets the total number of frames in the animation

说明

void SWFSprite::setFrames ( int $number )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swfsprite::setframes sets the total number of frames in the animation to numberofframes.

返回值

没有返回值。

SWFSprite::startSound

说明

SWFSoundInstance SWFSprite::startSound ( SWFSound $sount )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFSprite::stopSound

SWFSprite::stopSound

说明

void SWFSprite::stopSound ( SWFSound $sount )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

参见

  • SWFSprite::startSound

简介

SWFText.

类摘要

SWFText

class SWFText {

/* 方法 */

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 )

}

SWFText::addString

Draws a string

说明

void SWFText::addString ( string $string )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftext::addstring draws the string string at the current pen (cursor) location. Pen is at the baseline of the text; i.e., ascending text is in the -y direction.

返回值

没有返回值。

参见

  • SWFText::addUTF8String

SWFText::addUTF8String

Writes the given text into this SWFText object at the current pen position, using the current font, height, spacing, and color

说明

void SWFText::addUTF8String ( string $text )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

参见

  • SWFText::addString

SWFText::__construct

Creates a new SWFText object

说明

SWFText::__construct ( void )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Creates a new SWFText object, fresh for manipulating.

范例

This simple example will draw a big yellow "PHP generates Flash with Ming" text, on white background.

示例 #1 swftext example

<?php
$f = new SWFFont("Techno.fdb");
$t = new SWFText();
$t->setFont($f);
$t->moveTo(200, 2400);
$t->setColor(0xff, 0xff, 0);
$t->setHeight(1200);
$t->addString("PHP generates Flash with Ming!!");

$m = new SWFMovie();
$m->setDimension(5400, 3600);

$m->add($t);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>

SWFText::getAscent

Returns the ascent of the current font at its current size, or 0 if not available

说明

float SWFText::getAscent ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFText::getDescent

SWFText::getDescent

Returns the descent of the current font at its current size, or 0 if not available

说明

float SWFText::getDescent ( void )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFText::getAscent

SWFText::getLeading

Returns the leading of the current font at its current size, or 0 if not available

说明

float SWFText::getLeading ( void )

Warning

本函数还未编写文档,仅有参数列表。

SWFText::getUTF8Width

Calculates the width of the given string in this text objects current font and size

说明

float SWFText::getUTF8Width ( string $string )

Warning

本函数还未编写文档,仅有参数列表。

参见

  • SWFText::getWidth

SWFText::getWidth

Computes string's width

说明

float SWFText::getWidth ( string $string )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Returns the rendered width of the string at the text object's current font, scale, and spacing settings.

参见

  • SWFText::getUTF8Width

SWFText::moveTo

Moves the pen

说明

void SWFText::moveTo ( float $x , float $y )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftext::moveto moves the pen (or cursor, if that makes more sense) to (x,y) in text object's coordinate space. If either is zero, though, value in that dimension stays the same. Annoying, should be fixed.

返回值

没有返回值。

SWFText::setColor

Sets the current text color

说明

void SWFText::setColor ( int $red , int $green , int $blue [, int $a = 255 ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

Changes the current text color.

参数

These parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF:

red
Value of red component

green
Value of green component

blue
Value of blue component

a
Value of alpha component

返回值

没有返回值。

SWFText::setFont

Sets the current font

说明

void SWFText::setFont ( SWFFont $font )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftext::setfont sets the current font to font.

返回值

没有返回值。

SWFText::setHeight

Sets the current font height

说明

void SWFText::setHeight ( float $height )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftext::setheight sets the current font height to height. Default is 240.

返回值

没有返回值。

SWFText::setSpacing

Sets the current font spacing

说明

void SWFText::setSpacing ( float $spacing )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftext::setspacing sets the current font spacing to spacing. Default is 1.0. 0 is all of the letters written at the same point. This doesn't really work that well because it inflates the advance across the letter, doesn't add the same amount of spacing between the letters. I should try and explain that better, prolly. Or just fix the damn thing to do constant spacing. This was really just a way to figure out how letter advances work, anyway.. So nyah.

返回值

没有返回值。

简介

SWFTextField.

类摘要

SWFTextField

class SWFTextField {

/* 方法 */

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 )

}

SWFTextField::addChars

Adds characters to a font that will be available within a textfield

说明

void SWFTextField::addChars ( string $chars )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

参见

  • SWFTextField::addString

SWFTextField::addString

Concatenates the given string to the text field

说明

void SWFTextField::addString ( string $string )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setname concatenates the string string to the text field.

返回值

没有返回值。

SWFTextField::align

Sets the text field alignment

说明

void SWFTextField::align ( int $alignement )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::align sets the text field alignment to alignement. Valid values for alignement are : SWFTEXTFIELD_ALIGN_LEFT, SWFTEXTFIELD_ALIGN_RIGHT, SWFTEXTFIELD_ALIGN_CENTER and SWFTEXTFIELD_ALIGN_JUSTIFY.

返回值

没有返回值。

SWFTextField::__construct

Creates a text field object

说明

SWFTextField::__construct ([ int $flags ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield creates a new text field object. Text Fields are less flexible than swftext objects- they can't be rotated, scaled non-proportionally, or skewed, but they can be used as form entries, and they can use browser-defined fonts.

The optional flags change the text field's behavior. It has the following possibles values :

  • SWFTEXTFIELD_DRAWBOX draws the outline of the textfield
  • SWFTEXTFIELD_HASLENGTH
  • SWFTEXTFIELD_HTML allows text markup using HTML-tags
  • SWFTEXTFIELD_MULTILINE allows multiple lines
  • SWFTEXTFIELD_NOEDIT indicates that the field shouldn't be user-editable
  • SWFTEXTFIELD_NOSELECT makes the field non-selectable
  • SWFTEXTFIELD_PASSWORD obscures the data entry
  • SWFTEXTFIELD_WORDWRAP allows text to wrap

Flags are combined with the bitwise OR operation. For example,

<?php
$t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); 
?>

creates a totally useless non-editable password field.

SWFTextField has the following methods : swftextfield::setfont, swftextfield::setbounds, swftextfield::align, swftextfield::setheight, swftextfield::setleftmargin, swftextfield::setrightmargin, swftextfield::setmargins, swftextfield::setindentation, swftextfield::setlinespacing, swftextfield::setcolor, swftextfield::setname and swftextfield::addstring.

SWFTextField::setBounds

Sets the text field width and height

说明

void SWFTextField::setBounds ( float $width , float $height )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setbounds sets the text field width to width and height to height. If you don't set the bounds yourself, Ming makes a poor guess at what the bounds are.

返回值

没有返回值。

SWFTextField::setColor

Sets the color of the text field

说明

void SWFTextField::setColor ( int $red , int $green , int $blue [, int $a = 255 ] )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setcolor sets the color of the text field. Default is fully opaque black. Color is represented using RGB system.

参数

These parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF:

red
Value of red component

green
Value of green component

blue
Value of blue component

a
Value of alpha component

返回值

没有返回值。

SWFTextField::setFont

Sets the text field font

说明

void SWFTextField::setFont ( SWFFont $font )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setfont sets the text field font to the [browser-defined?] font font.

返回值

没有返回值。

SWFTextField::setHeight

Sets the font height of this text field font

说明

void SWFTextField::setHeight ( float $height )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setheight sets the font height of this text field font to the given height height. Default is

返回值

没有返回值。

SWFTextField::setIndentation

Sets the indentation of the first line

说明

void SWFTextField::setIndentation ( float $width )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setindentation sets the indentation of the first line in the text field, to width.

返回值

没有返回值。

SWFTextField::setLeftMargin

Sets the left margin width of the text field

说明

void SWFTextField::setLeftMargin ( float $width )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setleftmargin sets the left margin width of the text field to width. Default is 0.

返回值

没有返回值。

SWFTextField::setLineSpacing

Sets the line spacing of the text field

说明

void SWFTextField::setLineSpacing ( float $height )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setlinespacing sets the line spacing of the text field to the height of height. Default is 40.

返回值

没有返回值。

SWFTextField::setMargins

Sets the margins width of the text field

说明

void SWFTextField::setMargins ( float $left , float $right )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setmargins set both margins at once, for the man on the go.

返回值

没有返回值。

SWFTextField::setName

Sets the variable name

说明

void SWFTextField::setName ( string $name )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setname sets the variable name of this text field to name, for form posting and action scripting purposes.

返回值

没有返回值。

SWFTextField::setPadding

Sets the padding of this textfield

说明

void SWFTextField::setPadding ( float $padding )

Warning

本函数还未编写文档,仅有参数列表。

返回值

没有返回值。

SWFTextField::setRightMargin

Sets the right margin width of the text field

说明

void SWFTextField::setRightMargin ( float $width )

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。

swftextfield::setrightmargin sets the right margin width of the text field to width. Default is 0.

返回值

没有返回值。

简介

SWFVideoStream.

类摘要

SWFVideoStream

class SWFVideoStream {

/* 方法 */

__construct ([ string $file ] )

int getNumFrames ( void )

void setDimension ( int $x , int $y )

}

SWFVideoStream::__construct

Returns a SWFVideoStream object

说明

SWFVideoStream::__construct ([ string $file ] )

Warning

本函数还未编写文档,仅有参数列表。

SWFVideoStream::getNumFrames

Returns the number of frames in the video

说明

int SWFVideoStream::getNumFrames ( void )

This function returns the number of video-frames of a SWFVideoStream.

返回值

Returns the number of frames, as an integer

SWFVideoStream::setDimension

Sets video dimension

说明

void SWFVideoStream::setDimension ( int $x , int $y )

Sets the width and height for streamed videos.

参数

x
Width in pixels.

y
Height in pixels.

返回值

没有返回值。