Question
A Bug of filters of AS3/FlashPlayer 9 ?
When developing AsWing A3, i discovered that the filters
works weird.
If i use scrollRect to a Sprite, the filters works well, but when i removed the filters, the renderers seems does not removed the filters graphics right.
The simpled test code is:
package{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.Rectangle;
import flash.text.*;
public class TestProj extends Sprite
{
private var sprite:Sprite;
private var cursor:Sprite;
private var text:TextField;
public function TestProj(){
sprite = new Sprite();
sprite.graphics.beginFill(0xff0000);
sprite.graphics.drawRect(0, 0, 100, 20);
sprite.graphics.endFill();
sprite.x = sprite.y = 100;
//if you comment this line, then every thing runs well
sprite.scrollRect = new Rectangle(0, 0, 100, 20);
stage.addEventListener(MouseEvent.MOUSE_DOWN, __mouseDown);
addChild(sprite);
cursor = new Sprite();
cursor.graphics.beginFill(0xffff00);
cursor.graphics.drawCircle(0, 0, 20);
cursor.graphics.endFill();
addChild(cursor);
cursor.startDrag(true);
text = new TextField();
text.text = "click the stage twice, " +
"and then move the yellow circle over the glowed rect to see the bug!";
text.autoSize = TextFieldAutoSize.LEFT;
text.y = 300;
addChild(text);
}
private function __mouseDown(e:MouseEvent):void{
if(sprite.filters == null || sprite.filters.length <= 0){
sprite.filters = [new GlowFilter(0x0000FF, 1, 10, 10, 4)];
}else{
sprite.filters = [];
}
}
}
}
And well, you can
See the movie here
Is it a bug of FlashPlayer? This is very important for our projects, hope it can be fixed in next version ...
Thanks very much!!!
If i use scrollRect to a Sprite, the filters works well, but when i removed the filters, the renderers seems does not removed the filters graphics right.
The simpled test code is:
package{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.Rectangle;
import flash.text.*;
public class TestProj extends Sprite
{
private var sprite:Sprite;
private var cursor:Sprite;
private var text:TextField;
public function TestProj(){
sprite = new Sprite();
sprite.graphics.beginFill(0xff0000);
sprite.graphics.drawRect(0, 0, 100, 20);
sprite.graphics.endFill();
sprite.x = sprite.y = 100;
//if you comment this line, then every thing runs well
sprite.scrollRect = new Rectangle(0, 0, 100, 20);
stage.addEventListener(MouseEvent.MOUSE_DOWN, __mouseDown);
addChild(sprite);
cursor = new Sprite();
cursor.graphics.beginFill(0xffff00);
cursor.graphics.drawCircle(0, 0, 20);
cursor.graphics.endFill();
addChild(cursor);
cursor.startDrag(true);
text = new TextField();
text.text = "click the stage twice, " +
"and then move the yellow circle over the glowed rect to see the bug!";
text.autoSize = TextFieldAutoSize.LEFT;
text.y = 300;
addChild(text);
}
private function __mouseDown(e:MouseEvent):void{
if(sprite.filters == null || sprite.filters.length <= 0){
sprite.filters = [new GlowFilter(0x0000FF, 1, 10, 10, 4)];
}else{
sprite.filters = [];
}
}
}
}
And well, you can
See the movie here
Is it a bug of FlashPlayer? This is very important for our projects, hope it can be fixed in next version ...
Thanks very much!!!