This is nice and simple code it creates the simple effect which you might have seen in lots of web sites. As it is PHP you can use the same from your own news reader to database.
setBackground(0x00,0x00,0x00);// SM - This is very important as it set sets the speed of the movie// SM - Higher the number faster the typing will appear$movie->setRate(3);// SM - This one will depends upon you$movie->setDimension(600,40);$movie->setFrames(31);$movie->nextFrame();// Define your String here $str = 'Miing Typewriter Effect'; /* SM - As you note The space between character if not fixed SM - due to font width so you have to figure out your own SM - Now we split our string and make an array with the same */ $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);// print_r($chars);$inc = 0 ;for($i=0;$isetFont($myFont); $myText->setColor(255,255,255); $myText->SetHeight(30); $myText->addString($chars[$i]); echo ("$chars[$i] \n") ; $firstText=$movie->add($myText); $firstText->moveTo($inc,30); $inc = $inc + 18; // SM - this is very critical as you need to add this extra frame to make this effect of some typewriter $movie->nextframe(); // SM - This helps to determine the width of the movie // SM - turn only if you need the same // echo "inc is $inc \n" ; } // SM - we do not want to loop this movie// $movie->add(new SWFAction("stop();")); // SM - Save the movie $movie->save("/tmp/banner.swf",9);?>
This space started as home grown hand written web site to a play ground of web technology. They are a Bengali couple currently staying at Bangalore with their little son. While he works in the field of IT and she is busy 24x7 in her new role of motherhood. Though they have not traveled much this year due to various personal & professional commitments it is only thing that bond them best. .....
Anand
June 28th, 2009 at 10:04 am
T tried this example but it was not working
santm
June 30th, 2009 at 10:09 am
@Anand, I do not have a linux machine at disposal to test the new version of Ming and php right now. Will comment back once tested.