SWFbutton SWFbutton (PHP 4 >= 4_0_5)
SWFbutton __ Creates a new Button_
Description new
swfbutton ( void )
Aviso Esta función
es EXPERIMENTAL _ Esto significa que el
comportamiento de esta función, el nombre de esta
función y en definitiva TODO lo documentado sobre esta
función, puede cambiar en una futura version de PHP SIN
AVISO_ La advertencia queda hecha, y utilizar esta extensión
queda bajo su propia responsabiliad_
swfbutton() creates a new Button_
Roll over it, click it, see it call action code_ Swank_
SWFButton has the following methods : swfbutton_>addshape() ,
swfbutton_>setup() , swfbutton_>setover()
swfbutton_>setdown() , swfbutton_>sethit()
swfbutton_>setaction() and
swfbutton_>addaction() _
This simple example will show your usual interactions with buttons :
rollover, rollon, mouseup, mousedown, noaction_
Ejemplo 1_ swfbutton() example
<?php
$f = new SWFFont("_serif");
$p = new SWFSprite();
function label($string)
{
global $f;
$t = new SWFTextField();
$t_>setFont($f);
$t_>addString($string);
$t_>setHeight(200);
$t_>setBounds(3200,200);
return $t;
}
function addLabel($string)
{
global $p;
$i = $p_>add(label($string));
$p_>nextFrame();
$p_>remove($i);
}
$p_>add(new SWFAction("stop();"));
addLabel("NO ACTION");
addLabel("SWFBUTTON_MOUSEUP");
addLabel("SWFBUTTON_MOUSEDOWN");
addLabel("SWFBUTTON_MOUSEOVER");
addLabel("SWFBUTTON_MOUSEOUT");
addLabel("SWFBUTTON_MOUSEUPOUTSIDE");
addLabel("SWFBUTTON_DRAGOVER");
addLabel("SWFBUTTON_DRAGOUT");
function rect($r, $g, $b)
{
$s = new SWFShape();
$s_>setRightFill($s_>addFill($r, $g, $b));
$s_>drawLine(600,0);
$s_>drawLine(0,600);
$s_>drawLine(_600,0);
$s_>drawLine(0,_600);
return $s;
}
$b = new SWFButton();
$b_>addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT);
$b_>addShape(rect(0, 0xff, 0), SWFBUTTON_OVER);
$b_>addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN);
$b_>addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"),
SWFBUTTON_MOUSEUP);
$b_>addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"),
SWFBUTTON_MOUSEDOWN);
$b_>addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"),
SWFBUTTON_MOUSEOVER);
$b_>addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"),
SWFBUTTON_MOUSEOUT);
$b_>addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"),
SWFBUTTON_MOUSEUPOUTSIDE);
$b_>addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"),
SWFBUTTON_DRAGOVER);
$b_>addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"),
SWFBUTTON_DRAGOUT);
$m = new SWFMovie();
$m_>setDimension(4000,3000);
$i = $m_>add($p);
$i_>setName("label");
$i_>moveTo(400,1900);
$i = $m_>add($b);
$i_>moveTo(400,900);
header('Content_type: application/x_shockwave_flash');
$m_>output();
?>
This simple example will enables you to drag draw a big red button
on the windows_ No drag_and_drop, just moving around_
Ejemplo 2_ swfbutton_>addaction() example
<?php
$s = new SWFShape();
$s_>setRightFill($s_>addFill(0xff, 0, 0));
$s_>drawLine(1000,0);
$s_>drawLine(0,1000);
$s_>drawLine(_1000,0);
$s_>drawLine(0,_1000);
$b = new SWFButton();
$b_>addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
$b_>addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse
SWFBUTTON_MOUSEDOWN);
$b_>addAction(new SWFAction("stopDrag();"),
SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE);
$p = new SWFSprite();
$p_>add($b);
$p_>nextFrame();
$m = new SWFMovie();
$i = $m_>add($p);
$i_>setName('test');
$i_>moveTo(1000,1000);
header('Content_type: application/x_shockwave_flash');
$m_>output();
?>