hi
i can't seam to create a proper SWFSprite. It creates a empty object (dump_var()) and
when i want to add a shape it says:
Warning: add(): Unable to find property sprite
in /var/www/testTypo/fileadmin/php/test.php on line 110
Fatal error: add(): Called object is not an SWFSprite
in /var/www/testTypo/fileadmin/php/test.php on line 110
I'm using php 4.4.2-1-1 and ming 0.4.0 beta4 and apache2. The rest of
ming works fine. i've tried to install the cvs version but i get an error when executing
./autogen.sh
error:
Running aclocal -I macros
Running libtoolize --automake
Running autoheader -f
Running automake
automake: configure.in: required file config/mkinstalldirs' not found
Makefile.am:13: additionnal_dist_subdirs defined both conditionally and unconditionally
Makefile.am:11: optiondist-bzip2' not recognized
Makefile.am:11: require version 1.4d, but have 1.4-p6
test/Movie/add/Makefile.am:13: variable NULL' not defined
test/Movie/add/Makefile.am:18: variableNULL' not defined
test/Movie/add/Makefile.am:13: variable NULL' not defined
test/Movie/add/Makefile.am:18: variableNULL' not defined
test/Movie/add/Makefile.am:25: variable NULL' not defined
automake: test/actionscript/Makefile.am: not supported: source file../run_test.c' is in subdirectory
automake: test/actionscript/Makefile.am: not supported: source file `../../util/makeswf_utils.c' is in subdirectory
util/Makefile.am: listmp3_OBJECTS should not be defined
Something went wrong, bailing out!
it seems i have to downgrade dist-bzip2 ???
it's driving me up the wall, help is needed!
thanks
my code:
include 'config.php';
$path =
substr($_SERVER['SCRIPT_FILENAME'],0,strpos($_SERVER['SCRIPT_FILENAME'],
'fileadmin'));
$width = $size['video']['w'];
$height = $size['video']['h'];
$r = 150;
$g = 150;
$b = 150;
ming_useswfversion(7);
$movie=new SWFMovie(7);
$movie->setDimension($width, $height + 30 + 20);
$movie->setBackground($r,$g,$b);
$x = 0;
$y = 0;
$stream = new SWFVideoStream();
$stream->setDimension($width, $height);
$item = $movie->add($stream);
$item->moveTo($x, $y);
$item->setname("video");
$action_string = "connection = new NetConnection();
connection.connect(null);
stream = new NetStream(connection);
video.attachVideo(stream);
stream.setBufferTime(10);
stream.play('http://localhost/testTypo/newsFiles/video/19.flv');";
$action = new SWFAction($action_string);
$movie->add($action);
$x = 0;
$y = $size['video']['h'];
function ImageShape($name) {
global $path;
$img = new SWFBitmap(fopen($path.'images/'.$name.'.dbl', "rb"));
$w = $img->getWidth();
$h = $img->getHeight();
$shape = new SWFShape();
$shape->setLine(1,241,239,235);
$fill = $shape->addFill($img, SWFFILL_TILED_BITMAP);
$shape->setRightFill($fill);
$shape->drawLine($w,0);
$shape->drawLine(0,$h);
$shape->drawLine(-$w,0);
$shape->drawLine(0,-$h);
return $shape;
}
function AddButton($movie, $name, $action, $x, $y) {
GLOBAL $path;
$button = new SWFButton();
$flags = (SWFBUTTON_UP | SWFBUTTON_HIT | SWFBUTTON_OVER |
SWFBUTTON_DOWN);
$button->addShape(ImageShape($name), $flags);
$button->addAction(new SWFAction($action), SWFBUTTON_MOUSEDOWN);
$button_ref = $movie->add($button);
$button_ref->moveTo($x, $y);
}
function SetupNavigation($movie, $x, $y) {
global $path;
$BUTTON_WIDTH = 35;
$BUTTON_HEIGTH = 30;
$old_x = $x;
AddButton($movie, "play", 'stream.play("19.flv");', $x, $y);
$x += $BUTTON_WIDTH;
AddButton($movie, "pause", 'stream.pause();', $x, $y);
$x += $BUTTON_WIDTH;
AddButton($movie, "stop", 'stream.pause(true);stream.seek(0.01);', $x,
$y);
$x += $BUTTON_WIDTH;
$img = new SWFBitmap(fopen($path."images/display.dbl", "rb"));
$display = $movie->add($img);
$display->moveTo($x, $y);
$x = $old_x;
$y += 30;
$img = new SWFBitmap(fopen($path."images/slider.dbl", "rb"));
$slider = $movie->add($img);
$slider->moveTo($x, $y);
$x_max = $img->getWidth() + $x;
//SimpleSlider($movie, $x, $x_max, $y);
}
SetupNavigation($movie, $x, $y);
$xMin = 10;
$xMax = 10000;
$shape = new SWFShape();
$shape->setLine(4,25,0,0,128);
$shape->movePenTo(0, 5);
$shape->drawLineTo(0, 10);
$mc = new SWFSprite();
$mc->add($shape); // line 110
$mc->nextFrame();
$slider = $movie->add($mc);
$slider->moveTo($xMin, $y);
$a = new SWFAction("startDrag(this, $xMin, $y, $xMax, $y, 1); drag =
true;");
$slider->addAction($a, SWFACTION_MOUSEDOWN);
$a = new SWFAction("stopDrag(); drag=flase;");
$slider->addAction($a, SWFACTION_MOUSEUP);
$slider_action = "// width in px
width = xMax - xMin;
paused = false;
if(drag) {
//pause stream while seeking
_global.stream.pause(true);
paused = true;
x = _root._xmouse - xMin;
seekTo = (_global.streamLen / width) * x;
_global.stream.seek(seekTo);
}
else {
pos = (_global.stream.time * (width / _global.streamLen)) +
xMin;
this._x = pos;
this._y = y;
}
//restart paused stream
if(paused)
{
_global.stream.pause(false);
}";
$a = new SWFAction($slider_action);
$slider->addAction($a, SWFACTION_ENTERFRAME);
//add subtitle
$t = new SWFText();
$t->setFont(new SWFFont('Bitstream Vera Sans.fdb'));
$t->addString('this is a subtitle');
$t->setColor(255,255,255);
//$t->setHeight(20);
//$t->setBounds(320,20);
//$t->setName('subtitle');
$i = $movie->add($t);
$i->moveTo(0, $size['video']['h'] - 10);
$t->addString('this is the 2. subtitle');
$movie->nextFrame();
$movie->save("../../newsFiles/video/19.swf");