Newest Articles

Flash Media Player
XML Driven Pie Chart
Base Defender
Hangman Game
8 Ball Pool

Popular Articles

Mp3 Player with XML Playlist
True Fullscreen Flash Mode
3d Rotating Image Cube
Hangman Game
Create Pong

Random Articles

iPod Style Wheel Slider
Flash Media Player
Image Rotator with blur and fadeout
Storing Data Similar to Cookies
Custom Right Click Menu
Krypto Movie Quotes


Shapes the Game
Link to SwfSpot
Swf Spot

Contact me on Google+

rss feed

Glowing Orb

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

Oval Tool
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.
Convert to Symbol
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.
Radial Gradient
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:
  1. //This code executes when the orb is first loaded
  2. onClipEvent (load) {
  3.   //Import the GlowFilter class
  4.   import flash.filters.GlowFilter;
  5.   //This is glow color
  6.   var color:Number = 0xEB1D99;
  7.   //No Transparency
  8.   var alpha:Number = 1;
  9.   //blurX and blurY are the height and width of the glow
  10.   var blurX:Number = 5;
  11.   var blurY:Number = 5;
  12.   var strength:Number = 2;
  13.   var quality:Number = 10;
  14.   //Glow is outer
  15.   var inner:Boolean = false;
  16.   //Do not cut out the object
  17.   var knockout:Boolean = false;
  18.   //Create an instance of the GlowFilter class named filter
  19.   var filter:GlowFilter = new GlowFilter(color, alpha, blurX, blurY, strength, quality, inner, knockout);
  20.   //apply the filter
  21.   this.filters = [filter];
  22.   //The blur size starts at 5 and is set to grow
  23.   var blurSize:Number=5;
  24.   var blurGrowing:Boolean=true;
  25. }
  26. //This code executed on each frame
  27. onClipEvent (enterFrame) {
  28.   //If the blur is set to grow, increase its size, otherwise shrink it.
  29.   if(blurGrowing){ blurSize+=2; }
  30.   else { blurSize-=2; }
  31.   if(blurSize>40){
  32.     blurSize=40;
  33.     //Blur is getting too big. Set it to shrinking.
  34.     blurGrowing=(!blurGrowing);
  35.   }else if(blurSize<5){
  36.     blurSize=5;
  37.     //Blur is getting too small. Set it to growing.
  38.     blurGrowing=(!blurGrowing);
  39.   }
  40.   //Alter the filter to the new blur size
  41.   filter.blurY = blurSize;
  42.   filter.blurX = blurSize;
  43.   //Apply the change to the blurX and blurY
  44.   this.filters = [filter];
  45. }

Download Source File
Comments Currently Disabled