Santanu
Santanu

General

create typewriter effect with ming php for flash (swf) movie

Moe Magick

A description of cover image.

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);?>
29 Nov   2005

Metro in Paris

Local Transport