(PHP 5 < 5.3.0, PECL ming SVN)

SWFDisplayItem::multColorMultiplica la transformación de color del objeto


SWFDisplayItem::multColor ( float $red , float $green , float $blue [, float $a ] ) : void

Esta función ha sido declarada EXPERIMENTAL. Su funcionamiento, nombre y la documentación que le acompaña puede cambiar sin previo aviso en futuras versiones de PHP. Utilícela bajo su propia responsabilidad.

swfdisplayitem::multcolor() multiplica la transformación de color del objeto por los valores dados.

El objeto puede ser un swfshape(), un swfbutton(), un swftext() o un swfsprite(). Debe haber sido añadido usando swfmovie::add().


Estos parámetros son de tipo float entre 0.0 y 1.0:


Valor del componente rojo


Valor del componente verde


Valor del componente azul


Valor del componente alfa

Valores devueltos

No devuelve ningún valor.


Este sencillo ejemplo modificará la atmósfera del dibujo en Halloween (usar un dibujo apaisado o brillante).

Ejemplo #1 Ejemplo de swfdisplayitem::multcolor()


= new SWFBitmap(file_get_contents("backyard.jpg"));
// nota: use su propio dibujo :-)
$s = new SWFShape();
$s->drawLine($b->getWidth(), 0);
$s->drawLine(-$b->getWidth(), 0);
$s->drawLine(0, -$b->getHeight());

$m = new SWFMovie();
$m->setDimension($b->getWidth(), $b->getHeight());

$i $m->add($s);

for (
$n=0$n<=20; ++$n) {

header('Content-type: application/x-shockwave-flash');

add a note add a note

User Contributed Notes 1 note

9 years ago
Hey, this is a great function that I spent a lot of time looking for.

What is it great for? Fading. It gives you the ability to fade any supported object (including images) totally or even specific color channels.

The project I am working on requires a series of images and backgrounds to fade into each other. As a bit of a noob, I found the doc here and it's example a little confusing.

I thought that to provide a value for a color channel would change it, but it doesn't.

To say, just change the alpha channel value, you can write it like this

=new SWFMovie();

// image to add to movie

// add it image to movie and fade its alpha channel
$png = new SWFBitmap(fopen($img,"rb"));
$f1 = $movie->add($png);


This code will load the image and give it s 50% transperancy.

Similarly, one can fade a single color channel by reducing the value for that specific channel.


This makes the red channel (remember rgb) 50% transparent. You can put a 0 there to completely remove the red channel.

Hope this helps any fellow noobs trying to figure out ming out there.
To Top