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->add($rm);
$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;
 }
}
$key_label->addString($key_label_text);
$my_key_label_header = new SWFShape();
$my_key_label_header->setLine(1, 0, 0, 0);
$my_key_label_header->setRightFill(240, 240, 240);
$my_key_label_header->movePenTo(0, 5);
$my_key_label_header->drawLine(150, 0);
$my_key_label_header->drawLine(0, 25);
$my_key_label_header->drawLine(-150, 0);
$my_key_label_header->drawLine(0, -25);
$my_key_label = new SWFSprite();
$my_key_label->add($my_key_label_header);
$key_spr = $my_key_label->add($key_label);
$key_spr->moveTo(5, 7);
$my_key_label->nextFrame();
$my_key_label_sprite = $entire_key->add($my_key_label);
$my_key_label_sprite->setName('my_key_label');
$display_eqp_icons = true;
if ($display_eqp_icons) {
    $ind_path = $path . "/htdocs/resources/img/style-1.1/images/";
    if ($status_symbol == 'yes') {
        $ex_clip = new SWFBitmap(fopen($ind_path . "icon_warning_sml.jpg", "r"));
        $check_clip = new SWFBitmap(fopen($ind_path . "icon_warning_sml.jpg", "r"));
        $equals_clip = new SWFBitmap(fopen($ind_path . "icon_warning_sml.jpg", "r"));
    }
    $empty_sprite = new SWFSprite();
    $m->addExport($empty_sprite, 'container');
    $main_actionscript = "\n\nvar greyscale = 225;\nvar j=1;\nvar gf = new flash.filters.GlowFilter(0xFFCC00, 10, 5, 5, 2, 1, false, false);\nvar selection;\n\nbackground.useHandCursor = false;\n\nbackground.onPress=function(){\n\tselection.selected=false;\n\tselection.filters=null;\n\tselection=null;\n};\n//onMouseDown=function() {\n//\tgetUrl('about:blank','config', 'GET');\n//};\nonMouseUp=function() {\n\tstopDrag();\n};\n\nfunction argbtohex(a, r, g, b)\n{\n\treturn (a<<24 | r<<16 | g<<8 | b);\n}\n\n// ICON CLASS\nfunction createIcon() {\n\tvar equipment_type_symbol = this.equipment_type_symbol;\n\tObject.registerClass('container', createNewFixture);\n\thandle = attachMovie('container',equipment_type_symbol, getNextHighestDepth());\n\n\tkey_icon = entire_key.attachMovie('container',equipment_type_symbol,getNextHighestDepth(),\n\t\t{_x:0,_y:this._y,equipment_type_id:this.equipment_type_id,equipment_type_image_id:this.equipment_type_image_id});\n\tkey_icon.my_bitmap = new flash.display.BitmapData(this._width,this._height,true,0x00000000);\n\tkey_icon.attachBitmap(key_icon.my_bitmap, 1);\n\tkey_icon.my_bitmap.draw(this);\n\n\tfor(i=_root.j;i>=0;--i) {\n\t\tvar rgb = _root.greyscale-i;\n\t\tvar my_color = _root.argbtohex(255,rgb,rgb,rgb);\n\t\tkey_icon.my_bitmap.threshold(key_icon.my_bitmap,key_icon.my_bitmap.rectangle,key_icon.my_bitmap.rectangle.topLeft,'>=',my_color,0x00000000,my_color,true);\n\t}\n};\ncreateIcon.prototype = new MovieClip();\n\n// NEW FIXTURE CLASS\nfunction createNewFixture() {};\ncreateNewFixture.prototype = new MovieClip();\n\ncreateNewFixture.prototype.onPress=function() {\n\tthis.createEmptyMovieClip('newone', getNextHighestDepth());\n\tthis.newone.attachBitmap(this.my_bitmap,2,auto,false);\n\tthis.newone.startDrag(lock);\n};\ncreateNewFixture.prototype.onRelease=createNewFixture.prototype.onReleaseOutside=function() {\n\tlocation_id={$my_address_id};\n\tequipment_type_id=this.equipment_type_id;\n\tsubmit='Submit';\n    type='new';\n\tx_position = _root._xmouse;\n\ty_position = _root._ymouse;\n\tgetURL('index.php?nid=ifp-equipment-edit-submit&location_id={$my_address_id}', '', 'POST');\n};\ncreateNewFixture.prototype.onRollOver=function() {\n\t//var dconf = new LoadVars();\n\t//dconf.location_equipment_id=100;\n\t//dconf.equipment_type_id=this.equipment_type_id;\n\t//dconf.equipment_type_image_id=this.equipment_type_image_id;\n\t//dconf.send('/acc/link/types/display_config/&body=true','config', 'POST');\n\t//dconf = null;\n};\n\n\n// INVENTORY CLASS\nfunction positionFixture() {\n\tthis.createEmptyMovieClip('symbol', this.getNextHighestDepth());\n\tthis.symbol.cacheAsBitmap = false;\n\tthis.symbol.createEmptyMovieClip('bitmap', this.getNextHighestDepth());\n\tthis.symbol.bitmap.attachBitmap(this.bitmap,2,auto,true);\n\tthis.symbol.bitmap._x=-this.symbol.bitmap._width/2;\n\tthis.symbol.bitmap._y=-this.symbol.bitmap._height/2;\n\tthis.symbol._rotation=this.symbol_rotation;\n\tthis.onPress=function() {\n\t\t// If clicked by not selected, select.\n\t\tif(this.selected!=true) {\n\t\t\tthis.startDrag(lock);\n\t\t\tselection.selected = null;\n\t\t\tselection.filters = [];\n\t\t\tthis.filters = [gf];\n\t\t\tthis.selected=true;\n\t\t\tselection=this;\n\t\t} else {\n\t\t\tvar my_corrFactor = 0;\n\t\t\tif (this._xmouse < 0){\n\t\t\t\tmy_corrFactor = 180;\n\t\t\t}\n\t\t\tvar counterbalance = (57.29578*(Math.atan(this._ymouse/this._xmouse)))+my_corrFactor;\n\t\t\tthis.onMouseMove=function() {\n\t\t\t\tdegreeAngle = (57.29578*(Math.atan(this._ymouse/this._xmouse)))-counterbalance;\n\t\t\t\tcorrFactor = 0;\n\t\t\t\tif (this._xmouse < 0){\n\t\t\t\t\tcorrFactor = 180;\n\t\t\t\t}\n\t\t\t\tthis.symbol._rotation = 15*int(degreeAngle/15)+corrFactor+this.symbol_rotation;\n\t\t\t};\n\t\t}\n\t};\n\tthis.onRelease=this.onReleaseOutside=function() {\n\t\tthis.onMouseMove = null;\n\t\tif(x_position!=this._x || y_position!=this._y || my_rotation!=this.symbol._rotation) {\n\t\t\tvar update_position = new LoadVars();\n\t\t\tupdate_position.location_equipment_id=this.my_leid;\n\t\t\tupdate_position.x_position = this._x - {$x_shift};\n\t\t\tupdate_position.y_position = this._y;\n\t\t\tupdate_position.rotation_angle = this.symbol._rotation;\n\t\t\tupdate_position.sendAndLoad('index.php?nid=ifp-location-equipment-position-edit',update_position,'POST');\n\t\t\tupdate_position = null;\n\t\t\tthis.symbol_rotation=this.symbol._rotation;\n\t\t}\n        var myjavascript = 'javascript:show_img('+this.my_eid+','+this.etid+');';\n        getURL(myjavascript);\n\n        // display_config\n        var my_dconf = new LoadVars();\n        my_dconf.location_equipment_id=this.my_leid;\n        my_dconf.equipment_id=this.my_eid;\n        my_dconf.location_address_id={$my_address_id};\n        my_dconf.equipment_type_id=this.etid;\n        my_dconf.equipment_type_image_id=this.equipment_type_image_id;\n        //my_dconf.send('index.php?nid=ifp-location-space-plan-key-update','config', 'POST');\n        my_dconf = null;\n\t};\n};\n\n\npositionFixture.prototype = new MovieClip();\n\n\n\n\nentire_key.my_key_label.onPress=function(){\n\t_root.entire_key.startDrag(lock);\n};\nentire_key.my_key_label.onRelease=entire_key.my_key_label.onReleaseOutside=function(){\n\tvar update_key = new LoadVars();\n\tupdate_key.key_x_position = _root.entire_key._x;\n\tupdate_key.key_y_position = _root.entire_key._y;\n\tupdate_key.location_space_plan_id = '{$location_space_plan_id}';\n\tupdate_key.location_id = '{$my_address_id}';\n\tupdate_key.sendAndLoad('index.php?nid=ifp-location-space-plan-key-update',update_key,'POST');\n};\nentire_key.cacheAsBitmap = true;\n";
    $symbol_pointers['filename'] = Nexista_Path::get('//equipment_types_get_all/equipment_types_get_all/file_pointer', 'flow');
    $symbol_pointers['name'] = Nexista_Path::get('//equipment_types_get_all/name', 'flow');
    $symbol_pointers['equipment_type_image_id'] = Nexista_Path::get('//equipment_types_get_all/equipment_type_icon_id', 'flow');