Example #1
0
function makeImgMovie($imgFile)
{
    //Make sure this file is an actual jpg file
    if (is_file($imgFile) && ereg("\\.jpg\$", $imgFile)) {
        //Launch Flash
        $movie = new swfMovie();
        $movie->setBackground(255, 255, 255);
        //Import a bitmap
        $b = new SWFBitmap(fOpen($imgFile, "rb"));
        //Get it's width and height
        $w = $b->getWidth();
        $h = $b->getHeight();
        //Make stage as big as the width and height of our bitmap
        $movie->setDimension($w, $h);
        //Convert Bitmap to a shape for Flash.
        //This process is automated upon import in Flash, but with
        //Ming we have have to do it ourselves. I see it as more control:)
        $s = new SWFShape();
        $f = $s->addFill($b);
        $s->setRightFill($f);
        //draw corners for the bitmap shape
        $s->drawLine($w, 0);
        $s->drawLine(0, $h);
        $s->drawLine(-$w, 0);
        $s->drawLine(0, -$h);
        //CreateEmptyMovieclip
        $p = new SWFSprite();
        //add our bitmap shape to this movieclip
        $p->add($s);
        $p->nextFrame();
        //Add this movieclip to our main movie's timeline
        //Much like dragging a symbol from the library in Flash.
        $i = $movie->add($p);
        //Give this instance a name.. let's call it mImg as in movie image
        $i->setName("mImg");
        //Output the movie.. Ctrl+Enter!
        // header("Content-Type:application/x-shockwave-flash");
        $movie->output();
    }
    //End if
}
Example #2
0
<?php

$s = new SWFShape();
$fp = fopen('../../intro/php-big.jpg', 'r');
$jpg = new SWFBitmap($fp);
$w = $jpg->getWidth();
$h = $jpg->getHeight();
$f = $s->addFill($jpg);
$f->moveTo(-$w / 2, -$h / 2);
$s->setRightFill($f);
$s->movePenTo(-$w / 2, -$h / 2);
$s->drawLine($w, 0);
$s->drawLine(0, $h);
$s->drawLine(-$w, 0);
$s->drawLine(0, -$h);
$p = new SWFSprite();
$i = $p->add($s);
for ($step = 0; $step < 360; $step += 2) {
    $p->nextFrame();
    $i->rotate(-2);
}
$m = new SWFMovie();
$i = $m->add($p);
$i->moveTo(230, 120);
$m->setRate(100);
$m->setDimension($w * 1.8, $h * 1.8);
header('Content-type: application/x-shockwave-flash');
$m->output(6);
Example #3
0
$src->nextFrame();
$racket_computer = $m->add($src);
$racket_computer->moveTo(630, 215);
$racket_computer->setName("racketComputer");
// Adds the "grass"
$grass_top = $m->add($gm);
$grass_top->moveTo(0, 0);
$grass_bottom = $m->add($gm);
$grass_bottom->moveTo(0, 480);
// Adds the while line
$whiteline = $m->add($wl);
$whiteline->moveTo(316, 0);
// Adds the ball to the movie (within a sprite)
$sb = new SWFSprite();
$sb->add($bm);
$sb->nextFrame();
$ball = $m->add($sb);
$ball->moveTo(316, 240);
$ball->setName("zeBall");
// Adds scores
$score_player = $m->add($sp);
$score_player->moveTo(320 - $f->getWidth("Player : 0") / 3, 20);
$score_computer = $m->add($sc);
$score_computer->moveTo(330, 20);
// Finally, adds signature
$signit = $m->add($signature);
$signit->moveTo(5, 460);
// Hides the mouse (action script code)
$m->add(new SWFAction('Mouse.hide();'));
?>
 
