note 89236 added to class.swfmovie

From: Date: Fri, 27 Feb 2009 14:33:28 +0000
Subject: note 89236 added to class.swfmovie
Groups: php.notes 
Request: Send a blank email to php-notes+get-151205@lists.php.net to get a copy of this message
<?php // php ming swf flash movie example #2 -- // this routine displays several wipe/fade transitional effects $f = new SWFFont("Bitstream Vera Serif.fdb"); $m = new SWFMovie(); $m->setDimension(640, 480); $m->setBackground(0, 255, 153); $m->setRate(9); $p = movieclip("First...", 0, 255, 255, 100, 50, 25, 7); $i = $m->add($p); $p = movieclip("Second...", 102, 0, 102, 100, 170, 18, 5); $i = $m->add($p); $p = movieclip("Third...", 255, 0, 51, 100, 290, 30, 6); $i = $m->add($p); // $m->save("wfeffect.swf"); header('Content-type: application/x-shockwave-flash'); $m->output(); ?> <?php function movieclip($txt, $r, $g, $b, $x, $y, $sv, $mv) { global $f; $s = new SWFShape(); $s->setLine(1,0,0,255); // (line weight, r, g, b) $s->setRightFill(255,255,0); $s->drawLine(170,0); $s->drawLine(0,60); $s->drawLine(-170,0); $s->drawLine(0,-60); $t = new SWFText(); $t->setFont($f); $t->setColor($r, $g, $b); $t->setHeight(17); $t->addString($txt); $p = new SWFSprite(); $is = $p->add($s); // works with images also: // $is = $p->add(new SWFBitMap(fopen("/images/yourbmp.jpg", "rb"))); $it = $p->add($t); $is->moveTo($x, $y); $it->moveTo($x+10, $y+20); // adjust movement left with a compensating move // right ($i->move()), to change look of this effect: // note: setting the scaleTo() $y parameter to 0 didn't help(?) // fixed in later versions? only tested with Ming 0.3beta1. $scaleLeftValue = $sv; $moveRightValue = $scaleLeftValue/$mv; for ($n=1; $n < $scaleLeftValue; $n++) { $is->scaleTo(1-($n/$scaleLeftValue), 1); $it->scaleTo(1-($n/$scaleLeftValue), 1); $is->move($moveRightValue, 0); // fade text color to add to effect: if ($n <= 10) { $it->addColor(10*$n, 10*$n, 10*$n); } // try to keep text in bounds if ($n < $scaleLeftValue - 2) { $it->move($moveRightValue, 0); } $p->nextframe(); } $p->remove($is); // remove() causes item to disappear $p->remove($it); // which is exactly what we want here $p->nextFrame(); $p->add(new SWFAction("stop();")); $p->nextFrame(); return $p; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 75.38.23.204 ---- Manual Page -- http://www.php.net/manual/en/class.swfmovie.php Edit -- https://master.php.net/note/edit/89236 Del: integrated -- https://master.php.net/note/delete/89236/integrated Del: useless -- https://master.php.net/note/delete/89236/useless Del: bad code -- https://master.php.net/note/delete/89236/bad+code Del: spam -- https://master.php.net/note/delete/89236/spam Del: non-english -- https://master.php.net/note/delete/89236/non-english Del: in docs -- https://master.php.net/note/delete/89236/in+docs Del: other reasons-- https://master.php.net/note/delete/89236 Reject -- https://master.php.net/note/reject/89236 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151205) next »