for creating a play/pause button I used this script:
<?php
//pause button
$b = new SWFButton();
$b->addShape(rect(0, 0xff, 0), SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
$b->addAction(new SWFAction("stop();"),SWFBUTTON_MOUSEDOWN);
$i = $movie->add($b);
//play button
$b = new SWFButton();
$b->addShape(rect_two(0, 0xff, 0), SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
$b->addAction(new SWFAction("play();"),SWFBUTTON_MOUSEDOWN);
$i = $movie->add($b);
?>
it has to be run during every frame for the buttons to be in every frame... hope that helps somebody....
SWFAction クラス
導入
SWFAction.
クラス概要
SWFAction
class SWFAction
{
/* メソッド */
SWFAction __construct
( string $script
)
}説明
スクリプトの文法は C 言語をもとにしていますが、多くの機能が 省略されています - SWF バイトコードマシンは、より単純であることを 志向しています。例えば、相当手の込んだ細工をしなければ、関数のコールを 実装することもできません。なぜなら、バイトコードの jump 命令は ハードコードされたオフセット値を使用しているからです。 呼び出し元のアドレスをスタックに格納したりはしません - すべての関数は、戻ってくる場所を正確に知っている必要があるのです。
結局、どんな機能が残っているのでしょう? コンパイラが理解できるトークンは 以下のとおりです。
- break
- for
- continue
- if
- else
- do
- while
データ型は存在しません。SWF アクションマシンにおいては、すべての値は 文字列として扱われます。以下の関数が使用可能です。
- time()
- ムービーが開始してからの経過時間を、ミリ秒 (?) で返します。
- random(seed)
- 0 から seed までの範囲の擬似乱数を返します。
- length(expr)
- 指定した式の長さを返します。
- int(number)
- 指定した数値を、一番近い整数に切り下げた値を返します。
- concat(expr, expr)
- 指定した式を連結して返します。
- ord(expr)
- 指定した文字の ASCII コードを返します。
- chr(num)
- 指定した ASCII コードに対応する文字を返します。
- substr(string, location, length)
- 指定した文字列 string の、 位置 location から始まる 長さ length の部分文字列を返します。
さらに、以下のコマンドも使用できるでしょう。
- duplicateClip(clip, name, depth)
- 指定したムービークリップ (またの名をスプライト) clip を複製します。 新しいムービークリップの名前は name で、 深度は depth となります。
- removeClip(expr)
- 指定したムービークリップを削除します。
- trace(expr)
- 指定した式をトレースログに書き込みます。ブラウザのプラグインが これをきちんと扱ってくれるかは疑わしいものです。
- startDrag(target, lock, [left, top, right, bottom])
- ムービークリップ target のドラッグを開始します。 引数 lock で、マウスをロックするかどうか (?) を指定します - 0 (FALSE) あるいは 1 (TRUE) を指定します。 オプションのパラメータでは、ドラッグする範囲のを指定します。
- stopDrag()
- つかれきった心を落ち着かせます。そしてムービークリップの ドラッグも修了させます。
- callFrame(expr)
- 指定したフレームを関数としてコールします。
- getURL(url, target, [method])
- 指定した URL を読み込みます。引数 target は、 (たとえば "_top" や "_blank" のような) HTML ドキュメントの target に対応します。オプションの引数 method は、 サーバに変数を返したい場合に POST あるいは GET を指定します。
- loadMovie(url, target)
- 指定した URL を読み込みます。引数 target は、 (おそらく) フレームの名前か あるいは特別な値 "_level0" (現在のムービーを置き換える) 、 "_level1" (現在のムービーの前面に新しいムービーを表示する) のうちのいずれかです。
- nextFrame()
- 次のフレームに移動します。
- prevFrame()
- 直前の (あるいは一つ前の) フレームに移動します。
- play()
- ムービーの再生を開始します。
- stop()
- ムービーの再生を停止します。
- toggleQuality()
- 高品質/低品質を切り替えます。
- stopSounds()
- 音声の再生を停止します。
- gotoFrame(num)
- フレーム番号 num に移動します。 フレーム番号は 0 からはじまります。
- gotoFrame(name)
- name という名前のフレームに移動します。 これは便利です。というのもまだフレームのラベルを追加していないからです。
- setTarget(expr)
- アクションのコンテキストといわれるものを設定します。 これが何をするものなのかは実際のところよくわかりません。
ムービークリップ (さぁみなさんご一緒に - またの名をスプライト) はプロパティをひじしています。すべてのプロパティが読み込み可能で、 そのうちのいくつかには値を設定することも可能です。プロパティの 一覧は以下のとおりです。
- x
- y
- xScale
- yScale
- currentFrame - (読み込み専用)
- totalFrames - (読み込み専用)
- alpha - 透明度
- visible - 1=on, 0=off (?)
- width - (読み込み専用)
- height - (読み込み専用)
- rotation
- target - (読み込み専用) (???)
- framesLoaded - (読み込み専用)
- name
- dropTarget - (読み込み専用) (???)
- url - (読み込み専用) (???)
- highQuality - 1=high, 0=low (?)
- focusRect - (???)
- soundBufTime - (???)
目次
- SWFAction->__construct() — 新しい SWFAction を作成する
SWFAction
samrerb at gmail dot com
12-Aug-2006 09:03
12-Aug-2006 09:03
julien/*AT*/theoconcept.com
26-Jan-2006 10:41
26-Jan-2006 10:41
fscommand, the proper way to call a javascript function from a flash animation seems not to work in Ming at the moment, here is a commented example on how to do that :
http://blog.theoconcept.com/flashlink.php
ifrost at uos dot de
25-Oct-2004 06:50
25-Oct-2004 06:50
If you want to open an URL in a new window, define a shape ($ashape) and use this code:
<?php
$b = new SWFButton();
$b->addShape($ashape, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
$b->addAction(
new SWFAction(
'getURL("http://www.php.net","_blank");' // _blank is the target like in html
), SWFBUTTON_MOUSEDOWN
);
?>
But if you want it in the same window use this addAction():
<?php
$b->addAction(
new SWFAction(
'this.getURL("http://www.php.net");'
), SWFBUTTON_MOUSEDOWN
);
?>
jerryscript at aol dot com
04-Jan-2004 06:28
04-Jan-2004 06:28
Ming 0.3 (current cvs) can use most MX actionscript, just set the swf version to 6
ming_useswfversion(6);
Anze
03-Nov-2003 12:45
03-Nov-2003 12:45
fscommand() doesn't work (at least in Ming 0.2a), but there is a workaround.
Instead of:
fscommand("do","something");
use:
getURL("fscommand:do","something");
jamesNOSPAMbarros at hotNOSPAMmail dot com
13-Sep-2002 11:35
13-Sep-2002 11:35
Printing Flash Movies
When a browser tries to print flash, the autoscaling can make it look ugly. users have to right click on the flash and select "print" to get it to print properly. (so that thier flash player is handling the printing, not the browser) If you dont want to require this of your users, you can create a print button with the following action:
getURL('print:', '/');
by default, this prints ALL frames. to avoid this, just put:
$m->labelFrame("#p");
before:
$m->nextFrame();
where $m is your SWFMovie. the #p label denotes a printable frame. (this also allows you to build your movie, then throw the print button into the next frame and not have it show up when you print. )
diem at writeme dot com
05-Feb-2002 09:11
05-Feb-2002 09:11
Sorry Guys ....
the /box.x syntax is for fash version 4 ... and _root.box._x is used for flash version 5 ....
Ming >= 0.2 assumes version 5 by default .... to use version 4 syntax, you must use ming_useswfversion before ...
