GlowFilter 類對顯示對象應用加亮效果,使顯示對象看起來像是被下方的燈光照亮,可創造出一種柔和發光效果。html
與投影濾鏡相似,發光濾鏡包括的屬性可修改光源的距離、角度和顏色,以產生各類不一樣效果。GlowFilter 還有多個選項用於修改發光樣式,包括內側或外側發光和挖空模式。spa
如下代碼使用 Sprite 類建立一個交叉對象並對它應用發光濾鏡:code
import flash.display.Sprite; import flash.filters.BitmapFilterQuality; import flash.filters.GlowFilter; // Create a cross graphic. var crossGraphic:Sprite = new Sprite(); crossGraphic.graphics.lineStyle(); crossGraphic.graphics.beginFill(0xCCCC00); crossGraphic.graphics.drawRect(60, 90, 100, 20); crossGraphic.graphics.drawRect(100, 50, 20, 100); crossGraphic.graphics.endFill(); addChild(crossGraphic); // Apply the glow filter to the cross shape. var glow:GlowFilter = new GlowFilter(); glow.color = 0x009922; glow.alpha = 1; glow.blurX = 25; glow.blurY = 25; glow.quality = BitmapFilterQuality.MEDIUM; crossGraphic.filters = [glow];