Web技術日記
ホームページ制作の小技を紹介します。

phpのming 2008年11月 9日

mingの備忘録。これを応用すれば大体のことはできる?かな。

//携帯対応するためバージョン4で
ming_useswfversion(4);

$m = new SWFMovie();

$m->setDimension(240, 320);
$m->setbackground(0, 0, 0);

//jpg読込
$s = new SWFShape();
//jpgまたはdblのみ
$f = $s->addFill(new SWFBitmap(fopen('sample.jpg', "rb")));
$s->setRightFill($f[$i]);
$s->drawLine(0, 320);
$s->drawLine(240, 0);
$s->drawLine(0, -320);
$s->drawLine(-240, 0);
$p = new SWFSprite();
$p->add($s);
$p->nextFrame();
$m->add($p);

//swf読込
$c = new SWFPrebuiltClip(fopen('../sozai/ugoku/sample.swf', "rb"));
$i = $m->add($c);
$i->setName("sozai");
$m->add(new SWFAction("sozai{$j}.x = 100;sozai{$j}.y = 100;sozai.xScale = 100;sozai.yScale = 100;"));

//文字書込
$o = new SWFFont('sample.ttf');
$t = new SWFText();
$t->setFont($o);
//フォントの高さ
$t->setHeight(20);
$t->setColor(0xff,0xff,0xff);
//文字記入位置
$t->moveTo(20,20);
$t->addUTF8String('Sample');
$w = new SWFSprite();
$w->add($t);
$w->nextFrame();
$m->add($w);

$m->nextFrame();
$m->save('sample.swf');