/** * Returns unique movie object as a parent canvas for all swf objects. * * @return SWFMovie */ public function getDocument() { if ($this->movie === null) { ming_setscale(1.0); $this->movie = new SWFMovie(); $this->movie->setDimension($this->modifyCoordinate($this->options->width), $this->modifyCoordinate($this->options->height)); $this->movie->setRate(1); $this->movie->setBackground(255, 255, 255); } return $this->movie; }
private function _flash() { $spacing = 5; $codewidth = ($this->width - $spacing * 5) / 4; $strforswdaction = ''; for ($i = 0; $i <= 3; $i++) { $strforswdaction .= $this->swfcode($codewidth, $spacing, $this->_code[$i], $i + 1); } ming_setScale(20.0); ming_useswfversion(6); $movie = new SWFMovie(); $movie->setDimension($this->width, $this->height); $movie->setBackground(255, 255, 255); $movie->setRate(31); $fontcolor = '0x' . sprintf('%02s', dechex(mt_rand(0, 255))) . sprintf('%02s', dechex(mt_rand(0, 128))) . sprintf('%02s', dechex(mt_rand(0, 255))); $strAction = "\n\t\t_root.createEmptyMovieClip ( 'triangle', 1 );\n\t\twith ( _root.triangle ) {\n\t\tlineStyle( 3, {$fontcolor}, 100 );\n\t\t{$strforswdaction}\n\t\t}\n\t\t"; $movie->add(new SWFAction(str_replace("\r", "", $strAction))); header('Content-type: application/x-shockwave-flash'); $movie->output(); }
#!/usr/bin/php -c. <?php $m = new SWFMovie(); /* SWF_SETBACKGROUNDCOLOR */ $m->setBackground(0xff, 0xff, 0xff); /* SWF_DEFINESPRITE */ /* MovieClip 1 */ $character1 = new SWFMovieClip(); /* 1 frames */ /* SWF_SHOWFRAME */ $character1->nextFrame(); /* end of clip frame 1 */ /* SWF_END */ /* SWF_PLACEOBJECT2 */ /* PlaceFlagHasCharacter */ $m->add($character1); /* PlaceFlagHasMatrix */ /* outputSWF_MATRIX is broken, so it is being skipped.. */ /* SWF_SHOWFRAME */ $m->nextFrame(); /* end of frame 1 */ /* SWF_END */ $m->save("test02.swf");
<?php $f = new SWFFont(dirname(__FILE__) . '/i/captcha/fonts/anke_calligraph.ttf'); $m = new SWFMovie(); $m->setRate(24.0); $m->setDimension(520, 320); $m->setBackground(251, 121, 34); 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(96); $t->moveTo(-$t->getWidth($string) / 2, 32); $t->addString($string); $i = $m->add($t); $i->rotateTo($rot); $i->moveTo($x, $y); $i->scale($scale, $scale); return $i; } $colorr[1] = 255 * 0.85; $colorg[1] = 255 * 0.85; $colorb[1] = 255 * 0.85; $colorr[2] = 255 * 0.9; $colorg[2] = 255 * 0.9; $colorb[2] = 255 * 0.9; $colorr[3] = 255 * 0.95; $colorg[3] = 255 * 0.95; $colorb[3] = 255 * 0.95;
<?php include('../Arabic.php'); $Arabic = new Arabic('ArGlyphs'); $text_before = 'اللغة العربية'; $text_after = $Arabic->utf8Glyphs($text_before); $f = new SWFFont(dirname(__FILE__).'/GD/ae_AlHor.ttf'); $m = new SWFMovie(); $m->setRate(24.0); $m->setDimension(520, 320); $m->setBackground(105, 121, 47); // This functions was based on the example from // http://ming.sourceforge.net/examples/animation.html 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(96); $t->moveTo(-($t->getWidth($string)) / 5, 32); $t->addUTF8String($string); $i = $m->add($t); $i->rotateTo($rot); $i->moveTo($x, $y); $i->scale($scale, $scale);
imagejpeg($im, '', 100); } imagedestroy($im); } } elseif ($seccodedata['type'] == 2 && extension_loaded('ming')) { $spacing = 5; $codewidth = ($seccodedata['width'] - $spacing * 5) / 4; $strforswdaction = ''; for ($i = 0; $i <= 3; $i++) { $strforswdaction .= seccode_swfcode($codewidth, $spacing, $seccode[$i], $i + 1); } ming_setScale(20.0); ming_useswfversion(6); $movie = new SWFMovie(); $movie->setDimension($seccodedata['width'], $seccodedata['height']); $movie->setBackground(255, 255, 255); $movie->setRate(31); $fontcolor = '0x' . sprintf('%02s', dechex(mt_rand(0, 255))) . sprintf('%02s', dechex(mt_rand(0, 128))) . sprintf('%02s', dechex(mt_rand(0, 255))); $strAction = "\r\n\t_root.createEmptyMovieClip ( 'triangle', 1 );\r\n\twith ( _root.triangle ) {\r\n\tlineStyle( 3, {$fontcolor}, 100 );\r\n\t{$strforswdaction}\r\n\t}\r\n\t"; $movie->add(new SWFAction(str_replace("\r", "", $strAction))); header('Content-type: application/x-shockwave-flash'); $movie->output(); } else { $numbers = array('B' => array('00', 'fc', '66', '66', '66', '7c', '66', '66', 'fc', '00'), 'C' => array('00', '38', '64', 'c0', 'c0', 'c0', 'c4', '64', '3c', '00'), 'E' => array('00', 'fe', '62', '62', '68', '78', '6a', '62', 'fe', '00'), 'F' => array('00', 'f8', '60', '60', '68', '78', '6a', '62', 'fe', '00'), 'G' => array('00', '78', 'cc', 'cc', 'de', 'c0', 'c4', 'c4', '7c', '00'), 'H' => array('00', 'e7', '66', '66', '66', '7e', '66', '66', 'e7', '00'), 'J' => array('00', 'f8', 'cc', 'cc', 'cc', '0c', '0c', '0c', '7f', '00'), 'K' => array('00', 'f3', '66', '66', '7c', '78', '6c', '66', 'f7', '00'), 'M' => array('00', 'f7', '63', '6b', '6b', '77', '77', '77', 'e3', '00'), 'P' => array('00', 'f8', '60', '60', '7c', '66', '66', '66', 'fc', '00'), 'Q' => array('00', '78', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', '78', '00'), 'R' => array('00', 'f3', '66', '6c', '7c', '66', '66', '66', 'fc', '00'), 'T' => array('00', '78', '30', '30', '30', '30', 'b4', 'b4', 'fc', '00'), 'V' => array('00', '1c', '1c', '36', '36', '36', '63', '63', 'f7', '00'), 'W' => array('00', '36', '36', '36', '77', '7f', '6b', '63', 'f7', '00'), 'X' => array('00', 'f7', '66', '3c', '18', '18', '3c', '66', 'ef', '00'), 'Y' => array('00', '7e', '18', '18', '18', '3c', '24', '66', 'ef', '00'), '2' => array('fc', 'c0', '60', '30', '18', '0c', 'cc', 'cc', '78', '00'), '3' => array('78', '8c', '0c', '0c', '38', '0c', '0c', '8c', '78', '00'), '4' => array('00', '3e', '0c', 'fe', '4c', '6c', '2c', '3c', '1c', '1c'), '6' => array('78', 'cc', 'cc', 'cc', 'ec', 'd8', 'c0', '60', '3c', '00'), '7' => array('30', '30', '38', '18', '18', '18', '1c', '8c', 'fc', '00'), '8' => array('78', 'cc', 'cc', 'cc', '78', 'cc', 'cc', 'cc', '78', '00'), '9' => array('f0', '18', '0c', '6c', 'dc', 'cc', 'cc', 'cc', '78', '00')); foreach ($numbers as $i => $number) { for ($j = 0; $j < 6; $j++) { $a1 = substr('012', mt_rand(0, 2), 1) . substr('012345', mt_rand(0, 5), 1); $a2 = substr('012345', mt_rand(0, 5), 1) . substr('0123', mt_rand(0, 3), 1); mt_rand(0, 1) == 1 ? array_push($numbers[$i], $a1) : array_unshift($numbers[$i], $a1); mt_rand(0, 1) == 0 ? array_push($numbers[$i], $a1) : array_unshift($numbers[$i], $a2); }
#!/usr/bin/php -c. <?php $m = new SWFMovie(8); $m->setBackground(0, 0, 0); $m->save("test07.swf");
#!/usr/bin/php -c. <?php $m = new SWFMovie(); /* SWF_SETBACKGROUNDCOLOR */ $m->setBackground(0x0, 0xff, 0x0); /* SWF_SHOWFRAME */ $m->nextFrame(); /* end of frame 1 */ /* SWF_END */ $m->save("test02.swf");
#!/usr/bin/php -c. <?php $srcdir = $argv[1]; $m = new SWFMovie(9); $m->setBackground(0xcc, 0xcc, 0xcc); $s = new SWFShape(); $img = new SWFBitmap($srcdir . "/../Media/image01.dbl"); $fill = $s->addFill($img, SWFFILL_TILED_BITMAP); $s->setRightFill($fill); $w = $img->getWidth(); $h = $img->getHeight(); $s->drawLine($w, 0); $s->drawLine(0, $h); $s->drawLine(-$w, 0); $s->drawLine(0, -$h); $cm = array(); for ($i = 0; $i < 20; $i++) { $cm[$i] = 0.1; } $cmf = new SWFFilterMatrix(5, 4, $cm); $filter = new SWFFilter(SWFFILTER_TYPE_COLORMATRIX, $cmf); $bu = new SWFButton(); $bu->addCharacter($s, SWFBUTTON_UP | SWFBUTTON_HIT | SWFBUTTON_OVER | SWFBUTTON_DOWN); $item = $m->add($bu); $item->addFilter($filter); $m->save("test05.swf");
//echo "wndd_min=$wndd_min<br>"; //echo "wndd_max=$wndd_max<br>"; //echo "wnds_min=$wnds_min<br>"; //echo "wnds_max=$wnds_max<br>"; /* set the graph's x and y dimensions */ $gx = 800; $gy = 240; /* Time to create the $gx x $gy image */ /* first creat a blank image */ $im = new SWFShape(); /* use a 1 pixel width black pen */ $im->setLine(1, 0, 0, 0); /* use a white background */ $mve = new SWFMovie(); $mve->setDimension($gx, $gy); $mve->setBackground(255, 255, 255); /* here's a small pallete to use for the graphs (RGB values) */ //black = (0,0,0); //brown = (255,255,0); //$red = (255,0,0); //$yellow = (224,252,24); //$green = (0,255,0); //$drkGreen = (0,190,0); //$blue = (0,0,255); //$grey = (128,128,128); //$ltGrey = (192,192,192); //$ltrGrey = (224,224,224); /* For a 100 x 100 image: (0,0) is the upper left hand corner, (100,100) is the lower right hand corner. */
<?php require 'XML/RSS.php'; $r =& new XML_RSS('slashdot.rdf'); $r->parse(); $allItems = $r->getItems(); $itemCount = count($allItems); $width = 1000; $m = new SWFMovie(); $m->setDimension($width, 70); $m->setBackground(0xcf, 0xcf, 0xcf); $f = new SWFFont("../../../fonts/Techno.fdb"); $hit = new SWFShape(); $hit->setRightFill($hit->addFill(0, 0, 0)); $hit->movePenTo(-($width / 2), -30); $hit->drawLine($width, 0); $hit->drawLine(0, 60); $hit->drawLine(-$width, 0); $hit->drawLine(0, -60); $x = 0; // build the buttons foreach ($allItems as $Item) { $title = $Item['title']; $link = $Item['link']; // get the text $t = new SWFText(); $t->setFont($f); $t->setHeight(50); $t->setColor(0, 0, 0); $t->moveTo(-$f->getWidth($title) / 2, 25); $t->addString($title);
<?php Ming_setScale(20.0); ming_useswfversion(7); $movie = new SWFMovie(); $movie->setRate(31); $movie->setDimension(400, 300); $movie->setBackground(0xcc, 0xcc, 0xcc); $filesrc1 = "jpg.jpg"; $filesrc2 = "png.png"; $filesrc3 = "gif.gif"; $filecontents1 = file_get_contents($filesrc1); $img = new SWFBitmap($filecontents1); $f1 = $movie->add($img); $f1->moveto(90, 50); $filecontents2 = file_get_contents($filesrc2); $img = new SWFBitmap($filecontents2); $f1 = $movie->add($img); $f1->moveto(10, 10); $filecontents3 = file_get_contents($filesrc3); $img = new SWFBitmap($filecontents3); $f1 = $movie->add($img); $f1->moveto(170, 80); header('Content-Type: application/x-shockwave-flash'); $movie->output(0);
$sc->setBounds(100, 30); $sc->setName("cScore"); $sc->setFont($f); $sc->setColor(255, 255, 255); $sc->addString("Computer : 0"); // Write the "signature" $signature = new SWFText(); $signature->setFont($f); $signature->setColor(150, 150, 255); $signature->setHeight(9); $signature->addString("(c) Armel GRIGNON, october 2001 - See this script at mingshop.arpane.net"); // Now adds the objects to the movie // Creates the movie and the main sprite $m = new SWFMovie(); $m->setRate(96); $m->setBackground(207, 96, 0); $m->setDimension(640, 480); // Adds the two rackets (within sprites) $srp = new SWFSprite(); $srp_shape = $srp->add($rm); $srp->nextFrame(); $racket_player = $m->add($srp); $racket_player->moveTo(10, 215); $racket_player->setName("racketPlayer"); $src = new SWFSprite(); $src->add($rm); $src->nextFrame(); $racket_computer = $m->add($src); $racket_computer->moveTo(630, 215); $racket_computer->setName("racketComputer"); // Adds the "grass"
$next = $slideNum + 1; $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$next}','_self');"), swfbutton_keypress(' ')); $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$next}','_self');"), swfbutton_keypress(chr(13))); } // Backspace or DEL bar takes us to the previous slide if ($slideNum > 0) { $prev = $slideNum - 1; $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$prev}','_self');"), swfbutton_keypress(chr(8))); $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$prev}','_self');"), swfbutton_keypress(chr(127))); } // ESC reloads the current slide $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$slideNum}','_self');"), swfbutton_keypress(chr(27))); // ? brings up the help page $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$helpPage}','_blank');"), swfbutton_keypress('?')); $f = new SWFFont($objs[$coid]->titleFont); $m->setBackground(0x66, 0x66, 0x99); $t = new SWFText(); $t->setFont($f); $rgb = rgb($objs[$coid]->titleColor); $t->setColor($rgb[0], $rgb[1], $rgb[2]); $tHeight = flash_fixsize($objs[$coid]->titleSize); $t->setHeight($tHeight); $tText = $objs[$coid]->title; $t->addString($tText); $m->setDimension($dx, $dy); // Add the text to the movie and position it $i = $m->add($t); $i->moveTo((int) ($dx / 2) - $t->getWidth($tText) / 2, $dy - round($t->getDescent()) - ($dy - $tHeight) / 2); // Don't forget to add the button $m->add($b); break;
} $m = new SWFMovie(); if (isset($context['flash_width']) && $context['flash_width']) { $width = $context['flash_width']; } else { $width = 500; } if (isset($context['flash_height']) && $context['flash_height']) { $height = $context['flash_height']; } else { $height = 50; } $m->setDimension($width, $height); // assume a transparent background, except if explicitly configured if (isset($context['flash_background_r']) && isset($context['flash_background_g']) && isset($context['flash_background_b']) && $context['flash_background_r'] + $context['flash_background_g'] + $context['flash_background_b']) { $m->setBackground(intval($context['flash_background_r']), intval($context['flash_background_g']), intval($context['flash_background_b'])); } $m->setRate(24.0); // make a hit region for the button $hit = new SWFShape(); $hit->setRightFill($hit->addFill(0, 0, 0)); $hit->movePenTo(0, 0); $hit->drawLine($width, 0); $hit->drawLine(0, $height); $hit->drawLine(-$width, 0); $hit->drawLine(0, -$height); // actual transmission except on a HEAD request -- and on scripts/validate.php if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') { // load a font file -- still buggy http://bugs.php.net/bug.php?id=31047&edit=2 if (!isset($context['flash_font']) || !$context['flash_font']) { $context['flash_font'] = 'Bimini.fdb';