Rechercher une fonction PHP

SWFButton::__construct

(PHP 5 < 5.3.0, PECL ming SVN)

SWFButton::__constructCreates a new Button

Description

SWFButton::__construct ( void )
Warning

This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.

Creates a new Button.

PHP: SWFButton::__construct - Manual Home of Manuel PHP  Contents Haut

Examples

This simple example will show your usual interactions with buttons : rollover, rollon, mouseup, mousedown, noaction.

Example #1 Usual interactions with buttons

<?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(3200200);
  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(6000);
  
$s->drawLine(0600);
  
$s->drawLine(-6000);
  
$s->drawLine(0, -600);

  return 
$s;
}

$b = new SWFButton();
$b->addShape(rect(0xff00), SWFBUTTON_UP SWFBUTTON_HIT);
$b->addShape(rect(00xff0), SWFBUTTON_OVER);
$b->addShape(rect(000xff), 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(40003000);

$i $m->add($p);
$i->setName("label");
$i->moveTo(4001900);

$i $m->add($b);
$i->moveTo(400900);

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.

Example #2 Drag example

<?php

$s 
= new SWFShape();
$s->setRightFill($s->addFill(0xff00));
$s->drawLine(1000,0);
$s->drawLine(0,1000);
$s->drawLine(-1000,0);
$s->drawLine(0,-1000);

$b = new SWFButton();
$b->addShape($sSWFBUTTON_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();
?>

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-swfbutton.construct.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut