FORUMS: list search recent posts

animated movie clip buttons

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
wingmann13
animated movie clip buttons
on Jul 4, 2007 at 6:42:56 am

I am having a heck of a time creating my own animated buttons out of movie clips. I can't find a tutorial that deals with ActionScript 3, they are all older tutorials and when I try to use the actionScript it never works unless I change the AS settings to an older version of course, which I don't really want to do.

I am creating the movie clip in After Effects and importing as a png image sequence and placing it in a movie clip. I just want the movie to play on a roll-over, and fade out or stop on a roll-out.Could anyone out there help me?? Thanks


Return to posts index

Sher Ali
Re: animated movie clip buttons
on Jul 4, 2007 at 11:59:34 am

let say you have a movieclip:
my_movieclip

and you have labeled frames inside my_movieclip like:
over
out
etc.


now add this to the keyframe(I assume that you are using the first keyframe):

my_movieclip.addEventListener(MouseEvent.ROLL_OVER,overHandler);
my_movieclip.addEventListener(MouseEvent.ROLL_OUT,outHandler);

function overHandler(event:MouseEvent):void{
event.currentTarget.gotoAndPlay("over");
}
function outHandler(event:MouseEvent):void{
event.currentTarget.gotoAndPlay("out");
}

if you have many buttons then add the following two lines for each buttone(movieclip):
button_name.addEventListener(MouseEvent.ROLL_OVER,overHandler);
button_name.addEventListener(MouseEvent.ROLL_OUT,outHandler);

------------------
Sher Ali


Return to posts index

cow
wingmann13
movie clip buttons, hit area
on Jul 5, 2007 at 8:26:28 pm

Cool, it worked great! Thank you for the help, much appreciated. I have one more question though. My mouse arrow doesn't change to the finger pointer when I rollover my button (movie clip). Do I need more Action Script for this to happen, and is it possible to designate a hit area??

Adam


Return to posts index


Sher Ali
Re: movie clip buttons, hit area
on Jul 5, 2007 at 9:23:44 pm

add the following line for each button:
my_movieclip.buttonMode = true;


-------------------------------
Sher Ali


Return to posts index

wingmann13
Hit Area is Too Big
on Jul 6, 2007 at 5:50:57 pm

So I am almost there. So far I have created a working movie clip button that incorporates a cool After Effects animation on a mouse rollover. The mouse arrow also changes to the pointer finger when highlighted which is all good, BUT;

The hit area for my button is way too large now since the movie clip has taken on the properties of a button.I tried to create another movie clip in the same layer that was the correct size to act as the
hit area that I wanted. I also made it transparent but I know my action scripting must be wrong.

Is there a way to do this or should I try a different way to customize my hit area?? The help has been much appreciated, Thanks Sher!

Here is my AS:

function overHandler(event:MouseEvent):void {
event.currentTarget.gotoAndPlay("over");
}

hit_btn.addEventListener(MouseEvent.ROLL_OVER,overHandler);
hit_btn.buttonMode = true;
hit_btn.visible = false;
animation_btn.hitArea = hit_btn;


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]