Example #4
0
 public function AddImage($szPath, $time, $depth, $num, $disp, $isEnd, $effectNum)
 {
     //
     echo "path : ", $szPath, "<br>";
     //exit;
     //$bitmap= new SWFBitmap(fopen($szPath, "rb"));
     $path = "./" . $szPath;
     $bitmap = new SWFBitmap(fopen($szPath, "rb"));
     //$bitmap = new SWFBitmap(fopen($szPath,"rb"));
     $width = $bitmap->getWidth();
     $height = $bitmap->getHeight();
     $cx = $this->m_Width / 2 - $width / 2;
     $cy = $this->m_Height / 2 - $height / 2;
     // add the square to a sprite
     $sprite1 = new SWFSprite();
     $disp_1 = $sprite1->add($bitmap);
     $disp_1->moveTo(-1 * $width / 2, -1 * $height / 2);
     $sprite1->nextFrame();
     $sprite2 = new SWFSprite();
     $disp_1 = $sprite2->add($sprite1);
     $disp_1->moveTo(0, 0);
     $sprite2->nextFrame();
     $disp_1 = $this->m_oMovie->add($sprite2);
     $cx += $width / 2;
     $cy += $height / 2;
     $disp_1->moveTo($cx, $cy);
     $disp_1->setDepth($depth);
     //CString str;
     if ($disp != NULL) {
         if ($effectNum == 0) {
             $this->EffectManage($disp_1, $num - 1);
         } else {
             if ($effectNum == 1) {
                 $this->EffectManage($disp, $num - 1);
             } else {
                 if ($effectNum == 2) {
                     $this->EffectManage2($disp, $disp_1, $num - 1, true);
                     $this->EffectManage2($disp_1, NULL, $num - 1, false);
                 }
             }
         }
         $disp->remove();
     }
     $nTime = $time * $this->FRAMES;
     if ($disp != NULL) {
         $nTime = $nTime + $this->FRAMES;
     }
     if ($isEnd == false) {
         for ($i = 0; $i < $nTime; $i++) {
             $this->m_oMovie->nextFrame();
         }
     }
     return $disp;
 }
Example #5
0
 public function WhiteAndBlack($color)
 {
     // drawing a red square shape (registration point : centered)
     $width = $this->m_Width;
     $height = $this->m_Height;
     //echo "width : $width , height : $height <br>";
     $squareshape = new SWFShape();
     if ($color == "white") {
         $squareshape->setRightFill(255, 0, 0);
     } else {
         $squareshape->setRightFill(0, 0, 0);
     }
     //$squareshape->movePenTo(-$width/2,-$height/2);
     $squareshape->drawLine($width, 0);
     $squareshape->drawLine(0, $height);
     $squareshape->drawLine(-$width, 0);
     $squareshape->drawLine(0, -$height);
     $squaresprite = new SWFSprite();
     $f1 = $squaresprite->add($squareshape);
     //$f1->moveTo(-$width/2,-$height/2);
     $squaresprite->nextFrame();
     $disp = $this->m_oMovie->add($squaresprite);
     $disp->moveTo(-$width, -$height);
     $disp->setDepth($this->m_nColorDepth);
     $this->m_nColorDepth = $this->m_nColorDepth + 1;
     return $disp;
 }
             $kt->setFont($f);
             $kt->setHeight(11);
             $kt->setBounds(170, 25);
             $kt->addString("{$name}");
             $kt2 = $entire_key->add($kt);
             $kt2->moveto(37, 11 + $my_y_pos);
             unset($container);
         }
     }
 }
 unset($kt);
 unset($kt2);
 unset($name);
 unset($symbol_pointers);
 if ($_GET['key'] == 'yes' || $_GET['key'] == '') {
     $entire_key->nextFrame();
     $i = $m->add($entire_key);
     $i->setName('entire_key');
     $i->moveTo($key_x_position, $key_y_position);
 }
 unset($i);
 /* NOW BEGINS THE FIXTURE ICONS THAT ARE IN INVENTORY!!! */
 $assets['x_pos'] = Nexista_Path::get('//equipment_get_all/x_position', 'flow');
 if ($assets['x_pos'] != NULL) {
     $assets['y_pos'] = (array) Nexista_Path::get('//equipment_get_all/equipment_get_all/y_position', 'flow');
     $assets['rotation_angle'] = (array) Nexista_Path::get('//equipment_get_all/rotation_angle', 'flow');
     $assets['equipment_type_id'] = (array) Nexista_Path::get('//equipment_get_all/equipment_type_id', 'flow');
     $assets['location_equipment_id'] = (array) Nexista_Path::get('//equipment_get_all/location_equipment_id', 'flow');
     $assets['equipment_id'] = (array) Nexista_Path::get('//equipment_get_all/my_equipment_id', 'flow');
     $assets['asset_id'] = (array) Nexista_Path::get('//equipment_get_all/asset_id', 'flow');
     $assets['equipment_type_image_id'] = (array) Nexista_Path::get('//equipment_get_all/equipment_type_image_id', 'flow');