Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: HomeFlash ForumFlash TutorialsFlash Video TutorialsWeb Streaming ForumAdobe FlashPodcast

movie clip within over button - hover state

Cow Forums : Adobe Flash

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>
movie clip within over button - hover state
by Mike Land on Mar 27, 2009 at 4:20:35 pm

Hi!

I've created buttons that when moused over trigger a movie clip that expands a little description of where the button leads. It works fine except immediately after clicked, the movie clip plays again.

I'm looking for AS3 that will play the movie clip and then disable until after the mouse leaves the hit field... without luck. Is this possible with AS3?


Thanks in advance,

Mike Land

Respond to this post   •   Return to posts index

Re: movie clip within over button - hover state
by Abraham Chaffin on Mar 27, 2009 at 10:48:15 pm

Unfortunately a button in AS3 has a lot of limitations. It's better to use a movie clip and synthetically add features to it to make it work like a button. Doing this will allow you much more flexibility for adding features like what you are talking about.

Not knowing exactly what you're doing I'll give you some general ideas of what you would need to do:

1) Convert the button to a movie clip in the library and on the stage.

2) Add some action script to have it use a hand cursor:

button_click_me.buttonMode = true;
button_click_me.useHandCursor = true;


3) In the first frame of the newly converted button put the stop action.

stop();


4) Add a mouse over function and listener to have the mouse over action:

function mouse_over_function(event:MouseEvent) {
button_click_me.gotoAndStop(2);

}

button_click_me.addEventListener(MouseEvent.MOUSE_OVER,mouse_over_function);


5) Add a mouse click function and listener to have the mouse click action:

function mouse_down_function(event:MouseEvent) {
button_click_me.gotoAndStop(4);

}

button_click_me.addEventListener(MouseEvent.MOUSE_DOWN,mouse_down_function);


6) Add a mouse out function and listener to have the action of it restoring to frame 1.

function mouse_out_function(event:MouseEvent) {
button_click_me.gotoAndStop(1);

}

button_click_me.addEventListener(MouseEvent.MOUSE_OUT,mouse_out_function);


You can modify all that as needed. here's the whole thing:



button_click_me.buttonMode = true;
button_click_me.useHandCursor = true;

function mouse_over_function(event:MouseEvent) {
button_click_me.gotoAndStop(2);

}
function mouse_out_function(event:MouseEvent) {
button_click_me.gotoAndStop(1);

}
function mouse_down_function(event:MouseEvent) {
button_click_me.gotoAndStop(4);

}

button_click_me.addEventListener(MouseEvent.MOUSE_DOWN,mouse_down_function);
button_click_me.addEventListener(MouseEvent.MOUSE_OVER,mouse_over_function);
button_click_me.addEventListener(MouseEvent.MOUSE_OUT,mouse_out_function);



Abraham

Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]