Home > ActionScript 3.0 Basics > Glowing Button Effect

Glowing Button Effect

August 13th, 2009 Leave a comment Go to comments
Warning: file_get_contents(): URL file-access is disabled in the server configuration in /srv/www/vhosts/flashadvanced.com/httpdocs/wp-content/plugins/sociable-italia/sociable.php on line 672 Warning: file_get_contents(http://tinyurl.com/api-create.php?url=http%3A%2F%2Fflashadvanced.com%2Factionscript-3-basics%2Fglowing-button-effect%2F): failed to open stream: no suitable wrapper could be found in /srv/www/vhosts/flashadvanced.com/httpdocs/wp-content/plugins/sociable-italia/sociable.php on line 672



In this quick tutorial I am going to show you how to create a nice glowing button effect using Flash and few lines of AS3 code in order to control the button. Let’s get started

1. Open a new Flash document and save it under “GlowingButton.fla”. Set the color to #000000 and the frame rate to 24 fps.

2. Take the rectangle tool and from the properties panel set the values like this:

Choose #FFCC00 for color and draw a rectangle with size 120px wide by 30px high. Now take the Selection tool and select the half of the rectangle like this:

Change the color of the selected half to #FDD535. The button background is now ready. Nice effect, right?

3. Select the whole rectangle and convert it to Movie Clip symbol. Type “golden_btn” for instance name. Now double click the movie clip to go inside its timeline. Once again, select the whole rectangle and convert it to Movie Clip symbol.

4. Click on frame 20 and convert it to Keyframe. Now, on frame 20, select the movie clip, then open the Filters Panel and select the Glow filter like this:

For filter color choose #FFCC00.
Now select a frame between frame 1 and 20 and create Motion Tween. From the properties panel set the tween easing to 100. Select the whole 20 frames and then by right clicking select Copy Frames:

Select frame 21 and by right clicking select Paste Frames.
Now select the copied frames and again by right clicking select Reverse Frames.

5. Create new layer called “text”. Take the text tool and type something. For font choose Tahoma, bold, size 18, color #990000. Convert the text field to movie clip. Click on frame 20 and convert it to Keyframe.
When you are still on frame 20, select the text field movie clip, go to Properties Panel and under Color choose Tint. For color choose #000000:

Click somewhere between frame 1 and frame 20 and create Motion Tween. Repeat the step where you copy, paste and reverse the frames.

6. Create a new layer called “actions” and convert frame 20 and 40 to Keyframes. On frames 1, 20, 40 open the actions panel and type “stop();“.

Our glowing button is ready! All we have to do is to go back to the main Scene and type some actionscript.

7. On the main Scene, create a new layer called “actions” and open the Actions Panel.


//setting the button properties
golden_btn.mouseChildren = false;
golden_btn.buttonMode = true;

//adding event listeners to our button
golden_btn.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
golden_btn.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
golden_btn.addEventListener(MouseEvent.CLICK, mouseClickHandler);

function mouseOverHandler(e:MouseEvent):void{
	golden_btn.gotoAndPlay(2);
}

function mouseOutHandler(e:MouseEvent):void{
	golden_btn.gotoAndPlay(21);
}

function mouseClickHandler(e:MouseEvent):void{
	//navigating to URL on click
	navigateToURL(new URLRequest("http://flashadvanced.com"));
}

That's all!

Here is the final result:

Liked this tutorial? Share and Enjoy:

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Reddit
  • blogmarks
  • StumbleUpon
  • Technorati
  • TwitThis
  • Yahoo! Buzz
  • NewsVine
  • Slashdot
  1. September 14th, 2009 at 19:30 | #1

    Hi, very nice and interesting tutorial. I am thinking of using this effect with more than a button, could you please help me out with the script?

    Many thanks

    Kind regards,

    Gabriele Roberto

  2. admin
    September 20th, 2009 at 10:24 | #2

    Hey,
    there are several ways to make a menu with glowing buttons.
    You can use this tutorial as a start point and then go to ‘Animated buttons with AS3′ tutorial

  3. October 7th, 2009 at 12:44 | #3

    Thank you for your response.

    I have managed to find my way around and created a whole menu, but I am experiencing a small and yet annoying problem. Every link is opening on a new window, and I would like to add the code in order to open on the same browser window, eg. _self.

    Any idea? As always thank you for your help with this.

    Kind regards,

    G

  4. October 7th, 2009 at 17:27 | #4

    Nevermind, I have sorted:

    navigateToURL(new URLRequest(”http://www.kirupa.com”), ‘_self’);

    This would do.

    G

  5. porky
    October 29th, 2009 at 01:31 | #5

    that was awsome stuuf it blew me away with the whole glowing affect and i really liked it

  1. No trackbacks yet.