FORUMS: list search recent posts

movie clip within over button - hover state

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mike Land
movie clip within over button - hover state
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


Return to posts index

Abraham Chaffin
Re: movie clip within over button - hover state
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) {
<blockquote>button_click_me.gotoAndStop(2);</blockquote>
}

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) {
<blockquote>button_click_me.gotoAndStop(4);</blockquote>
}

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) {
<blockquote>button_click_me.gotoAndStop(1);</blockquote>
}

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) {
<blockquote>button_click_me.gotoAndStop(4);</blockquote>
}

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


Return to posts index

Paul Tayag
Re: movie clip within over button - hover state
on Jan 10, 2013 at 7:45:51 am

hi im new in flash.i just want to ask if how to continious animate the movie clip inside the downstate button.even if you dont hold the button/bad english.sorry,tnx for reply.im hoping/


Return to posts index


demetri tashie
Re: movie clip within over button - hover state
on Jan 10, 2013 at 1:41:10 pm

hi paul,

Component Buttons are also called 'Simple Buttons' for a reason - they are not meant to perform in the manner you are asking.

If you read Abraham's original answer to this post, you can see how to better accomplish what you are trying to do - by using MovieClips that are coded in Actionscript. Abraham's directions are still quite valid, so do try them, and if you still run into problems, let us know. If so, please start a new thread rather than responding to this 4 year old post.

Good luck!


Return to posts index

Paul Tayag
Re: movie clip within over button - hover state
on Jan 13, 2013 at 10:00:48 pm

thank you sir for reply.but abrahams way is to use as3.im not quite familiar with that,and i already apply solution for my past question.now i have encountered new problem.is there any command for movie clip like in button.(on press.on release) because i want to play the animaton inside the movie clip.after clicking it,.anyway the movie clip i in the down state of button:) tnx in reply/


Return to posts index

demetri tashie
Re: movie clip within over button - hover state
on Jan 15, 2013 at 12:21:08 am

sorry - i don't work with AS2. I do hope someone else can better help you out.

in AS3, if you are trying to get a MovieClip symbol to play, you would write a simple function. something has to be listening for an event, which will trigger the function. this example has the movieclip listening (waiting for) it to be clicked, then it will cuse the said movieclip to play:

movieclip.addEventListener(MouseEvent.CLICK, playMovie);
function playMovie(e:MouseEvent):void {
movieclip.play();
}

for mouse events, CLICK is supported, as well as MOUSE_DOWN, MOUSE_UP etc

but this is for AS3, not AS2.....


Return to posts index

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