Example #1
0
/**
 * This functions was based on the example from
 * http://ming.sourceforge.net/examples/animation.html
 *
 * @param integer $r      Red
 * @param integer $g      Green
 * @param integer $b      Blue
 * @param integer $a      Alpha
 * @param integer $rot    Rotate
 * @param integer $x      X
 * @param integer $y      Y
 * @param integer $scale  Scale
 * @param string  $string String
 *
 * @return SWFMovie object
 */
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);
    return $i;
}
Example #2
0
 for ($i = 0; $i < $count; ++$i) {
     $t = new SWFText();
     $t->setFont($f);
     $t->setColor($r, $g, $b);
     $my_height = $height;
     while (true) {
         $t->setHeight($my_height);
         if ($t->getWidth($titles[$i]) < 0.9 * $width) {
             break;
         }
         $my_height = 0.9 * $my_height;
     }
     $x[$i] = 5;
     $y[$i] = ($height - $font_height) / 2;
     $t->moveTo($x[$i], $y[$i]);
     $t->addUTF8String($titles[$i]);
     $buttons[$i] = new SWFButton();
     $buttons[$i]->addShape($hit, SWFBUTTON_HIT);
     $buttons[$i]->addShape($t, SWFBUTTON_OVER | SWFBUTTON_UP | SWFBUTTON_DOWN);
     $buttons[$i]->addAction(new SWFAction("getURL('" . $links[$i] . "', '');"), SWFBUTTON_MOUSEUP);
 }
 for ($n = 0; $n < 4; ++$n) {
     for ($i = 0; $i < $count; ++$i) {
         $infunc = $infuncs[rand(0, count($infuncs) - 1)];
         $instance = $infunc($m, $buttons[$i], $x[$i], $y[$i]);
         for ($j = 0; $j < 60; ++$j) {
             $m->nextFrame();
         }
         $outfunc = $outfuncs[rand(0, count($outfuncs) - 1)];
         $outfunc($m, $buttons[$i], $instance, $x[$i], $y[$i]);
     }