Glowing Orb
Description: Draw an orb that glows using actionscript
Author: John Bezanis
Added: January 20th 2007
Version: Flash 8

Select the Oval tool and hold shift to draw a perfect circle on the stage.

Select the gradient Transform Tool. In the color panel, set the Type to Linear. Set the colors to #1129FF and #A3ACFE. Spin the gradient by grabbing the circle and spinning it.

Right-click the circle, select Convert to Symbol, change the name to glowingorb, and click ok. Double click the circle, which will open up the new glowingorb symbol. In the timeline, click the create new layer button. Select the circle in the lower layer and right-click copy it. Select the higher layer, and Edit->Paste in Place.

Select the Gradient Transform Tool again. Set the type to Radial. Move the left color box to around 75% and set the color to #01108F and alpha to 0%. Change the right box color to #01108F and alpha to 70%. Copy this shape, create a new layer and paste it into this new layer.

Use the Free Transform Tool to shrink this new shape a bit. In the Color panel, set the type to Radial, the left color to #FFFFFF with 100% Alpha, and the right color to #FFFFFF with 0% Alpha. Click the paint bucket tool and click the top center of the shape. Select the Gradient Transform Tool, grab the circle with the arrow, and shrink the gradient.
Return to the main scene, select the Selection Tool, and single click the Orb. In the actions box, insert the following code:
- //This code executes when the orb is first loaded
- onClipEvent (load) {
- //Import the GlowFilter class
- import flash.filters.GlowFilter;
- //This is glow color
- var color:Number = 0xEB1D99;
- //No Transparency
- var alpha:Number = 1;
- //blurX and blurY are the height and width of the glow
- var blurX:Number = 5;
- var blurY:Number = 5;
- var strength:Number = 2;
- var quality:Number = 10;
- //Glow is outer
- var inner:Boolean = false;
- //Do not cut out the object
- var knockout:Boolean = false;
- //Create an instance of the GlowFilter class named filter
- var filter:GlowFilter = new GlowFilter(color, alpha, blurX, blurY, strength, quality, inner, knockout);
- //apply the filter
- this.filters = [filter];
- //The blur size starts at 5 and is set to grow
- var blurSize:Number=5;
- var blurGrowing:Boolean=true;
- }
- //This code executed on each frame
- onClipEvent (enterFrame) {
- //If the blur is set to grow, increase its size, otherwise shrink it.
- if(blurGrowing){ blurSize+=2; }
- else { blurSize-=2; }
- if(blurSize>40){
- blurSize=40;
- //Blur is getting too big. Set it to shrinking.
- blurGrowing=(!blurGrowing);
- }else if(blurSize<5){
- blurSize=5;
- //Blur is getting too small. Set it to growing.
- blurGrowing=(!blurGrowing);
- }
- //Alter the filter to the new blur size
- filter.blurY = blurSize;
- filter.blurX = blurSize;
- //Apply the change to the blurX and blurY
- this.filters = [filter];
- }
Download Source File
Comments Currently Disabled


