?php / * sprite has one letter per frame * / $p = new SWFSprite(); $p - add(new SWFAction("stop() ;")); $chars = "abcdefghijklmnopqrstuvwxyz". "ABCDEFGHIJKLMNOPQRSTUVWXYZ". "1234567890!@#$%^ / *()_+-= / []{}_BAR_;:,. ?`~"; $f = new SWFFont("_sans"); for($n=0; $nremove($i); $t = new SWFTextField(); $t - setFont($f); $t - setHeight(240); $t - setBounds(600,240); $t - align(SWFTEXTFIELD_ALIGN_CENTER); $t - addString($c); $i = $p - add($t); $p - labelFrame($c); $p - nextFrame();} / * hit region for button - the entire frame * / $s = new SWFShape(); $s - setFillStyle0($s - addSolidFill(0, 0, 0, 0)); $s - drawLine(600, 0); $s - drawLine(0, 400); $s - drawLine(-600, 0); $s - drawLine(0, -400); / * button checks for pressed key, sends sprite to the right frame * / $b = new SWFButton(); $b - addShape($s, SWFBUTTON_HIT); for($n=0; $naddAction(new SWFAction( "setTarget(' / char'); gotoFrame('$c'); "), SWFBUTTON_KEYPRESS($c));} $m = new SWFMovie(); $m - setDimension(600,400); $i = $m - add($p); $i - setName('char'); $i - moveTo(0,80); $m - add($b); header('Content-type: application / x-shockwave-flash'); $m - output();?
?php / * Le sprite n'a qu'une lettre par image * / $p = new SWFSprite(); $p - add(new SWFAction("stop() ;")); $chars = "abcdefghijklmnopqrstuvwxyz". "ABCDEFGHIJKLMNOPQRSTUVWXYZ". "1234567890!@#$%^ *()_+-= / []{}_BAR_;:,. ?`~"; $f = new SWFFont("_sans"); for($n=0; $nremove($i); $t = new SWFTextField(); $t - setFont($f); $t - setHeight(240); $t - setBounds(600,240); $t - align(SWFTEXTFIELD_ALIGN_CENTER); $t - addString($c); $i = $p - add($t); $p - labelFrame($c); $p - nextFrame();} / * région de clic pour le bouton: toute la fenêtre * / $s = new SWFShape(); $s - setFillStyle0($s - addSolidFill(0, 0, 0, 0)); $s - drawLine(600, 0); $s - drawLine(0, 400); $s - drawLine(-600, 0); $s - drawLine(0, -400); / * le bouton s'assure des touches pressées, et envoie le bon sprite à l'image de droite * / $b = new SWFButton(); $b - addShape($s, SWFBUTTON_HIT); for($n=0; $naddAction(new SWFAction( "setTarget(' / char'); gotoFrame('$c'); "), SWFBUTTON_KEYPRESS($c));} $m = new SWFMovie(); $m - setDimension(600,400); $i = $m - add($p); $i - setName('char'); $i - moveTo(0,80); $m - add($b); header('Content-type: application / x-shockwave-flash'); $m - output();?