ilteris kaplan
> Thanks Petro. It's interesting that if I set the this line
> _sprite.graphics.beginFill(0xFFFFFF); it doesn't work but if I set it
> like _sprite.graphics.beginFill(0xAABBCC); it works. Does anyone has
> any idea why?
Hi ilteris,
Hmm, this looks fairly weird, though there is a workaround: if by chance
you set the fill of a Sprite to be 0xFFFFFF (totally white) and want to
apply a new colour, instead of playing with offsets and multipliers, use
the .color property. Something like this:
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.ColorTransform;
public class ColorTransforma extends Sprite {
var _sprite:Sprite;
var color:ColorTransform;
public function ColorTransforma() {
_sprite = new Sprite();
_sprite.graphics.lineStyle(1, 0xFFFFFF);
_sprite.graphics.beginFill(0xFFFFFF);
_sprite.graphics.drawRect(0, 0, 100, 100);
_sprite.graphics.endFill( );
addChild(_sprite);
_sprite.addEventListener(MouseEvent.MOUSE_DOWN,
onMouseDown);
color = _sprite.transform.colorTransform;
_sprite.transform.colorTransform = color;
}
public function changeColor() {
color.color = 0xAABBCC;
_sprite.transform.colorTransform = color;
}
private function onMouseDown(event:MouseEvent):void {
changeColor();
trace("yay");
}
}
}
Cheers,
Petro
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com