Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 2641

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>SWFbutton</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Ming functions for Flash"
HREF="ref.ming.html"><LINK
REL="PREVIOUS"
TITLE="SWFbutton->setUp"
HREF="function.swfbutton.setup.html"><LINK
REL="NEXT"
TITLE="SWFDisplayItem->addColor"
HREF="function.swfdisplayitem.addcolor.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.swfbutton.setup.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.swfdisplayitem.addcolor.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.swfbutton"
></A
>SWFbutton</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN53203"
></A
><P
>    (PHP 4 &#62;= 4.0.5)</P
>SWFbutton&nbsp;--&nbsp;Creates a new Button.</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN53206"
></A
><H2
>Description</H2
>new <B
CLASS="methodname"
>swfbutton</B
> ( void)<BR
></BR
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Warning</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>This function is
<SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>EXPERIMENTAL</I
></SPAN
>. The behaviour of this function, the
name of this function, and anything else documented about this
function may change without notice in a future release of PHP. 
Use this function at your own risk.</P
></TD
></TR
></TABLE
></DIV
><P
>&#13;     <B
CLASS="function"
>swfbutton()</B
> creates a new Button. 
     Roll over it, click it, see it call action code. Swank. 
    </P
><P
>&#13;     SWFButton has the following methods : <B
CLASS="function"
>swfbutton-&#62;addshape()</B
>,
     <B
CLASS="function"
>swfbutton-&#62;setup()</B
>, <B
CLASS="function"
>swfbutton-&#62;setover()</B
>
     <B
CLASS="function"
>swfbutton-&#62;setdown()</B
>, <B
CLASS="function"
>swfbutton-&#62;sethit()</B
>
     <B
CLASS="function"
>swfbutton-&#62;setaction()</B
> and 
     <B
CLASS="function"
>swfbutton-&#62;addaction()</B
>.
    </P
><P
>&#13;     This simple example will show your usual interactions with buttons : 
     rollover, rollon, mouseup, mousedown, noaction.
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN53226"
></A
><P
><B
>Example 1. <B
CLASS="function"
>swfbutton()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php

  $f = new SWFFont("_serif");

  $p = new SWFSprite();

  function label($string)
  {
    global $f;

    $t = new SWFTextField();
    $t-&#62;setFont($f);
    $t-&#62;addString($string);
    $t-&#62;setHeight(200);
    $t-&#62;setBounds(3200,200);
    return $t;
  }
  function addLabel($string)
  {
    global $p;

    $i = $p-&#62;add(label($string));
    $p-&#62;nextFrame();
    $p-&#62;remove($i);
  }

  $p-&#62;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-&#62;setRightFill($s-&#62;addFill($r, $g, $b));
    $s-&#62;drawLine(600,0);
    $s-&#62;drawLine(0,600);
    $s-&#62;drawLine(-600,0);
    $s-&#62;drawLine(0,-600);

    return $s;
  }

  $b = new SWFButton();
  $b-&#62;addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT);
  $b-&#62;addShape(rect(0, 0xff, 0), SWFBUTTON_OVER);
  $b-&#62;addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN);

  $b-&#62;addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"),
            SWFBUTTON_MOUSEUP);

  $b-&#62;addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"),
        SWFBUTTON_MOUSEDOWN);

  $b-&#62;addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"),
        SWFBUTTON_MOUSEOVER);

  $b-&#62;addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"),
        SWFBUTTON_MOUSEOUT);

  $b-&#62;addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"),
        SWFBUTTON_MOUSEUPOUTSIDE);

  $b-&#62;addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"),
        SWFBUTTON_DRAGOVER);

  $b-&#62;addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"),
        SWFBUTTON_DRAGOUT);

  $m = new SWFMovie();
  $m-&#62;setDimension(4000,3000);

  $i = $m-&#62;add($p);
  $i-&#62;setName("label");
  $i-&#62;moveTo(400,1900);

  $i = $m-&#62;add($b);
  $i-&#62;moveTo(400,900);

  header('Content-type: application/x-shockwave-flash');
  $m-&#62;output();
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     This simple example will enables you to drag draw a big red button
     on the windows. No drag-and-drop, just moving around.
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN53231"
></A
><P
><B
>Example 2. <B
CLASS="function"
>swfbutton-&#62;addaction()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php

  $s = new SWFShape();
  $s-&#62;setRightFill($s-&#62;addFill(0xff, 0, 0));
  $s-&#62;drawLine(1000,0);
  $s-&#62;drawLine(0,1000);
  $s-&#62;drawLine(-1000,0);
  $s-&#62;drawLine(0,-1000);

  $b = new SWFButton();
  $b-&#62;addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);

  $b-&#62;addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse
        SWFBUTTON_MOUSEDOWN);

  $b-&#62;addAction(new SWFAction("stopDrag();"),
        SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE);

  $p = new SWFSprite();
  $p-&#62;add($b);
  $p-&#62;nextFrame();

  $m = new SWFMovie();
  $i = $m-&#62;add($p);
  $i-&#62;setName('test');
  $i-&#62;moveTo(1000,1000);

  header('Content-type: application/x-shockwave-flash');
  $m-&#62;output();
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.swfbutton.setup.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.swfdisplayitem.addcolor.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SWFbutton-&#62;setUp</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.ming.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SWFDisplayItem-&#62;addColor</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>