Top > IO_SWF
  • The added line is THIS COLOR.
  • The deleted line is THIS COLOR.
  • Go to IO_SWF.

- https://github.com/yoya/IO_SWF
- https://packagist.org/packages/yoya/io_swf
// http://openpear.org/package/IO_SWF

- ↓解析ツールとしての詳細解説
--  http://labs.gree.jp/blog/2012/11/6308/


* インストール [#install]

 composer require yoya/io_swf
// pear channel-discover openpear.org
// pear install openpear/IO_SWF

* 使い方サンプル [#usage]

** 中身を見る [#swfdump]

 php /usr/share/php/sample/swfdump -f test.swf
 php vendor/yoya/io_swf/sample/swfdump.php  -f  test.swf
// php /usr/share/php/sample/swfdump -f test.swf
- pear 環境によって /usr/share/php 以外の可能性もあるので適宜変えて下さい。
- SWF バイナリをデバッグしたい場合は、-h を付けると 16進も一緒に表示するので便利です。

- 中身を見る、もう一つの手 > http://app.awm.jp/swfed/

** 画像入れ替え [#replacebitmapdata]

 $swf_data = file_get_contents('test.swf');
 $bitmap_id = 1; // swfdump で調べてね!
 $bitmap_data = file_get_contents('aria.png');
 
 $swf = new IO_SWF_Editor();
 $swf->input($swf_data);
 $swf->replaceBitmapData($bitmap_id, $bitmap_data)

*** サイズや色指定でも入れ替え出来ます。 [#replacebycolor]
 $swf_data = file_get_contents('test.swf');
 // 100x100の赤い画像と入れ替える
 $bitmap_conf = array('width' => 100, 'height'=>100,
                     'red'=>255, 'green'=>0, 'blue'=>0);
 $bitmap_data = file_get_contents('aria.png');
 
 $swf = new IO_SWF_Editor();
 $swf->input($swf_data);
 $swf->replaceBitmapData($bitmap_cond, $bitmap_data)

* IO_SWF_Editor method [#io_swf_editor]

- input($data)
- build()
- dump()
- setCharacterId()
- setActionVariables($vars)
- replaceActionStrings($trans_table)
- replaceBitmapData($bitmap_id, $bitmap_data, $jpeg_alphadata = null)
- deformeShape($threshold);
- countShapeEdges() => array(shape_id1 => count1, shape_id2=count2, ...)
- replaceMovieClip($target_path, $movieclip_swfdata);
- replaceEditText($id, $initialText);

* 関連 [#rel]

- [[IO_Bit]]
- [[swfed]] (PHP拡張、API が少し違います)

Reload   Diff   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes