Hi Alfeu,

Globalalpha applies to all shapes drawn. Is you set it to a value less than one, anything drawn will be at that level of opacity, globally. To get around this, change it back to 1 before drawing stuff you don't want transparent.

Regards,
Max Carlson
OpenLaszlo

Alfeu Marcatto wrote:
I want highlight the box when the mouse is over it and
return to default color when the mouse exit.
But, if I use globalAlpha < 1 (with some transparency), the
color of strokeStyle don't return to default when the mouse exit.
The color is affected by transparency.

Any suggestion?

Thanks,

<canvas width="100" height="100">
<class name="box" extends="drawview"
onmouseover="changeStroke(this,'over');"
onmouseout="changeStroke(this,'out');"
 >
<attribute name="strokeColor" value="0xffff00" type="string"/>

<method event="oninit">
this.beginPath();
this.moveTo(50,50);
this.lineTo(50, 0);
this.lineTo(0, 0);
this.lineTo(0, 50);
this.closePath();

this.fillStyle = "0x00ffff";
this.globalAlpha = .5;
this.fill();

this.strokeStyle = this.strokeColor;
this.lineWidth = 4;
this.stroke();
</method>
</class>

<script>
function changeStroke(oCaller, mouseAction) {
var strokeColor = "0xffff00";

if (mouseAction == 'over') {
strokeColor = "0xff00ff";
}

oCaller.strokeStyle = strokeColor;
oCaller.lineWidth = 4;
oCaller.stroke();
}
</script>

<box/>

</canvas>

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user


_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to