FORUMS: list search recent posts

Animated flash button

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jorgo Kusters
Animated flash button
on Apr 27, 2011 at 11:53:39 am

First of all, I am a Flash newbie. Now here is wat I want to build:
an image grows larger on screen when the mouse hoovers over it, then you are able to click on 4 buttons within that image.
I have read various tutorials and have managed to create the button/image. Also I have found a way to make an image grow when the mouse hoovers over it. But once that is working, the buttons stop working...
hmmm, seems it should be rather simple...
here is the button script (AS2)

knop1.onRelease = function () {
getUrl ("") ;

knop2.onRelease = function () {
getUrl ("") ;
and this is the hoover
snelstart.onRollOver = function () {
snelstart.gotoAndPlay ("_over");
snelstart.onRollOut = function () {
snelstart.gotoAndPlay ("_out");


Return to posts index

demetri tashie
Re: Animated flash button ( AS3 prejudiced response )
on Apr 27, 2011 at 7:14:00 pm

hi jorgo,

since you are a newbie, can i make a few suggestions? if you are beginning out, don't start off by learning AS2. You'll be a lot better off in my opinion to just go ahead and start learning AS3. AS2 is outdated. it's like wanting to learn modern English by first learning Elizabethan Englsih. sure AS2 might seem easier at first, but "methinks that thou wouldst geinen better learning" by diving right into AS3.

full disclosure : i admit - i never really learned AS2, and that's one reason i normally don't answer AS2 questions.

second thing is that i suggest you approach making that movieclip that contains the 4 other movieclip/buttons programatically rather than as a timeline based animation. besides making your file size smaller, you will have a much easier time accounting for the 'mouse out'/ 'roll out' events. and if you truly are just increasing the size on mouse over/roll over, then using a tweening engine such as Greensock's TweenLite is perfect for the job, and much easier than Flash's Tween class. you can get it here: ( it is free, but consider donating to them once you see how great it is..)

if you want to try it out using AS3 and TweenLite, you can look at this code:
import gs.*; // substitute the import path to YOUR copy of TweenLite/Max here

btn.scaleX = .2; // your value will differ
btn.scaleY = .2; // your value will differ
btn.addEventListener(MouseEvent.MOUSE_OVER, itGrows);
btn.addEventListener(MouseEvent.MOUSE_OUT, itShrinks);

function itGrows(e:MouseEvent):void
{, 1, {scaleX:1, scaleY:1 });
btn.btn1.addEventListener(MouseEvent.CLICK, getsURL);
btn.btn2.addEventListener(MouseEvent.CLICK, getsURL);

function itShrinks(e:MouseEvent):void
{, 1, {scaleX:.2, scaleY:.2 });
btn.btn1.removeEventListener(MouseEvent.CLICK, getsURL);
btn.btn2.removeEventListener(MouseEvent.CLICK, getsURL);

function getsURL(e:MouseEvent):void

if ( == 'btn1')
navigateToURL(new URLRequest(""));
if ( == 'btn2')
navigateToURL(new URLRequest(""));


the movieclip was created, amd given the instance name "btn". inside of 'btn' are two other movieclips(or simple buttons if you prefer) with instance names 'btn1' and 'btn2'. add more buttons if you want.

'btn' was initially sized down 20% to .2 to make it smaller.

event listeners are added to 'btn' for the mouse over and mouse out states.

on mouse over, the 'btn' clip uses TweenLite to grow to full size(100% = 1). i also chose to add the event listeners for 'btn1' and 'btn2' here.

like wise the mouse out code reverses the mouse over function

the click function checks which clip was clicked by checking it's instance name ( the '' ), and navigates to the correct URL based on that.

i hope that helps out and gets you started on the right foot to using AS3. maybe someone else can offer you more help and suggestions if you choose to stick with AS2.

Return to posts index

Greg Neumayer
Re: Animated flash button ( AS3 prejudiced response )
on Apr 28, 2011 at 6:00:29 pm

I just want to add my 2-cents as well for AS3:
I learned coding with AS2, and then switched over to AS3 while just getting my bearings. If you're also trying to learn how to successfully think in terms of the programming, don't add to your struggle by using methodologies and syntax that are outdated. Unless you've got a good reason, (and I can only think of one--the client needs it) start with AS3. You'll be less confused in the long run and find that while easy tasks initially seem more verbose, more complex tasks are actually simplified by using AS3.

Antifreeze Design

Return to posts index

Jorgo Kusters
Re: Animated flash button ( AS3 prejudiced response )
on Apr 29, 2011 at 10:46:34 am

Thanks! This is exactly what i need!!!
(and how simple it turns out to be with the right tools :-)

Thanks again!

Kind Regards,

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved